From c41c4bcfd44bf387eb5c647a323460d58981e317 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?=
<80620802+burakboduroglu@users.noreply.github.com>
Date: Thu, 23 Jul 2026 20:51:23 +0300
Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A7=B9=20remove=20unused=20domai?=
=?UTF-8?q?n=20components?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- remove unimported legacy component src/components/events/event-card.tsx
- remove unimported legacy component src/components/exams/exam-card.tsx
- remove unimported legacy component src/components/exams/student-exam-room.tsx
- remove unimported legacy component src/components/messages/message-item-card.tsx
- remove unimported legacy component src/components/messages/quick-reply-bar.tsx
- remove unimported legacy component src/components/users/user-role-select.tsx
---
src/components/events/event-card.tsx | 74 ----
src/components/exams/exam-card.tsx | 94 -----
src/components/exams/student-exam-room.tsx | 361 ------------------
src/components/messages/message-item-card.tsx | 127 ------
src/components/messages/quick-reply-bar.tsx | 80 ----
src/components/users/user-role-select.tsx | 26 --
6 files changed, 762 deletions(-)
delete mode 100644 src/components/events/event-card.tsx
delete mode 100644 src/components/exams/exam-card.tsx
delete mode 100644 src/components/exams/student-exam-room.tsx
delete mode 100644 src/components/messages/message-item-card.tsx
delete mode 100644 src/components/messages/quick-reply-bar.tsx
delete mode 100644 src/components/users/user-role-select.tsx
diff --git a/src/components/events/event-card.tsx b/src/components/events/event-card.tsx
deleted file mode 100644
index 04210d3..0000000
--- a/src/components/events/event-card.tsx
+++ /dev/null
@@ -1,74 +0,0 @@
-import { Show } from "solid-js";
-import { Link } from "@tanstack/solid-router";
-import type { Event, EventAudience } from "@/api/client";
-import type { MessageKey } from "@/i18n/messages";
-import { Badge } from "@/components/ui/badge";
-import { cn } from "@/lib/cn";
-import { createNow } from "@/lib/create-now";
-import { formatDateTime } from "@/lib/format";
-import { scheduleStatusClass, scheduleStatusDotClass, type ScheduleStatus } from "@/lib/schedule-status";
-import { usePreferences, useT } from "@/stores/preferences-context";
-
-function audienceLabel(audience: EventAudience, t: ReturnType): string {
- if (audience.kind === "role") return `${t("events.audience.role")}: ${t(`role.${audience.role}` as MessageKey)}`;
- if (audience.kind === "course") return t("events.audience.course");
- if (audience.kind === "registration") return t("events.audience.registration");
- return t("events.audience.school");
-}
-
-function eventStatus(event: Event, now: number): ScheduleStatus {
- if (event.starts_at == null) return "unscheduled";
- if (event.ends_at != null && event.ends_at < now) return "finished";
- if (event.starts_at > now) return "upcoming";
- return "active";
-}
-
-export function EventCard(props: { event: Event }) {
- const t = useT();
- const { locale } = usePreferences();
- const now = createNow();
- const status = () => eventStatus(props.event, now());
- const statusLabel = () => {
- const s = status();
- if (s === "unscheduled") return t("exams.unscheduled");
- if (s === "finished") return t("events.past");
- if (s === "upcoming") return t("events.upcoming");
- return t("dashboard.activeNow");
- };
-
- return (
-
-
-
-
-
- {props.event.title}
-
-
-
- {statusLabel()}
-
-
-
- {props.event.description || "—"}
-
-
{audienceLabel(props.event.audience, t)}
-
-
-
-
-
- {t("events.starts")}
- - {formatDateTime(props.event.starts_at, locale())}
-
-
-
-
- {t("events.ends")}
- - {formatDateTime(props.event.ends_at, locale())}
-
-
-
-
-
-
- );
-}
diff --git a/src/components/exams/exam-card.tsx b/src/components/exams/exam-card.tsx
deleted file mode 100644
index 5684ec7..0000000
--- a/src/components/exams/exam-card.tsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import { Show, createResource } from "solid-js";
-import { getSettings } from "@/api/settings";
-import type { Exam } from "@/api/client";
-import { Badge } from "@/components/ui/badge";
-import { ExamLink } from "@/components/exams/exam-link";
-import { cn } from "@/lib/cn";
-import { examKindLabel } from "@/lib/exam-labels";
-import { examDisplayStatus, examStatusMessageKey, examStatusTone } from "@/lib/exam-status";
-import { examWeight } from "@/lib/exam-weight";
-import { examDurationMs, formatDateTime, formatDurationMinutes } from "@/lib/format";
-import { scheduleStatusClass, scheduleStatusDotClass } from "@/lib/schedule-status";
-import { usePreferences, useT } from "@/stores/preferences-context";
-
-export function ExamCard(props: { exam: Exam; courseTitle?: string; now?: number }) {
- const t = useT();
- const { locale } = usePreferences();
- const [settings] = createResource(() => getSettings());
- const modeLabel = () => {
- if (props.exam.mode === "sync") return t("exams.mode.sync");
- if (props.exam.mode === "async") return t("exams.mode.async");
- if (props.exam.mode === "open") return t("exams.mode.open");
- return t("exams.unscheduled");
- };
-
- const status = () => {
- return examDisplayStatus(props.exam, props.now ?? Date.now());
- };
-
- const statusLabel = () => {
- return t(examStatusMessageKey(status()));
- };
-
- return (
-
-
-
-
-
-
- {props.courseTitle}
-
-
- {props.exam.title}
-
-
-
-
- {statusLabel()}
-
-
-
-
- {props.exam.description || "—"}
-
-
-
-
- {examKindLabel(String(props.exam.kind), t)}
-
- {(weight) => ({t("courses.weight")}: {weight()})}
-
-
-
- {modeLabel()}
-
-
-
-
-
-
-
-
-
-
- {t("events.starts")}
- - {formatDateTime(props.exam.starts_at, locale())}
-
-
-
- {t("events.ends")}
- - {formatDateTime(props.exam.ends_at, locale())}
-
-
-
-
-
- {t("exams.durationMinutes")}
- -
- {formatDurationMinutes(examDurationMs(props.exam.duration_ms, props.exam.starts_at, props.exam.ends_at), locale())}
-
-
-
-
-
-
- );
-}
diff --git a/src/components/exams/student-exam-room.tsx b/src/components/exams/student-exam-room.tsx
deleted file mode 100644
index 8a41f7f..0000000
--- a/src/components/exams/student-exam-room.tsx
+++ /dev/null
@@ -1,361 +0,0 @@
-import { For, Show, Suspense, createEffect, createMemo, createResource, createSignal, onCleanup } from "solid-js";
-import { getExamAttempt } from "@/api/exams";
-import { getExamAttemptQuestions } from "@/api/exams";
-import { postExamAttempt } from "@/api/exams";
-import { postExamAttemptAnswer } from "@/api/exams";
-import { postExamAttemptFinish } from "@/api/exams";
-import { ApiError, formatApiError } from "@/api/client";
-import type { AttemptQuestion, Exam, ExamAttempt } from "@/api/client";
-import { Badge } from "@/components/ui/badge";
-import { Button } from "@/components/ui/button";
-import { ConfirmDialog } from "@/components/ui/confirm-dialog";
-import { PageSpinner } from "@/components/ui/page-spinner";
-import { Textarea } from "@/components/ui/textarea";
-import { formatDateTime } from "@/lib/format";
-import { usePreferences, useT } from "@/stores/preferences-context";
-
-function formatRemaining(ms: number | null): string {
- if (ms == null) return "—";
- const safe = Math.max(0, ms);
- const totalSeconds = Math.floor(safe / 1000);
- const hours = Math.floor(totalSeconds / 3600);
- const minutes = Math.floor((totalSeconds % 3600) / 60);
- const seconds = totalSeconds % 60;
- return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
-}
-
-export function StudentExamRoom(props: { exam: Exam; compact?: boolean }) {
- const t = useT();
- const [attempt, { refetch: refetchAttempt, mutate: setAttempt }] = createResource(
- () => props.exam.id,
- async (examId) => {
- try {
- return await getExamAttempt(examId);
- } catch (err) {
- if (err instanceof ApiError && (err.status === 404 || err.status === 409)) return null;
- throw err;
- }
- },
- );
- const [questions, { refetch: refetchQuestions }] = createResource(
- () => (attempt() ? props.exam.id : null),
- async (examId) => {
- if (!examId) return [];
- return getExamAttemptQuestions(examId);
- },
- );
- const [error, setError] = createSignal("");
- const [pending, setPending] = createSignal(false);
- const [finishOpen, setFinishOpen] = createSignal(false);
- const [remainingMs, setRemainingMs] = createSignal(0);
- const [roomOpen, setRoomOpen] = createSignal(false);
- const scheduled = createMemo(() => props.exam.mode === "sync" || props.exam.mode === "async" || props.exam.mode === "open");
- const canWrite = createMemo(() => attempt()?.status === "in_progress" && (remainingMs() == null || remainingMs()! > 0));
-
- createEffect(() => {
- const current = attempt();
- const remaining = current?.remaining_ms ?? null;
- setRemainingMs(remaining);
- if (!current || current.status !== "in_progress" || remaining == null || remaining <= 0) return;
- const startedAt = Date.now();
- const initial = remaining;
- const timer = window.setInterval(() => {
- setRemainingMs(Math.max(0, initial - (Date.now() - startedAt)));
- }, 1000);
- onCleanup(() => window.clearInterval(timer));
- });
-
- const start = async () => {
- setError("");
- setPending(true);
- try {
- const next = await postExamAttempt(props.exam.id);
- setAttempt(next);
- setRoomOpen(true);
- await refetchQuestions();
- } catch (err) {
- setError(formatApiError(err));
- } finally {
- setPending(false);
- }
- };
-
- const saveAnswer = async (question: AttemptQuestion, value: string) => {
- setError("");
- setPending(true);
- try {
- if (question.kind === "choice") {
- await postExamAttemptAnswer(props.exam.id, { question_id: question.id, selected: Number(value) });
- } else {
- await postExamAttemptAnswer(props.exam.id, { question_id: question.id, text: value });
- }
- await refetchAttempt();
- await refetchQuestions();
- } catch (err) {
- setError(formatApiError(err));
- } finally {
- setPending(false);
- }
- };
-
- const finish = async () => {
- setError("");
- setPending(true);
- try {
- const next = await postExamAttemptFinish(props.exam.id);
- setAttempt(next);
- await refetchQuestions();
- } catch (err) {
- setError(formatApiError(err));
- } finally {
- setPending(false);
- }
- };
-
- return (
-
-
-
-
-
{t("attempt.title")}
-
- {props.exam.mode === "sync" ? t("exams.mode.sync") : props.exam.mode === "async" ? t("exams.mode.async") : props.exam.mode === "open" ? t("exams.mode.open") : t("attempt.unscheduled")}
-
-
-
{t("attempt.unscheduled")}}>
- void start()}>
- {t("attempt.start")}
-
- }
- >
-
-
-
-
-
-
- {error() && {error()}
}
-
- }>
-
- {t("attempt.notStarted")}
}>
- {(a) => }
-
-
-
-
-
- {t("attempt.closed")}
-
-
-
-
- {(question, index) => (
- saveAnswer(question, value)}
- />
- )}
-
-
-
-
-
-
-
-
-
- );
-}
-
-function AttemptSummary(props: { attempt: ExamAttempt; remainingMs: number | null }) {
- const t = useT();
- const { locale } = usePreferences();
- const statusLabel = () => {
- if (props.attempt.status === "in_progress") return t("attempt.inProgress");
- if (props.attempt.status === "submitted") return t("attempt.submitted");
- if (props.attempt.status === "expired") return t("attempt.expired");
- return props.attempt.status;
- };
- return (
-
-
-
{t("attempt.status")}
-
{statusLabel()}
-
-
-
{t("attempt.remaining")}
-
{formatRemaining(props.remainingMs)}
-
-
-
{t("attempt.progress")}
-
{props.attempt.answered} / {props.attempt.question_count}
-
-
-
{t("attempt.deadline")}
-
{formatDateTime(props.attempt.deadline, locale())}
-
-
-
{t("attempt.serverNow")}
-
{formatDateTime(props.attempt.now, locale())}
-
-
-
-
{t("attempt.mark")}
-
{props.attempt.mark}
-
-
-
- );
-}
-
-function QuestionAnswerCard(props: {
- index: number;
- nextQuestionId?: string;
- question: AttemptQuestion;
- disabled: boolean;
- onSave: (value: string) => Promise;
-}) {
- const t = useT();
- const { locale } = usePreferences();
- const [value, setValue] = createSignal(
- props.question.kind === "choice"
- ? props.question.answer?.selected != null
- ? String(props.question.answer.selected)
- : ""
- : props.question.answer?.text ?? "",
- );
- const [saved, setSaved] = createSignal(false);
- let questionId = props.question.id;
-
- createEffect(() => {
- if (props.question.id === questionId) return;
- questionId = props.question.id;
- setValue(
- props.question.kind === "choice"
- ? props.question.answer?.selected != null
- ? String(props.question.answer.selected)
- : ""
- : props.question.answer?.text ?? "",
- );
- setSaved(false);
- });
-
- const save = async () => {
- await props.onSave(value());
- setSaved(true);
- if (props.nextQuestionId) {
- document.getElementById(`question-${props.nextQuestionId}`)?.scrollIntoView({ behavior: "smooth", block: "start" });
- }
- };
-
- return (
-
-
- #{props.index}
- {props.question.points} {t("questions.points")}
-
- {t("attempt.saved")}
-
-
- {(updatedAt) => {t("attempt.savedAt")}: {formatDateTime(updatedAt(), locale())}}
-
-
-
-
-
- {props.question.text}
- {
- setSaved(false);
- setValue(e.currentTarget.value);
- }}
- />
- }
- >
-
-
- {(choice, choiceIndex) => (
-
- )}
-
-
-
-
-
- );
-}
diff --git a/src/components/messages/message-item-card.tsx b/src/components/messages/message-item-card.tsx
deleted file mode 100644
index 27ce3f0..0000000
--- a/src/components/messages/message-item-card.tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-import { Show } from "solid-js";
-import type { Message } from "@/api/client";
-import { Badge } from "@/components/ui/badge";
-import { cn } from "@/lib/cn";
-import { personLabel } from "@/lib/person";
-import { useT } from "@/stores/preferences-context";
-
-interface MessageItemCardProps {
- message: Message;
- currentUserId?: string;
- folder: string;
- isSelected: boolean;
- onSelect: () => void;
-}
-
-export function MessageItemCard(props: MessageItemCardProps) {
- const t = useT();
-
- const isSent = () => props.folder === "sent" || props.message.sender.id === props.currentUserId;
- const peer = () => (isSent() ? props.message.recipient : props.message.sender);
- const peerName = () => personLabel(peer());
- const role = () => (isSent() ? props.message.recipient_role : props.message.sender_role);
- const unread = () => !isSent() && !props.message.read;
-
- const initial = () => {
- const name = peerName().trim();
- return name.charAt(0).toUpperCase() || "?";
- };
-
- const formattedTime = (ts: number) => {
- const date = new Date(ts);
- const now = new Date();
- const isToday =
- date.getDate() === now.getDate() &&
- date.getMonth() === now.getMonth() &&
- date.getFullYear() === now.getFullYear();
-
- if (isToday) {
- return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
- }
- return date.toLocaleDateString([], { month: "short", day: "numeric" });
- };
-
- return (
-
- );
-}
diff --git a/src/components/messages/quick-reply-bar.tsx b/src/components/messages/quick-reply-bar.tsx
deleted file mode 100644
index 6c900af..0000000
--- a/src/components/messages/quick-reply-bar.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import { createSignal, Show } from "solid-js";
-import { Button } from "@/components/ui/button";
-import { Textarea } from "@/components/ui/textarea";
-import { IconSend } from "@/components/ui/icons";
-import { useT } from "@/stores/preferences-context";
-
-interface QuickReplyBarProps {
- recipientName: string;
- defaultSubject: string;
- onSend: (body: string, subject: string) => Promise;
- disabled?: boolean;
-}
-
-export function QuickReplyBar(props: QuickReplyBarProps) {
- const t = useT();
- const [body, setBody] = createSignal("");
- const [sending, setSending] = createSignal(false);
- const [error, setError] = createSignal("");
-
- const handleSend = async (e?: Event) => {
- if (e) e.preventDefault();
- const content = body().trim();
- if (!content || sending() || props.disabled) return;
-
- setError("");
- setSending(true);
-
- try {
- const replySubject = props.defaultSubject.startsWith("Re:")
- ? props.defaultSubject
- : `Re: ${props.defaultSubject}`;
-
- await props.onSend(content, replySubject);
- setBody("");
- } catch (err: any) {
- setError(err?.message || "Mesaj gönderilemedi");
- } finally {
- setSending(false);
- }
- };
-
- const handleKeyDown = (e: KeyboardEvent) => {
- if (e.key === "Enter" && !e.shiftKey) {
- e.preventDefault();
- handleSend();
- }
- };
-
- return (
-
- );
-}
diff --git a/src/components/users/user-role-select.tsx b/src/components/users/user-role-select.tsx
deleted file mode 100644
index 9ee90b6..0000000
--- a/src/components/users/user-role-select.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import type { Role } from "@/api/client";
-import type { MessageKey } from "@/i18n/messages";
-import { Select } from "@/components/ui/select";
-import { ROLES } from "@/lib/roles";
-import { useT } from "@/stores/preferences-context";
-
-export function UserRoleSelect(props: {
- value: Role;
- disabled?: boolean;
- onChange: (role: Role) => void;
-}) {
- const t = useT();
- return (
-
- );
-}