From c866b7e8797a542ca6a2f3e925992df8c0c3b023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Sun, 2 Aug 2026 19:07:27 +0300 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=93=8E=20shared=20file-type?= =?UTF-8?q?=20metadata=20across=20notes=20and=20homework=20-=20file-type.t?= =?UTF-8?q?sx:=20extension=20+=20icon/badge=20mapping=20extracted=20from?= =?UTF-8?q?=20=20=20note-files-panel's=20local=20copy,=20reused=20by=20hom?= =?UTF-8?q?ework=20panels=20-=20homework=20answer=20moves=20to=20the=20ric?= =?UTF-8?q?h=20text=20editor=20with=20rich=20display=20on=20=20=20the=20su?= =?UTF-8?q?bmissions=20side;=20icon-only=20download/delete=20actions=20-?= =?UTF-8?q?=20submission=20file=20lists=20become=20the=20compact=20thumbna?= =?UTF-8?q?il=20grid=20with=20a=20count=20=20=20badge,=20collapsed=20to=20?= =?UTF-8?q?the=20header=20row=20until=20a=20file=20exists?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homework/homework-submission-panel.tsx | 70 +++++++++++-------- .../homework/homework-submissions-panel.tsx | 55 +++++++++------ src/components/notes/note-files-panel.tsx | 36 ++-------- src/lib/file-type.tsx | 29 ++++++++ 4 files changed, 106 insertions(+), 84 deletions(-) create mode 100644 src/lib/file-type.tsx diff --git a/src/components/homework/homework-submission-panel.tsx b/src/components/homework/homework-submission-panel.tsx index 0015da9..d69b022 100644 --- a/src/components/homework/homework-submission-panel.tsx +++ b/src/components/homework/homework-submission-panel.tsx @@ -12,11 +12,12 @@ import { getSettings } from "@/api/settings"; import { Alert } from "@/components/ui/alert"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; -import { EmptyState } from "@/components/ui/empty-state"; import { IconDownload, IconTrash, IconUploadCloud } from "@/components/ui/icons"; import { PageSpinner } from "@/components/ui/page-spinner"; -import { Textarea } from "@/components/ui/textarea"; +import { RichTextEditor } from "@/components/ui/rich-text-editor"; +import { cn } from "@/lib/cn"; import { createFlash } from "@/lib/flash"; +import { fileTypeMeta } from "@/lib/file-type"; import { formatDateTime } from "@/lib/format"; import { formatBytes, maxUploadBytes } from "@/lib/upload-limits"; import { usePreferences, useT } from "@/stores/preferences-context"; @@ -54,6 +55,7 @@ export function HomeworkSubmissionPanel(props: { homeworkId: string }) { }, ); const maxFileBytes = () => maxUploadBytes(settings()); + const hasFiles = () => (submission()?.files.length ?? 0) > 0; createEffect(() => setText(submission()?.text ?? "")); @@ -139,51 +141,57 @@ export function HomeworkSubmissionPanel(props: { homeworkId: string }) { )}
void save(event)}> -