forge
Explore
Log in

Don't you dare go Hollow

📱 phone-sized tables, toolbars and AI pages

Browse files at this commit

ee4b86b0450cc95f4b9b4f73a6da53ca45b70f2cBurak BoduroğluParent: ba7ff56
  • feat
    • 📱 phone-sized tables, toolbars and AI pages
Show full message
feat: 📱 phone-sized tables, toolbars and AI pages
- tables show half a page on phones (10 → 5, never below 5):
  createResponsivePageSize feeds DataTable and every page that pages on
  its own, including the server-paged ones' limit/offset
- one pager for the whole app: TablePagination on a single row with
  touch-sized buttons; a single page keeps the count and drops the
  arrows; PaginationControls is gone
- toolbars wrap by width: search and actions share the first row on a
  phone, filters take the next; the column menu leaves card layout and
  "yakında" buttons step aside on phones
- search boxes are 16px on phones so iOS stops zooming into them
- phone cards drop empty fields and shrink the row menu to its ⋮ glyph
- students and classes filters carry their label ("Eğitim yılı: Tümü")
- exam results page through DataTable instead of a second pager
- studio library pages its run history
- /ai/study on phones: the history is a left drawer behind a top bar
  with the chat's name and a new-chat button; the composer stays docked
- /ai/studio: a way back to the library from an open note, tighter
  panels and touch-sized summary actions on phones
src/components/ai/note-studio-panel.tsxmodified+24 -4
@@ -7,13 +7,16 @@ import { formatApiError, type CourseNote } from "@/api/client";
77 import { PodcastPanel } from "@/components/notes/podcast-panel";
88 import { RagOutputsPanel } from "@/components/notes/rag-outputs-panel";
99 import { StudioOutputLibrary } from "@/components/ai/studio-output-library";
10+import { Button } from "@/components/ui/button";
1011 import { EmptyState } from "@/components/ui/empty-state";
1112 import { ErrorAlert } from "@/components/ui/error-alert";
13+import { IconChevronLeft } from "@/components/ui/icons";
1214 import { Label } from "@/components/ui/label";
1315 import { PageSpinner } from "@/components/ui/page-spinner";
1416 import { SearchableSelect } from "@/components/ui/searchable-select";
1517 import { useAuth } from "@/stores/auth-context";
1618 import { useT } from "@/stores/preferences-context";
19+import { cn } from "@/lib/cn";
1720 import { courseNoteFiles } from "@/lib/note-source";
1821 import { hasMinRole } from "@/lib/roles";
1922
@@ -74,7 +77,9 @@ export function NoteStudioPanel() {
7477 everything produced so far. Flat hairline cards, no banner and no
7578 shadow stack — the work is the content, not the chrome. */}
7679 <div class="w-full space-y-8">
77- <header class="space-y-1.5">
80+ {/* On a phone an open note needs the screen more than the page
81+ title does; the picker below still says where you are. */}
82+ <header class={cn("space-y-1.5", selected() && "max-sm:hidden")}>
7883 <h1 class="text-2xl font-semibold tracking-tight text-text-strong">{t("aiHub.tab.studio")}</h1>
7984 <p class="text-sm text-muted-foreground">{t("aiStudio.heading")}</p>
8085 </header>
@@ -102,9 +107,24 @@ export function NoteStudioPanel() {
102107 >
103108 {(note) => (
104109 <section ref={outputsSection} class="scroll-mt-20 space-y-4">
105- <div class="flex flex-wrap items-baseline justify-between gap-2">
106- <h2 class="min-w-0 truncate text-base font-semibold text-text-strong">{note().title}</h2>
107- <span class="shrink-0 text-xs text-muted-foreground">{note().courseTitle}</span>
110+ {/* The library steps aside while a note is open; this is the
111+ way back to it without emptying the picker by hand. */}
112+ <div class="flex items-center gap-3">
113+ <Button
114+ type="button"
115+ variant="outline"
116+ size="sm"
117+ class="h-8 shrink-0 gap-1 rounded-lg max-sm:h-10 max-sm:w-10 max-sm:px-0"
118+ aria-label={t("aiStudio.backToLibrary")}
119+ onClick={() => setSelectedId("")}
120+ >
121+ <IconChevronLeft class="h-4 w-4" />
122+ <span class="hidden sm:inline">{t("aiStudio.backToLibrary")}</span>
123+ </Button>
124+ <div class="min-w-0 flex-1">
125+ <h2 class="truncate text-base font-semibold text-text-strong">{note().title}</h2>
126+ <p class="truncate text-xs text-muted-foreground">{note().courseTitle}</p>
127+ </div>
108128 </div>
109129 <div class="grid gap-4 xl:grid-cols-2">
110130 <RagOutputsPanel
src/components/ai/studio-output-library.test.tsxmodified+21 -0
@@ -99,6 +99,27 @@ describe("StudioOutputLibrary", () => {
9999 expect(current.length).toBe(2);
100100 });
101101
102+ it("pages a long history ten rows at a time", async () => {
103+ podcastApi.listPodcastJobs.mockResolvedValue(page(
104+ Array.from({ length: 12 }, (_, index) =>
105+ podcast({ job_id: `job-${index}`, source_title: `Bölüm ${index + 1}`, source_id: `other-${index}`, created_at: Date.UTC(2026, 0, 1, index), finished_at: Date.UTC(2026, 0, 1, index) }),
106+ ),
107+ ));
108+ courseNotesApi.getCourseNoteRag.mockResolvedValue(page([]));
109+ renderLibrary();
110+
111+ // Newest first: episode 12 leads page one, episode 2 closes it.
112+ await waitFor(() => expect(screen.getByText("Bölüm 12")).toBeTruthy());
113+ expect(screen.getByText("Bölüm 3")).toBeTruthy();
114+ expect(screen.queryByText("Bölüm 2")).toBeNull();
115+ expect(screen.getByText("1-10 / 12")).toBeTruthy();
116+
117+ fireEvent.click(screen.getByRole("button", { name: "Sonraki" }));
118+ expect(screen.getByText("Bölüm 2")).toBeTruthy();
119+ expect(screen.getByText("Bölüm 1")).toBeTruthy();
120+ expect(screen.queryByText("Bölüm 12")).toBeNull();
121+ });
122+
102123 it("opens the run inspector for an episode instead of selecting its note", async () => {
103124 const onSelect = renderLibrary();
104125
src/components/ai/studio-output-library.tsxmodified+32 -2
@@ -1,4 +1,4 @@
1-import { For, Show, Suspense, createMemo, createSignal } from "solid-js";
1+import { For, Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
22 import { createResource } from "@/lib/create-resource";
33 import { getCourseNoteRag } from "@/api/course-notes";
44 import { listPodcastJobs } from "@/api/podcast";
@@ -8,7 +8,9 @@ import { Badge } from "@/components/ui/badge";
88 import { EmptyInline } from "@/components/ui/empty-inline";
99 import { IconSparkles, IconWaveform } from "@/components/ui/icons";
1010 import { PageSpinner } from "@/components/ui/page-spinner";
11+import { TablePagination } from "@/components/ui/table-pagination";
1112 import { cn } from "@/lib/cn";
13+import { createResponsivePageSize } from "@/lib/create-page-size";
1214 import { formatDateTime } from "@/lib/format";
1315 import { usePreferences, useT } from "@/stores/preferences-context";
1416
@@ -34,6 +36,7 @@ type StudioArtifact = {
3436 };
3537
3638 const LIBRARY_LIMIT = 100;
39+const LIBRARY_PAGE_SIZE = 10;
3740
3841 export function StudioOutputLibrary(props: {
3942 notes: StudioLibraryNote[];
@@ -112,6 +115,21 @@ export function StudioOutputLibrary(props: {
112115 return rows.sort((a, b) => b.at - a.at);
113116 });
114117
118+ // The history is merged here from two sources, so it pages in memory.
119+ const [page, setPage] = createSignal(0);
120+ const pageSize = createResponsivePageSize(LIBRARY_PAGE_SIZE);
121+ const total = () => items()?.length ?? 0;
122+ const pageCount = createMemo(() => Math.max(1, Math.ceil(total() / pageSize())));
123+ const pageItems = createMemo(() => (items() ?? []).slice(page() * pageSize(), (page() + 1) * pageSize()));
124+ createEffect(() => {
125+ source();
126+ pageSize();
127+ setPage(0);
128+ });
129+ createEffect(() => {
130+ if (page() > pageCount() - 1) setPage(pageCount() - 1);
131+ });
132+
115133 const open = (item: StudioArtifact) => {
116134 // A produced episode has an artifact of its own to inspect; a summary is
117135 // rendered by the note's own producer panel, so that row opens the note.
@@ -145,7 +163,7 @@ export function StudioOutputLibrary(props: {
145163 {/* A run history, the way a studio lists one: hairline dividers, a
146164 status dot, what was produced and when — no cards. */}
147165 <ul class="divide-y divide-border-hairline">
148- <For each={items()}>
166+ <For each={pageItems()}>
149167 {(item) => (
150168 <li>
151169 <button
@@ -199,6 +217,18 @@ export function StudioOutputLibrary(props: {
199217 )}
200218 </For>
201219 </ul>
220+ <Show when={pageCount() > 1}>
221+ <div class="border-t border-border-hairline p-2">
222+ <TablePagination
223+ pageIndex={page()}
224+ pageCount={pageCount()}
225+ pageSize={pageSize()}
226+ total={total()}
227+ onPageChange={setPage}
228+ class="border-0 bg-transparent"
229+ />
230+ </div>
231+ </Show>
202232 </Show>
203233 </Suspense>
204234
src/components/courses/course-notes-panel.tsxmodified+8 -5
@@ -1,4 +1,5 @@
11 import { Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
2+import { createResponsivePageSize } from "@/lib/create-page-size";
23 import { createResource } from "@/lib/create-resource";
34 import { deleteCourseNoteById, getCourseNotes, patchCourseNoteById, postCourseNote, postCourseNoteFile } from "@/api/course-notes";
45 import { formatApiError } from "@/api/client";
@@ -9,7 +10,7 @@ import { Button } from "@/components/ui/button";
910 import { DataToolbar } from "@/components/ui/data-toolbar";
1011 import { IconPlus } from "@/components/ui/icons";
1112 import { PageSpinner } from "@/components/ui/page-spinner";
12-import { PaginationControls } from "@/components/ui/pagination-controls";
13+import { TablePagination } from "@/components/ui/table-pagination";
1314 import { SidePanel } from "@/components/ui/side-panel";
1415 import { createFlash } from "@/lib/flash";
1516 import { courseNoteFiles } from "@/lib/note-source";
@@ -29,6 +30,7 @@ export function CourseNotesPanel(props: {
2930 const [error, setError] = createSignal("");
3031 const [flash, setFlash] = createFlash();
3132 const [page, setPage] = createSignal(0);
33+ const pageSize = createResponsivePageSize(NOTE_PAGE_SIZE);
3234 const [search, setSearch] = createSignal("");
3335
3436 const [list, { refetch }] = createResource(
@@ -42,12 +44,13 @@ export function CourseNotesPanel(props: {
4244 return query ? allNotes().filter((note) => matchesSearch(query, note.title, note.content)) : allNotes();
4345 });
4446 const total = () => filteredNotes().length;
45- const pageItems = createMemo(() => filteredNotes().slice(page() * NOTE_PAGE_SIZE, (page() + 1) * NOTE_PAGE_SIZE));
46- const totalPages = createMemo(() => Math.max(1, Math.ceil(total() / NOTE_PAGE_SIZE)));
47+ const pageItems = createMemo(() => filteredNotes().slice(page() * pageSize(), (page() + 1) * pageSize()));
48+ const totalPages = createMemo(() => Math.max(1, Math.ceil(total() / pageSize())));
4749 const safePage = createMemo(() => Math.min(page(), totalPages() - 1));
4850
4951 createEffect(() => {
5052 search();
53+ pageSize();
5154 setPage(0);
5255 });
5356
@@ -153,8 +156,8 @@ export function CourseNotesPanel(props: {
153156 }, t("common.deleted"))
154157 }
155158 />
156- <Show when={total() > NOTE_PAGE_SIZE}>
157- <PaginationControls page={safePage()} totalPages={totalPages()} onPageChange={setPage} />
159+ <Show when={total() > pageSize()}>
160+ <TablePagination pageIndex={safePage()} pageCount={totalPages()} onPageChange={setPage} />
158161 </Show>
159162 </Show>
160163 </Suspense>
src/components/exams/bank-question-picker.tsxmodified+10 -7
@@ -1,4 +1,5 @@
1-import { For, Show, createSignal } from "solid-js";
1+import { For, Show, createSignal, createEffect, on } from "solid-js";
2+import { createResponsivePageSize } from "@/lib/create-page-size";
23 import { createResource } from "@/lib/create-resource";
34 import type { BankQuestion, Subject } from "@/api/client";
45 import { formatApiError } from "@/api/client";
@@ -7,7 +8,7 @@ import { Badge } from "@/components/ui/badge";
78 import { Button } from "@/components/ui/button";
89 import { Input } from "@/components/ui/input";
910 import { Label } from "@/components/ui/label";
10-import { PaginationControls } from "@/components/ui/pagination-controls";
11+import { TablePagination } from "@/components/ui/table-pagination";
1112 import { Select } from "@/components/ui/select";
1213 import { cn } from "@/lib/cn";
1314 import { createDebouncedSignal } from "@/lib/create-debounced-signal";
@@ -25,16 +26,18 @@ export function BankQuestionPicker(props: {
2526 const t = useT();
2627 const [query, setQuery, debouncedQuery] = createDebouncedSignal();
2728 const [page, setPage] = createSignal(0);
29+ const pageSize = createResponsivePageSize(PICKER_PAGE_SIZE);
30+ createEffect(on(pageSize, () => setPage(0), { defer: true }));
2831 const [selected, setSelected] = createSignal<BankQuestion | null>(null);
2932 const [subjectId, setSubjectId] = createSignal("");
3033 const [error, setError] = createSignal("");
3134 const [pending, setPending] = createSignal(false);
3235 const [templates] = createResource(
33- () => ({ page: page(), q: debouncedQuery().trim() }),
36+ () => ({ page: page(), size: pageSize(), q: debouncedQuery().trim() }),
3437 (params) =>
3538 getBankQuestions({
36- limit: PICKER_PAGE_SIZE,
37- offset: params.page * PICKER_PAGE_SIZE,
39+ limit: params.size,
40+ offset: params.page * params.size,
3841 ...(params.q ? { q: params.q } : {}),
3942 }),
4043 );
@@ -113,8 +116,8 @@ export function BankQuestionPicker(props: {
113116 {t("bank.countShown", { shown: visible().length, total: total() })}
114117 </p>
115118 </Show>
116- <Show when={pagesOf(total(), PICKER_PAGE_SIZE) > 1}>
117- <PaginationControls page={page()} totalPages={pagesOf(total(), PICKER_PAGE_SIZE)} onPageChange={setPage} />
119+ <Show when={pagesOf(total(), pageSize()) > 1}>
120+ <TablePagination pageIndex={page()} pageCount={pagesOf(total(), pageSize())} onPageChange={setPage} />
118121 </Show>
119122
120123 <Show when={selected()}>
src/components/layout/celebi-thread-list.tsxmodified+2 -2
@@ -4,7 +4,7 @@ import { getChatbotThreads, type ChatbotThread } from "@/api/chatbot";
44 import { EmptyInline } from "@/components/ui/empty-inline";
55 import { IconEdit, IconTrash } from "@/components/ui/icons";
66 import { PageSpinner } from "@/components/ui/page-spinner";
7-import { PaginationControls } from "@/components/ui/pagination-controls";
7+import { TablePagination } from "@/components/ui/table-pagination";
88 import { cn } from "@/lib/cn";
99 import { formatDateTime } from "@/lib/format";
1010 import { usePreferences, useT } from "@/stores/preferences-context";
@@ -71,7 +71,7 @@ export function CelebiThreadList(props: {
7171 </div>
7272 <Show when={totalPages() > 1}>
7373 <div class="mt-3 shrink-0">
74- <PaginationControls page={page()} totalPages={totalPages()} onPageChange={setPage} />
74+ <TablePagination pageIndex={page()} pageCount={totalPages()} onPageChange={setPage} />
7575 </div>
7676 </Show>
7777 </div>
src/components/notes/note-files-panel.tsxmodified+2 -2
@@ -13,7 +13,7 @@ import { FormDialog } from "@/components/ui/form-dialog";
1313 import { createFlash } from "@/lib/flash";
1414 import { IconDownload, IconEdit, IconEye, IconPlus, IconTrash } from "@/components/ui/icons";
1515 import { PageSpinner } from "@/components/ui/page-spinner";
16-import { PaginationControls } from "@/components/ui/pagination-controls";
16+import { TablePagination } from "@/components/ui/table-pagination";
1717 import { TableRowActions } from "@/components/ui/table-row-actions";
1818 import { cn } from "@/lib/cn";
1919 import { fileTypeMeta } from "@/lib/file-type";
@@ -253,7 +253,7 @@ export function NoteFilesPanel(props: {
253253 </For>
254254 </ul>
255255 <Show when={(files() ?? []).length > FILE_PAGE_SIZE}>
256- <PaginationControls page={filePage()} totalPages={totalPages()} onPageChange={setFilePage} />
256+ <TablePagination pageIndex={filePage()} pageCount={totalPages()} onPageChange={setFilePage} />
257257 </Show>
258258 <NoteFilePreview noteId={props.noteId} source={props.source} file={previewFile()} onClose={() => setPreviewFile(null)} />
259259 </Show>
src/components/notes/podcast-history.tsxmodified+9 -6
@@ -1,4 +1,5 @@
11 import { For, Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
2+import { createResponsivePageSize } from "@/lib/create-page-size";
23 import { createResource } from "@/lib/create-resource";
34 import { formatApiError } from "@/api/client";
45 import type { MessageKey } from "@/i18n/messages";
@@ -8,7 +9,7 @@ import { Badge } from "@/components/ui/badge";
89 import { Button, buttonVariants } from "@/components/ui/button";
910 import { EmptyInline } from "@/components/ui/empty-inline";
1011 import { PageSpinner } from "@/components/ui/page-spinner";
11-import { PaginationControls } from "@/components/ui/pagination-controls";
12+import { TablePagination } from "@/components/ui/table-pagination";
1213 import { IconDownload, IconWaveform } from "@/components/ui/icons";
1314 import { cn } from "@/lib/cn";
1415 import { podcastDownloadFilename, usePodcastDownloadT } from "@/components/notes/podcast-download";
@@ -40,19 +41,21 @@ export function PodcastHistory(props: { noteId?: string; active?: boolean; refet
4041 const { locale } = usePreferences();
4142 const [playing, setPlaying] = createSignal("");
4243 const [page, setPage] = createSignal(0);
44+ const pageSize = createResponsivePageSize(HISTORY_PAGE_SIZE);
4345 const active = () => props.active !== false;
4446
4547 createEffect(() => {
4648 props.noteId;
49+ pageSize();
4750 setPage(0);
4851 });
4952
5053 // The source is the scope string, not a fresh object: an identity-stable
5154 // value keeps the resource from refetching when nothing about it changed.
52- const source = createMemo(() => (active() && props.noteId ? { noteId: props.noteId, page: page() } : null));
55+ const source = createMemo(() => (active() && props.noteId ? { noteId: props.noteId, page: page(), size: pageSize() } : null));
5356 const [list, { refetch }] = createResource(
5457 source,
55- (scope) => listPodcastJobs({ limit: HISTORY_PAGE_SIZE, offset: scope.page * HISTORY_PAGE_SIZE, sourceId: scope.noteId }),
58+ (scope) => listPodcastJobs({ limit: scope.size, offset: scope.page * scope.size, sourceId: scope.noteId }),
5659 );
5760
5861 // The panel bumps the key ("", then the job id) when a generation finishes;
@@ -63,7 +66,7 @@ export function PodcastHistory(props: { noteId?: string; active?: boolean; refet
6366 });
6467
6568 const jobs = () => list()?.items ?? [];
66- const totalPages = createMemo(() => Math.max(1, Math.ceil((list()?.total ?? 0) / HISTORY_PAGE_SIZE)));
69+ const totalPages = createMemo(() => Math.max(1, Math.ceil((list()?.total ?? 0) / pageSize())));
6770 const safePage = createMemo(() => Math.min(page(), totalPages() - 1));
6871
6972 createEffect(() => {
@@ -174,8 +177,8 @@ export function PodcastHistory(props: { noteId?: string; active?: boolean; refet
174177 </For>
175178 </ul>
176179 </Show>
177- <Show when={(list()?.total ?? 0) > HISTORY_PAGE_SIZE}>
178- <PaginationControls page={safePage()} totalPages={totalPages()} onPageChange={setPage} />
180+ <Show when={(list()?.total ?? 0) > pageSize()}>
181+ <TablePagination pageIndex={safePage()} pageCount={totalPages()} onPageChange={setPage} />
179182 </Show>
180183 </Suspense>
181184 </Show>
src/components/notes/podcast-panel.tsxmodified+1 -1
@@ -176,7 +176,7 @@ export function PodcastPanel(props: { noteId: string; active?: boolean; noteTitl
176176 </section>
177177 }
178178 >
179- <section class="space-y-4 rounded-xl border border-border-line bg-surface-base p-4">
179+ <section class="space-y-4 rounded-xl border border-border-line bg-surface-base p-3 sm:p-4">
180180 <div class="flex items-start gap-3">
181181 <div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary-text">
182182 <IconWaveform class="h-5 w-5" />
src/components/notes/rag-outputs-panel.tsxmodified+6 -4
@@ -199,19 +199,21 @@ export function RagOutputsPanel(props: {
199199 };
200200
201201 return (
202- <section class="space-y-3 rounded-xl border border-border-line bg-surface-base p-4">
202+ <section class="space-y-3 rounded-xl border border-border-line bg-surface-base p-3 sm:p-4">
203203 <div class="flex flex-wrap items-start justify-between gap-3">
204204 <div>
205205 <h3 class="text-sm font-semibold">{t("courseNotes.ragTitle")}</h3>
206206 <p class="mt-0.5 text-xs text-muted-foreground">{t("courseNotes.ragHint")}</p>
207207 </div>
208- <div class="flex flex-wrap items-center justify-end gap-2">
208+ {/* Phones: the actions take the full row at touch size, the main one
209+ stretching, instead of a cluster of 32px targets. */}
210+ <div class="flex flex-wrap items-center justify-end gap-2 max-sm:w-full max-sm:[&_[data-row-actions-trigger]]:h-10 max-sm:[&_[data-row-actions-trigger]]:min-w-10">
209211 <Show when={props.canManage !== false && props.source.reindexRag}>
210212 <Button
211213 type="button"
212214 size="sm"
213215 variant="ghost"
214- class="topbar-ai-control h-8 min-w-[78px] rounded-lg px-2"
216+ class="topbar-ai-control h-8 min-w-[78px] rounded-lg px-2 max-sm:h-10 max-sm:flex-1"
215217 disabled={!available() || generating()}
216218 onClick={() => void generate()}
217219 >
@@ -273,7 +275,7 @@ export function RagOutputsPanel(props: {
273275 <span class="text-xs font-semibold uppercase tracking-wide text-muted-foreground">{t("courseNotes.markdownPreview")}</span>
274276 <span class="text-xs text-muted-foreground">{formatDateTime(current().generated_at, locale())}</span>
275277 </header>
276- <div class="p-4">
278+ <div class="p-3 sm:p-4">
277279 <RagOutputContent payload={current().payload} />
278280 </div>
279281 </article>
src/components/rag/rag-composer.tsxmodified+2 -1
@@ -72,7 +72,8 @@ export function RagComposer(props: {
7272 <IconSend class="h-4 w-4" />
7373 </Button>
7474 </div>
75- <p class="mx-auto mt-2 w-full max-w-3xl px-1 text-center text-[11px] leading-4 text-muted-foreground">{props.hint}</p>
75+ {/* Enter / Shift+Enter means nothing on a touch keyboard. */}
76+ <p class="mx-auto mt-2 w-full max-w-3xl px-1 text-center text-[11px] leading-4 text-muted-foreground [@media(pointer:coarse)]:hidden">{props.hint}</p>
7677 </form>
7778 );
7879 }
src/components/rag/rag-copy.tsmodified+4 -0
@@ -19,6 +19,8 @@ const copy = {
1919 title: "Ask your notes",
2020 newThread: "New chat",
2121 history: "Chat history",
22+ openHistory: "Open chat history",
23+ closeHistory: "Close chat history",
2224 untitled: "Untitled chat",
2325 emptyThreads: "No chats yet",
2426 emptyThreadsHint: "Start a new chat to ask the course corpus a question.",
@@ -78,6 +80,8 @@ const copy = {
7880 title: "Notlarına sor",
7981 newThread: "Yeni sohbet",
8082 history: "Sohbet geçmişi",
83+ openHistory: "Sohbet geçmişini aç",
84+ closeHistory: "Sohbet geçmişini kapat",
8185 untitled: "Başlıksız sohbet",
8286 emptyThreads: "Henüz sohbet yok",
8387 emptyThreadsHint: "Ders arşivine soru sormak için yeni bir sohbet başlat.",
src/components/rag/rag-study-panel.tsxmodified+89 -8
@@ -19,7 +19,7 @@ import { RagThreadList } from "@/components/rag/rag-thread-list";
1919 import { Alert } from "@/components/ui/alert";
2020 import { Button } from "@/components/ui/button";
2121 import { ConfirmDialog } from "@/components/ui/confirm-dialog";
22-import { IconChevronDown, IconPlus } from "@/components/ui/icons";
22+import { IconChevronDown, IconMenu, IconPlus, IconX } from "@/components/ui/icons";
2323 import { cn } from "@/lib/cn";
2424 import { scopeFromCitations } from "@/lib/rag-study-scope";
2525 import { usePreferences } from "@/stores/preferences-context";
@@ -45,6 +45,18 @@ export function RagStudyPanel() {
4545 const [studyUnavailable, setStudyUnavailable] = createSignal(false);
4646 const [renaming, setRenaming] = createSignal<RagThread | null>(null);
4747 const [removing, setRemoving] = createSignal<RagThread | null>(null);
48+ // Below lg the history is a drawer from the left edge, the way a chat app
49+ // on a phone keeps its conversations one tap away without spending the
50+ // screen on them. From lg it is the fixed column beside the transcript.
51+ const [historyOpen, setHistoryOpen] = createSignal(false);
52+ createEffect(() => {
53+ if (!historyOpen()) return;
54+ const onKey = (event: KeyboardEvent) => {
55+ if (event.key === "Escape") setHistoryOpen(false);
56+ };
57+ window.addEventListener("keydown", onKey);
58+ onCleanup(() => window.removeEventListener("keydown", onKey));
59+ });
4860
4961 let pollTimer: number | undefined;
5062 let stream: EventSource | undefined;
@@ -223,21 +235,65 @@ export function RagStudyPanel() {
223235 };
224236
225237 return (
226- <div class="grid min-h-[calc(100dvh-10rem)] gap-4 lg:h-[calc(100dvh-10rem)] lg:grid-cols-[18rem_minmax(0,1fr)]">
227- <aside class="flex h-full min-h-0 flex-col gap-3 rounded-xl border border-border-line bg-surface-base p-3 shadow-xs">
238+ // Phones: one screen-tall column — top bar, transcript, composer — so the
239+ // composer sits above the tab bar instead of scrolling away with the page.
240+ <div class="grid h-[calc(var(--app-viewport)-5.5rem-max(env(safe-area-inset-bottom),var(--android-nav-inset,0px)))] gap-4 max-lg:-mt-2 lg:h-[calc(100dvh-10rem)] lg:grid-cols-[18rem_minmax(0,1fr)]">
241+ <button
242+ type="button"
243+ tabIndex={-1}
244+ aria-hidden="true"
245+ class={cn(
246+ "fixed inset-0 z-[55] bg-black/45 transition-opacity duration-300 lg:hidden",
247+ historyOpen() ? "opacity-100" : "pointer-events-none opacity-0",
248+ )}
249+ onClick={() => setHistoryOpen(false)}
250+ />
251+ <aside
252+ aria-label={copy().history}
253+ class={cn(
254+ "flex min-h-0 flex-col gap-3 bg-surface-base",
255+ // Phone drawer. `visibility` rides the transition so the panel
256+ // slides out before it leaves the tab order.
257+ "fixed inset-y-0 left-0 z-[60] w-[min(20rem,85vw)] border-r border-border-line px-3 pb-[calc(max(env(safe-area-inset-bottom),var(--android-nav-inset,0px))+0.75rem)] pt-[calc(env(safe-area-inset-top)+0.75rem)] shadow-xl transition-[transform,visibility] duration-300 ease-out",
258+ historyOpen() ? "visible translate-x-0" : "invisible -translate-x-full",
259+ "lg:visible lg:static lg:z-auto lg:h-full lg:w-auto lg:translate-x-0 lg:rounded-xl lg:border lg:p-3 lg:shadow-xs lg:transition-none",
260+ )}
261+ >
228262 <div class="flex items-center justify-between gap-2">
229263 <h2 class="text-sm font-semibold text-text-strong">{copy().history}</h2>
230- <Button type="button" size="sm" class="h-8 rounded-lg" disabled={!threadId() && messages().length === 0} onClick={newThread}>
231- <IconPlus class="h-4 w-4" />
232- {copy().newThread}
233- </Button>
264+ <div class="flex items-center gap-1">
265+ <Button
266+ type="button"
267+ size="sm"
268+ class="h-8 rounded-lg max-lg:h-10"
269+ disabled={!threadId() && messages().length === 0}
270+ onClick={() => {
271+ setHistoryOpen(false);
272+ newThread();
273+ }}
274+ >
275+ <IconPlus class="h-4 w-4" />
276+ {copy().newThread}
277+ </Button>
278+ <button
279+ type="button"
280+ class="inline-flex h-10 w-10 items-center justify-center rounded-lg text-muted-foreground outline-hidden transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring lg:hidden"
281+ aria-label={copy().closeHistory}
282+ onClick={() => setHistoryOpen(false)}
283+ >
284+ <IconX class="h-5 w-5" />
285+ </button>
286+ </div>
234287 </div>
235288 <RagThreadList
236289 activeId={threadId()}
237290 version={threadsVersion()}
238291 locale={locale()}
239292 labels={copy()}
240- onOpen={(thread) => void openThread(thread)}
293+ onOpen={(thread) => {
294+ setHistoryOpen(false);
295+ void openThread(thread);
296+ }}
241297 onRename={setRenaming}
242298 onRemove={setRemoving}
243299 />
@@ -247,6 +303,31 @@ export function RagStudyPanel() {
247303 chat does. The conversation's own actions live on its row in the
248304 sidebar, which is where they were already duplicated. */}
249305 <section class="flex h-full min-h-0 flex-col" aria-label={copy().title}>
306+ {/* Phone top bar: the drawer on the left, the open chat's name in the
307+ middle, a fresh chat on the right. */}
308+ <div class="flex shrink-0 items-center gap-2 border-b border-border-hairline pb-2 lg:hidden">
309+ <button
310+ type="button"
311+ class="inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-foreground outline-hidden transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring"
312+ aria-label={copy().openHistory}
313+ aria-expanded={historyOpen()}
314+ onClick={() => setHistoryOpen(true)}
315+ >
316+ <IconMenu class="h-5 w-5" />
317+ </button>
318+ <h1 class="min-w-0 flex-1 truncate text-center text-sm font-semibold text-text-strong">
319+ {activeThread()?.title || (threadId() ? copy().untitled : copy().title)}
320+ </h1>
321+ <button
322+ type="button"
323+ class="inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-foreground outline-hidden transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40"
324+ aria-label={copy().newThread}
325+ disabled={!threadId() && messages().length === 0}
326+ onClick={newThread}
327+ >
328+ <IconPlus class="h-5 w-5" />
329+ </button>
330+ </div>
250331 <Show when={error()}>
251332 <div class="mx-auto w-full max-w-3xl px-4 pt-1 sm:px-6">
252333 <Alert variant="destructive">{error()}</Alert>
src/components/rag/rag-thread-list.tsxmodified+2 -2
@@ -5,7 +5,7 @@ import type { RagThread } from "@/api/client";
55 import { EmptyInline } from "@/components/ui/empty-inline";
66 import { IconEdit, IconTrash } from "@/components/ui/icons";
77 import { PageSpinner } from "@/components/ui/page-spinner";
8-import { PaginationControls } from "@/components/ui/pagination-controls";
8+import { TablePagination } from "@/components/ui/table-pagination";
99 import { TableRowActions } from "@/components/ui/table-row-actions";
1010 import { cn } from "@/lib/cn";
1111 import { formatDateTime } from "@/lib/format";
@@ -126,7 +126,7 @@ export function RagThreadList(props: {
126126 </div>
127127 <Show when={totalPages() > 1}>
128128 <div class="mt-3 shrink-0">
129- <PaginationControls page={page()} totalPages={totalPages()} onPageChange={setPage} />
129+ <TablePagination pageIndex={page()} pageCount={totalPages()} onPageChange={setPage} />
130130 </div>
131131 </Show>
132132 </div>
src/components/ui/coming-soon.tsxmodified+3 -1
@@ -6,7 +6,9 @@ import { useT } from "@/stores/preferences-context";
66 export function ComingSoonBadge(props: { class?: string }) {
77 const t = useT();
88 return (
9- <Badge variant="secondary" class={cn("bg-surface-tint text-text-subtle", props.class)}>
9+ // `data-coming-soon` lets a toolbar find the control carrying it — phones
10+ // drop a button that can only say "not yet" (see DataTable's toolbar).
11+ <Badge variant="secondary" data-coming-soon class={cn("bg-surface-tint text-text-subtle", props.class)}>
1012 {t("comingSoon.title")}
1113 </Badge>
1214 );
src/components/ui/data-table-search.tsxmodified+3 -1
@@ -49,7 +49,9 @@ export function DataTableSearch(props: DataTableSearchProps) {
4949 }}
5050 placeholder={props.placeholder ?? t("common.search")}
5151 aria-describedby={props.hint ? hintId : undefined}
52- class={cn("h-8 rounded-lg bg-muted/40 text-[13px] md:text-[13px]", props.value ? "pl-9 pr-8" : "pl-9")}
52+ // Phones get a touch-sized box at 16px: below that iOS Safari zooms
53+ // the page into a focused field. Compact from `sm` up.
54+ class={cn("h-10 rounded-lg bg-muted/40 text-base sm:h-8 sm:text-[13px] md:text-[13px]", props.value ? "pl-9 pr-8" : "pl-9")}
5355 />
5456 <Show when={props.value}>
5557 <button
src/components/ui/data-table.test.tsxmodified+27 -4
@@ -92,16 +92,39 @@ test("paginates tables by default", () => {
9292 expect(screen.getByText("Person 11")).toBeTruthy();
9393 });
9494
95-test("shows the pagination footer on a single page", () => {
95+test("halves the page on a phone", () => {
96+ vi.stubGlobal("matchMedia", (query: string) => ({
97+ matches: true,
98+ media: query,
99+ addEventListener: () => undefined,
100+ removeEventListener: () => undefined,
101+ }));
102+ const rows = Array.from({ length: 11 }, (_, index) => ({ name: `Person ${index + 1}` }));
103+ try {
104+ render(() => (
105+ <PreferencesProvider>
106+ <DataTable columns={[columns[0]]} data={rows} enableColumnVisibility={false} />
107+ </PreferencesProvider>
108+ ));
109+
110+ expect(screen.getByText("Person 5")).toBeTruthy();
111+ expect(screen.queryByText("Person 6")).toBeNull();
112+ expect(screen.getByText("1 / 3")).toBeTruthy();
113+ } finally {
114+ vi.unstubAllGlobals();
115+ }
116+});
117+
118+test("a single page keeps the row count but drops the page buttons", () => {
96119 render(() => (
97120 <PreferencesProvider>
98121 <DataTable columns={[columns[0]]} data={[{ name: "Ada" }]} enableColumnVisibility={false} />
99122 </PreferencesProvider>
100123 ));
101124
102- expect(screen.getByText("1 / 1")).toBeTruthy();
103- expect((screen.getByRole("button", { name: "Previous" }) as HTMLButtonElement).disabled).toBe(true);
104- expect((screen.getByRole("button", { name: "Next" }) as HTMLButtonElement).disabled).toBe(true);
125+ expect(screen.getByText("1-1 / 1")).toBeTruthy();
126+ expect(screen.queryByRole("button", { name: "Previous" })).toBeNull();
127+ expect(screen.queryByRole("button", { name: "Next" })).toBeNull();
105128 });
106129
107130 test("a display column renders its own cell instead of the empty dash", () => {
src/components/ui/data-table.tsxmodified+57 -42
@@ -1,4 +1,4 @@
1-import { For, Show, createEffect, createSignal, onCleanup } from "solid-js";
1+import { For, Show, createEffect, createSignal, on, onCleanup } from "solid-js";
22 import type { JSX, ParentProps } from "solid-js";
33 import {
44 type Column,
@@ -23,6 +23,7 @@ import { TablePagination } from "@/components/ui/table-pagination";
2323 import { IconArrowDown, IconArrowUp, IconChevronsUpDown } from "@/components/ui/icons";
2424 import { cn } from "@/lib/cn";
2525 import { createMediaQuery } from "@/lib/create-media-query";
26+import { COMPACT_SCREEN_QUERY, createResponsivePageSize } from "@/lib/create-page-size";
2627 import { createTablePreferences } from "@/lib/table-preferences";
2728 import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
2829 import { useT } from "@/stores/preferences-context";
@@ -64,6 +65,7 @@ export type DataTableProps<TData, TValue = unknown> = {
6465 actions?: JSX.Element;
6566 manualPagination?: {
6667 pageIndex: number;
68+ /** The size the caller actually fetched — pass a `createResponsivePageSize` accessor's value. */
6769 pageSize: number;
6870 total: number;
6971 onPageChange: (pageIndex: number) => void;
@@ -76,6 +78,7 @@ export type DataTableProps<TData, TValue = unknown> = {
7678 mobileLayout?: "cards" | "scroll";
7779 onRowClick?: (row: TData) => void;
7880 onSearchInput?: (value: string) => void;
81+ /** Rows per page on a wide screen; phones get `compactPageSize` of it. */
7982 pageSize?: number;
8083 searchPredicate?: (row: TData, query: string) => boolean;
8184 searchValue?: string;
@@ -99,10 +102,12 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData,
99102 const prefs = createTablePreferences(props.storageKey);
100103 const [sorting, setSorting] = createSignal<SortingState>([]);
101104 const [columnFilters, setColumnFilters] = createSignal<ColumnFiltersState>([]);
102- const [pagination, setPagination] = createSignal<PaginationState>({
103- pageIndex: 0,
104- pageSize: props.pageSize ?? 10,
105- });
105+ const clientPageSize = createResponsivePageSize(props.pageSize ?? 10);
106+ const [clientPageIndex, setClientPageIndex] = createSignal(0);
107+ const pagination = (): PaginationState => ({ pageIndex: clientPageIndex(), pageSize: clientPageSize() });
108+ // A page index means nothing once the page size changes under it (a phone
109+ // rotated, a window narrowed): start over rather than land mid-list.
110+ createEffect(on(clientPageSize, () => setClientPageIndex(0), { defer: true }));
106111 const [search, setSearch] = createSignal("");
107112 const searchValue = () => props.searchValue ?? search();
108113 // Sorting is client-side only, and the backend takes no sort parameter: on
@@ -135,7 +140,7 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData,
135140 onColumnFiltersChange: setColumnFilters,
136141 onColumnVisibilityChange: (updater) =>
137142 prefs.setVisibility(resolveUpdater(updater, prefs.preferences().visibility)),
138- onPaginationChange: setPagination,
143+ onPaginationChange: (updater) => setClientPageIndex(resolveUpdater(updater, pagination()).pageIndex),
139144 state: {
140145 get sorting() {
141146 return sorting();
@@ -206,7 +211,11 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData,
206211 const share = column.getSize() / total;
207212 return `calc(${share * 100}% - ${share * actionColumnsWidth()}px)`;
208213 };
209- const showColumnMenu = () => (props.enableColumnVisibility ?? true) && hideableColumns().length > 0;
214+ const compactScreen = createMediaQuery(COMPACT_SCREEN_QUERY);
215+ const useCards = () => (props.mobileLayout ?? "cards") === "cards" && compactScreen();
216+ // Cards print every visible column as a label/value pair, so a column picker
217+ // there only hides lines; on phones it is one more control for nothing.
218+ const showColumnMenu = () => (props.enableColumnVisibility ?? true) && hideableColumns().length > 0 && !useCards();
210219 const showSearch = () => props.searchPredicate != null || props.filterColumn != null || props.onSearchInput != null;
211220 const sectioned = () => props.surfaceSections !== false;
212221 const showHeader = () => false;
@@ -255,8 +264,6 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData,
255264 </div>
256265 </Show>
257266 );
258- const compactScreen = createMediaQuery("(max-width: 639px)");
259- const useCards = () => (props.mobileLayout ?? "cards") === "cards" && compactScreen();
260267 const headerLabel = (columnId: string) => {
261268 const header = table.getFlatHeaders().find((candidate) => candidate.column.id === columnId);
262269 return header ? flexRender(header.column.columnDef.header, header.getContext()) : columnId;
@@ -311,28 +318,36 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData,
311318 </div>
312319 </Show>
313320 <Show when={showToolbar()}>
314- <div class={cn("flex flex-col gap-2 lg:flex-row lg:items-center lg:justify-between", sectioned() && "rounded-xl border border-border-line bg-surface-base p-3 shadow-xs")}>
315- <div class="flex flex-1 flex-wrap items-center gap-2">
316- <Show when={showSearch()}>
317- <DataTableSearch
318- value={searchFieldValue()}
319- onChange={handleSearch}
320- placeholder={props.filterPlaceholder ?? t("common.searchPlaceholder")}
321- hint={props.filterHint}
322- />
323- </Show>
324- <Show when={props.filters}>
325- <div class="flex flex-wrap items-center gap-2 [&_button]:h-8 [&_button]:rounded-lg [&_button]:text-[13px] [&_select]:h-8 [&_select]:rounded-lg [&_select]:text-[13px]">{props.filters}</div>
326- </Show>
327- </div>
328- <div class="flex shrink-0 flex-wrap items-center justify-end gap-2">
329- <Show when={props.actions}>
330- <div class="flex min-w-0 flex-wrap items-center gap-2 [&_button]:rounded-md">{props.actions}</div>
331- </Show>
332- <Show when={showColumnMenu()}>
333- <DataTableViewMenu columns={viewMenuColumns()} />
334- </Show>
335- </div>
321+ {/* One wrapping row, ordered by width. Phones: search and actions share
322+ the first line, filters get a line of their own that scrolls
323+ sideways instead of stacking one control per line. From `lg`:
324+ search, filters, then actions pushed to the right edge. Controls
325+ are touch-sized (h-10) below `sm` and compact (h-8) above it. */}
326+ <div class={cn("flex flex-wrap items-center gap-2", sectioned() && "rounded-xl border border-border-line bg-surface-base p-3 shadow-xs")}>
327+ <Show when={showSearch()}>
328+ <DataTableSearch
329+ class="order-1 w-auto min-w-40 flex-1 sm:max-w-xs"
330+ value={searchFieldValue()}
331+ onChange={handleSearch}
332+ placeholder={props.filterPlaceholder ?? t("common.searchPlaceholder")}
333+ hint={props.filterHint}
334+ />
335+ </Show>
336+ <Show when={props.filters}>
337+ <div class="order-3 -my-1 flex w-full items-center gap-2 overflow-x-auto py-1 [scrollbar-width:none] sm:my-0 sm:py-0 sm:flex-wrap sm:overflow-visible lg:order-2 lg:w-auto [&_button]:h-10 [&_button]:shrink-0 [&_button]:rounded-lg [&_button]:text-[13px] sm:[&_button]:h-8 [&_select]:h-10 [&_select]:rounded-lg [&_select]:text-[13px] sm:[&_select]:h-8 max-sm:[&>*]:flex-nowrap max-sm:[&>*]:shrink-0">{props.filters}</div>
338+ </Show>
339+ <Show when={props.actions || showColumnMenu()}>
340+ <div class="order-2 ml-auto flex shrink-0 flex-wrap items-center justify-end gap-2 lg:order-3">
341+ <Show when={props.actions}>
342+ {/* A "yakında" button does nothing yet; on a phone it only
343+ pushes the working action off the search row. */}
344+ <div class="flex min-w-0 flex-wrap items-center gap-2 [&_button]:rounded-md max-sm:[&_button]:h-10 max-sm:[&_button:has([data-coming-soon])]:hidden">{props.actions}</div>
345+ </Show>
346+ <Show when={showColumnMenu()}>
347+ <DataTableViewMenu columns={viewMenuColumns()} />
348+ </Show>
349+ </div>
350+ </Show>
336351 </div>
337352 </Show>
338353 <Show when={useCards()}>
@@ -347,6 +362,11 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData,
347362 row.getVisibleCells().filter((cell) => cell.column.id !== "select" && !cell.column.columnDef.meta?.hideInCards);
348363 const action = () => cells().find((cell) => cell.column.id === "actions");
349364 const body = () => cells().filter((cell) => cell.column.id !== "actions");
365+ // A "-" line only makes a phone card taller: leave out fields
366+ // with no value. Display columns draw themselves from
367+ // row.original, so they have no value to test and always stay.
368+ const details = () =>
369+ body().slice(1).filter((cell) => cell.column.accessorFn == null || (cell.getValue() != null && cell.getValue() !== ""));
350370 return (
351371 <li>
352372 <div
@@ -370,22 +390,17 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData,
370390 <div class="min-w-0 flex-1 font-medium">
371391 <Show when={body()[0]}>{(first) => flexRender(first().column.columnDef.cell, first().getContext())}</Show>
372392 </div>
373- <Show when={action()}>{(cell) => <div class="-my-1 shrink-0">{flexRender(cell().column.columnDef.cell, cell().getContext())}</div>}</Show>
393+ {/* The row menu shrinks to its ⋮ glyph here — the word
394+ beside it cost the title a third of the card width. */}
395+ <Show when={action()}>{(cell) => <div class="-my-1 shrink-0 [&_[data-row-actions-label]]:hidden [&_[data-row-actions-trigger]]:h-10 [&_[data-row-actions-trigger]]:w-10 [&_[data-row-actions-trigger]]:min-w-0 [&_[data-row-actions-trigger]]:px-0">{flexRender(cell().column.columnDef.cell, cell().getContext())}</div>}</Show>
374396 </div>
375- <Show when={body().length > 1}>
397+ <Show when={details().length > 0}>
376398 <dl class="mt-2 grid grid-cols-[minmax(6rem,auto)_minmax(0,1fr)] gap-x-3 gap-y-1.5">
377- <For each={body().slice(1)}>
399+ <For each={details()}>
378400 {(cell) => (
379401 <>
380402 <dt class="truncate text-xs text-muted-foreground">{headerLabel(cell.column.id)}</dt>
381- <dd class="min-w-0 break-words text-foreground">
382- <Show
383- when={cell.column.accessorFn == null || (cell.getValue() != null && cell.getValue() !== "")}
384- fallback={<span class="text-muted-foreground/60">-</span>}
385- >
386- {flexRender(cell.column.columnDef.cell, cell.getContext())}
387- </Show>
388- </dd>
403+ <dd class="min-w-0 break-words text-foreground">{flexRender(cell.column.columnDef.cell, cell.getContext())}</dd>
389404 </>
390405 )}
391406 </For>
src/components/ui/data-toolbar.tsxmodified+20 -14
@@ -11,26 +11,32 @@ export function DataToolbar(props: {
1111 onSearchInput?: (value: string) => void;
1212 filters?: JSX.Element;
1313 actions?: JSX.Element;
14+ /** Let the search box grow into the free width instead of stopping at `max-w-72`. */
1415 inline?: boolean;
1516 class?: string;
1617 }) {
1718 const hasSearch = () => props.searchValue !== undefined || props.searchPlaceholder !== undefined || props.onSearchInput !== undefined;
1819 return (
19- <div class={cn("flex gap-3", props.inline ? "flex-row items-center" : "flex-col sm:flex-row sm:items-center sm:justify-between", props.class)}>
20- <div class={cn("flex min-w-0 flex-1 gap-2", props.inline ? "flex-row flex-nowrap items-center" : "flex-col sm:flex-row sm:flex-wrap sm:items-center")}>
21- <Show when={hasSearch()}>
22- <DataTableSearch
23- class={cn("sm:max-w-72", props.inline && "min-w-0 flex-1")}
24- value={props.searchValue ?? ""}
25- placeholder={props.searchPlaceholder}
26- hint={props.searchHint}
27- onChange={(value) => props.onSearchInput?.(value)}
28- />
29- </Show>
30- {props.filters}
31- </div>
20+ // One wrapping row, ordered by width — the same shape as DataTable's
21+ // toolbar. Phones: search and actions share the first line and the
22+ // filters take the next one; nothing is squeezed into a fixed row, where
23+ // the search box shrank to a sliver and a filter painted over its icon.
24+ // From `sm`: search, filters, then actions pushed to the right edge.
25+ <div class={cn("flex flex-wrap items-center gap-2 sm:gap-3", props.class)}>
26+ <Show when={hasSearch()}>
27+ <DataTableSearch
28+ class={cn("order-1 w-auto min-w-40 flex-1", !props.inline && "sm:max-w-72")}
29+ value={props.searchValue ?? ""}
30+ placeholder={props.searchPlaceholder}
31+ hint={props.searchHint}
32+ onChange={(value) => props.onSearchInput?.(value)}
33+ />
34+ </Show>
35+ <Show when={props.filters}>
36+ <div class="order-3 flex w-full flex-wrap items-center gap-2 sm:order-2 sm:w-auto">{props.filters}</div>
37+ </Show>
3238 <Show when={props.actions}>
33- <div class="flex shrink-0 items-center gap-2 sm:justify-end">{props.actions}</div>
39+ <div class="order-2 ml-auto flex shrink-0 items-center gap-2 sm:order-3 max-sm:[&_button]:h-10 max-sm:[&_button:has([data-coming-soon])]:hidden">{props.actions}</div>
3440 </Show>
3541 </div>
3642 );
src/components/ui/pagination-controls.tsxdeleted+0 -40
@@ -1,40 +0,0 @@
1-import { Button } from "@/components/ui/button";
2-import { IconChevronLeft, IconChevronRight } from "@/components/ui/icons";
3-import { useT } from "@/stores/preferences-context";
4-
5-export function PaginationControls(props: {
6- page: number;
7- totalPages: number;
8- onPageChange: (page: number) => void;
9-}) {
10- const t = useT();
11- return (
12- <div class="flex items-center justify-between gap-2 border-t border-border/60 pt-3">
13- <Button
14- type="button"
15- variant="outline"
16- size="sm"
17- class="h-8 gap-1 px-3"
18- disabled={props.page <= 0}
19- onClick={() => props.onPageChange(Math.max(0, props.page - 1))}
20- >
21- <IconChevronLeft class="h-3.5 w-3.5" />
22- {t("common.prev")}
23- </Button>
24- <span class="text-xs tabular-nums text-muted-foreground">
25- {t("common.pageOf", { page: props.page + 1, total: props.totalPages })}
26- </span>
27- <Button
28- type="button"
29- variant="outline"
30- size="sm"
31- class="h-8 gap-1 px-3"
32- disabled={props.page >= props.totalPages - 1}
33- onClick={() => props.onPageChange(Math.min(props.totalPages - 1, props.page + 1))}
34- >
35- {t("common.next")}
36- <IconChevronRight class="h-3.5 w-3.5" />
37- </Button>
38- </div>
39- );
40-}
src/components/ui/table-pagination.tsxmodified+58 -35
@@ -1,55 +1,78 @@
1+import { Show } from "solid-js";
12 import { Button } from "@/components/ui/button";
23 import { IconChevronLeft, IconChevronRight } from "@/components/ui/icons";
4+import { cn } from "@/lib/cn";
35 import { useT } from "@/stores/preferences-context";
46
57 export type TablePaginationProps = {
68 /** Zero-based current page index. */
79 pageIndex: number;
810 pageCount: number;
9- pageSize: number;
11+ /** With `total`, prints "a-b / total"; without either only the page counter shows. */
12+ pageSize?: number;
1013 /** Total row count (across all pages). */
11- total: number;
14+ total?: number;
1215 onPageChange: (pageIndex: number) => void;
16+ class?: string;
1317 };
1418
15-/** Footer: "X kayıttan a-b arası" + prev/next + "page / total". */
19+/**
20+ * Footer: "a-b / total" + prev / "page / count" / next, on one row at every
21+ * width. The buttons are full touch targets on phones and compact from `sm`
22+ * up. A single page keeps the row count but drops the buttons — two disabled
23+ * arrows around "1 / 1" only take room.
24+ */
1625 export function TablePagination(props: TablePaginationProps) {
1726 const t = useT();
18- const start = () => (props.total === 0 ? 0 : props.pageIndex * props.pageSize + 1);
19- const end = () => Math.min((props.pageIndex + 1) * props.pageSize, props.total);
27+ const hasRange = () => props.total != null && props.pageSize != null;
28+ const start = () => (!props.total || !props.pageSize ? 0 : props.pageIndex * props.pageSize + 1);
29+ const end = () => Math.min((props.pageIndex + 1) * (props.pageSize ?? 0), props.total ?? 0);
30+ const navButton = "h-10 w-10 gap-1 px-0 text-xs sm:h-7 sm:w-auto sm:px-1.5 sm:text-[11px]";
2031
2132 return (
22- <div class="flex w-full flex-col gap-2 rounded-lg border border-border-line bg-surface-overlay px-2.5 py-1.5 sm:flex-row sm:items-center sm:justify-between">
23- <span class="text-[11px] font-medium tabular-nums text-muted-foreground">
24- {t("common.pageRange", { start: start(), end: end(), total: props.total })}
33+ // Nothing to count and nowhere to go: an empty frame would only take room.
34+ <Show when={hasRange() || props.pageCount > 1}>
35+ <div
36+ class={cn(
37+ "flex w-full items-center justify-between gap-2 rounded-lg border border-border-line bg-surface-overlay px-2.5 py-1.5",
38+ props.class,
39+ )}
40+ >
41+ <span class="text-xs font-medium tabular-nums text-muted-foreground sm:text-[11px]">
42+ <Show when={hasRange()}>{t("common.pageRange", { start: start(), end: end(), total: props.total ?? 0 })}</Show>
2543 </span>
26- <div class="flex items-center justify-end gap-1">
27- <Button
28- type="button"
29- variant="outline"
30- size="sm"
31- class="h-7 gap-1 px-1.5 text-[11px]"
32- disabled={props.pageIndex <= 0}
33- onClick={() => props.onPageChange(Math.max(0, props.pageIndex - 1))}
34- >
35- <IconChevronLeft class="h-3 w-3" />
36- <span class="hidden sm:inline">{t("common.prev")}</span>
37- </Button>
38- <span class="min-w-12 rounded-md border border-border-line bg-surface-base px-1.5 py-0.5 text-center text-[11px] font-semibold tabular-nums text-foreground">
39- {t("common.pageOf", { page: props.pageIndex + 1, total: props.pageCount })}
40- </span>
41- <Button
42- type="button"
43- variant="outline"
44- size="sm"
45- class="h-7 gap-1 px-1.5 text-[11px]"
46- disabled={props.pageIndex >= props.pageCount - 1}
47- onClick={() => props.onPageChange(Math.min(props.pageCount - 1, props.pageIndex + 1))}
48- >
49- <span class="hidden sm:inline">{t("common.next")}</span>
50- <IconChevronRight class="h-3 w-3" />
51- </Button>
52- </div>
44+ <Show when={props.pageCount > 1}>
45+ <nav class="flex items-center gap-1" aria-label={t("common.pagination")}>
46+ <Button
47+ type="button"
48+ variant="outline"
49+ size="sm"
50+ class={navButton}
51+ aria-label={t("common.prev")}
52+ disabled={props.pageIndex <= 0}
53+ onClick={() => props.onPageChange(Math.max(0, props.pageIndex - 1))}
54+ >
55+ <IconChevronLeft class="h-4 w-4 sm:h-3 sm:w-3" />
56+ <span class="hidden sm:inline">{t("common.prev")}</span>
57+ </Button>
58+ <span class="min-w-14 rounded-md border border-border-line bg-surface-base px-1.5 py-1 text-center text-xs font-semibold tabular-nums text-foreground sm:min-w-12 sm:py-0.5 sm:text-[11px]">
59+ {t("common.pageOf", { page: props.pageIndex + 1, total: props.pageCount })}
60+ </span>
61+ <Button
62+ type="button"
63+ variant="outline"
64+ size="sm"
65+ class={navButton}
66+ aria-label={t("common.next")}
67+ disabled={props.pageIndex >= props.pageCount - 1}
68+ onClick={() => props.onPageChange(Math.min(props.pageCount - 1, props.pageIndex + 1))}
69+ >
70+ <span class="hidden sm:inline">{t("common.next")}</span>
71+ <IconChevronRight class="h-4 w-4 sm:h-3 sm:w-3" />
72+ </Button>
73+ </nav>
74+ </Show>
5375 </div>
76+ </Show>
5477 );
5578 }
src/components/ui/table-row-actions.tsxmodified+3 -1
@@ -34,10 +34,11 @@ export function TableRowActions(props: { label: string; actions: TableRowAction[
3434 class={props.compact
3535 ? "inline-flex h-7 w-7 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted-foreground outline-hidden transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-expanded:bg-muted data-expanded:text-foreground"
3636 : "inline-flex h-8 min-w-[78px] cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-border/80 bg-muted/45 px-2 text-xs font-semibold text-foreground outline-hidden transition-colors hover:border-primary/30 hover:bg-primary/8 hover:text-primary-text focus-visible:ring-2 focus-visible:ring-ring data-expanded:border-primary/30 data-expanded:bg-primary/10 data-expanded:text-primary-text"}
37+ data-row-actions-trigger
3738 aria-label={props.label}
3839 title={props.label}
3940 >
40- {!props.compact && <span>{props.triggerLabel ?? t("common.action")}</span>}
41+ {!props.compact && <span data-row-actions-label>{props.triggerLabel ?? t("common.action")}</span>}
4142 <IconDotsVertical class="h-3.5 w-3.5" />
4243 </DropdownMenuTrigger>
4344 <DropdownMenuContent class="w-48">
@@ -64,6 +65,7 @@ export function TableRowActions(props: { label: string; actions: TableRowAction[
6465 {(action) => (
6566 <button
6667 type="button"
68+ data-row-actions-trigger
6769 class="inline-flex h-8 w-8 items-center justify-center rounded-lg border border-transparent text-muted-foreground outline-hidden transition-colors hover:border-primary/20 hover:bg-primary/8 hover:text-primary-text focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"
6870 aria-label={action().label}
6971 title={action().label}
src/components/users/profile-memberships.tsxmodified+7 -7
@@ -4,7 +4,7 @@ import type { ClassGroup, ProfileClassRef, ProfileCourseRef } from "@/api/client
44 import { courseKindLabel } from "@/lib/course-kind";
55 import { Badge } from "@/components/ui/badge";
66 import { IconBook, IconSchool } from "@/components/ui/icons";
7-import { PaginationControls } from "@/components/ui/pagination-controls";
7+import { TablePagination } from "@/components/ui/table-pagination";
88 import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
99 import { cn } from "@/lib/cn";
1010 import { personLabel } from "@/lib/person";
@@ -91,9 +91,9 @@ export function ProfileMemberships(props: {
9191 </ul>
9292 <Show when={pageCount(props.classes.length) > 1}>
9393 <div class="mt-3">
94- <PaginationControls
95- page={classPage()}
96- totalPages={pageCount(props.classes.length)}
94+ <TablePagination
95+ pageIndex={classPage()}
96+ pageCount={pageCount(props.classes.length)}
9797 onPageChange={setClassPage}
9898 />
9999 </div>
@@ -132,9 +132,9 @@ export function ProfileMemberships(props: {
132132 </ul>
133133 <Show when={pageCount(props.courses.length) > 1}>
134134 <div class="mt-3">
135- <PaginationControls
136- page={coursePage()}
137- totalPages={pageCount(props.courses.length)}
135+ <TablePagination
136+ pageIndex={coursePage()}
137+ pageCount={pageCount(props.courses.length)}
138138 onPageChange={setCoursePage}
139139 />
140140 </div>
src/i18n/locales/en.tsmodified+2 -2
@@ -91,7 +91,6 @@ export const en: Dict = {
9191 "classGroups.selectTeacher": "Select a teacher",
9292 "classGroups.yourClass": "Class",
9393 "classGroups.searchPlaceholder": "Search by class, grade or homeroom teacher…",
94- "classGroups.allGrades": "All grades",
9594 "classGroups.studentsCount": "{count} students",
9695 "classGroups.noGrade": "No grade",
9796 "classGroups.attendanceRate": "Attendance",
@@ -485,7 +484,6 @@ export const en: Dict = {
485484 "roster.studentClass": "Class",
486485 "roster.teacher": "Teacher",
487486 "roster.class": "Class",
488- "roster.classAll": "Class: All",
489487 "roster.term": "Term",
490488 "roster.termAll": "Term: All",
491489 "roster.mastery": "Topic mastery",
@@ -658,6 +656,7 @@ export const en: Dict = {
658656 "common.prev": "Previous",
659657 "common.next": "Next",
660658 "common.pageOf": "{page} / {total}",
659+ "common.pagination": "Pagination",
661660 "common.noResults": "No results.",
662661 "common.scrollHint": "Scroll horizontally",
663662 "common.noMatches": "Nothing matches your search.",
@@ -710,6 +709,7 @@ export const en: Dict = {
710709 "aiStudio.run.ended": "Ended",
711710 "aiStudio.run.length": "Length",
712711 "aiStudio.library.title": "Your generated library",
712+ "aiStudio.backToLibrary": "Back to library",
713713 "aiStudio.library.description": "Every summary and podcast you produced, newest first.",
714714 "aiStudio.library.count": "{count} outputs",
715715 "aiStudio.library.empty": "Your generated content will appear here",
src/i18n/locales/tr.tsmodified+2 -2
@@ -87,7 +87,6 @@ export const tr: Dict = {
8787 "classGroups.selectTeacher": "Bir öğretmen seç",
8888 "classGroups.yourClass": "Şube",
8989 "classGroups.searchPlaceholder": "Şube, sınıf veya danışman ara…",
90- "classGroups.allGrades": "Tüm sınıflar",
9190 "classGroups.studentsCount": "{count} öğrenci",
9291 "classGroups.noGrade": "Sınıf yok",
9392 "classGroups.attendanceRate": "Devam",
@@ -481,7 +480,6 @@ export const tr: Dict = {
481480 "roster.studentClass": "Sınıfı",
482481 "roster.teacher": "Öğretmen",
483482 "roster.class": "Sınıf",
484- "roster.classAll": "Sınıf: Tümü",
485483 "roster.term": "Dönem",
486484 "roster.termAll": "Dönem: Tümü",
487485 "roster.mastery": "Konu yetkinliği",
@@ -654,6 +652,7 @@ export const tr: Dict = {
654652 "common.prev": "Önceki",
655653 "common.next": "Sonraki",
656654 "common.pageOf": "{page} / {total}",
655+ "common.pagination": "Sayfalar",
657656 "common.noResults": "Sonuç yok.",
658657 "common.scrollHint": "Yatay kaydır",
659658 "common.noMatches": "Aramanızla eşleşen kayıt yok.",
@@ -706,6 +705,7 @@ export const tr: Dict = {
706705 "aiStudio.run.ended": "Bitti",
707706 "aiStudio.run.length": "Uzunluk",
708707 "aiStudio.library.title": "Üretim kitaplığın",
708+ "aiStudio.backToLibrary": "Kitaplığa dön",
709709 "aiStudio.library.description": "Ürettiğin her özet ve podcast, en yenisi üstte.",
710710 "aiStudio.library.count": "{count} çıktı",
711711 "aiStudio.library.empty": "Ürettiğin içerikler burada görünecek",
src/i18n/messages.tsmodified+2 -2
@@ -80,7 +80,6 @@ export type MessageKey =
8080 | "classGroups.selectTeacher"
8181 | "classGroups.yourClass"
8282 | "classGroups.searchPlaceholder"
83- | "classGroups.allGrades"
8483 | "classGroups.studentsCount"
8584 | "classGroups.noGrade"
8685 | "classGroups.attendanceRate"
@@ -450,7 +449,6 @@ export type MessageKey =
450449 | "roster.studentClass"
451450 | "roster.teacher"
452451 | "roster.class"
453- | "roster.classAll"
454452 | "roster.term"
455453 | "roster.termAll"
456454 | "roster.mastery"
@@ -642,6 +640,7 @@ export type MessageKey =
642640 | "common.prev"
643641 | "common.next"
644642 | "common.pageOf"
643+ | "common.pagination"
645644 | "common.noResults"
646645 | "common.scrollHint"
647646 | "common.noMatches"
@@ -694,6 +693,7 @@ export type MessageKey =
694693 | "aiStudio.run.ended"
695694 | "aiStudio.run.length"
696695 | "aiStudio.library.title"
696+ | "aiStudio.backToLibrary"
697697 | "aiStudio.library.description"
698698 | "aiStudio.library.count"
699699 | "aiStudio.library.empty"
src/lib/create-page-size.test.tsadded+15 -0
@@ -0,0 +1,15 @@
1+import { compactPageSize } from "@/lib/create-page-size";
2+
3+it("halves a page for phones, never below five", () => {
4+ expect(compactPageSize(10)).toBe(5);
5+ expect(compactPageSize(8)).toBe(5);
6+ expect(compactPageSize(12)).toBe(6);
7+ expect(compactPageSize(15)).toBe(8);
8+ expect(compactPageSize(20)).toBe(10);
9+});
10+
11+it("leaves an already short page alone", () => {
12+ expect(compactPageSize(5)).toBe(5);
13+ expect(compactPageSize(4)).toBe(4);
14+ expect(compactPageSize(1)).toBe(1);
15+});
src/lib/create-page-size.tsadded+25 -0
@@ -0,0 +1,25 @@
1+import { createMediaQuery } from "@/lib/create-media-query";
2+
3+/** Below Tailwind's `sm` breakpoint — the width where tables turn into cards. */
4+export const COMPACT_SCREEN_QUERY = "(max-width: 639px)";
5+
6+/**
7+ * Rows per page on a phone for a list that shows `desktop` rows on a wide
8+ * screen. A table row becomes a four- or five-line card there, so the same
9+ * count is several screens tall: half as many, never fewer than five, and a
10+ * list that is already short keeps its own size.
11+ */
12+export function compactPageSize(desktop: number): number {
13+ return Math.min(desktop, Math.max(5, Math.ceil(desktop / 2)));
14+}
15+
16+/**
17+ * A page size that follows the screen: `desktop` on wide screens,
18+ * `compactPageSize(desktop)` on phones. Callers that page on the server pass
19+ * the accessor into their fetch source, so a rotation refetches the right
20+ * slice; callers keeping a page index should reset it when this changes.
21+ */
22+export function createResponsivePageSize(desktop: number): () => number {
23+ const compact = createMediaQuery(COMPACT_SCREEN_QUERY);
24+ return () => (compact() ? compactPageSize(desktop) : desktop);
25+}
src/pages/classes-page.tsxmodified+2 -2
@@ -232,10 +232,10 @@ function ClassesContent() {
232232 filters={
233233 <Show when={grades().length > 0}>
234234 <DropdownSelect
235- options={[{ value: "all", label: t("classGroups.allGrades") }, ...grades().map((g) => ({ value: g, label: g }))]}
235+ labelPrefix={t("classGroups.grade")}
236+ options={[{ value: "all", label: t("common.all") }, ...grades().map((g) => ({ value: g, label: g }))]}
236237 value={gradeFilter()}
237238 onChange={setGradeFilter}
238- class="min-w-44"
239239 />
240240 </Show>
241241 }
src/pages/courses-page.tsxmodified+7 -5
@@ -1,4 +1,5 @@
11 import { For, Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
2+import { createResponsivePageSize } from "@/lib/create-page-size";
23 import { createResource } from "@/lib/create-resource";
34 import { useNavigate, useSearch } from "@tanstack/solid-router";
45 import { getCourses, postCourse } from "@/api/courses";
@@ -16,7 +17,7 @@ import { IconPlus } from "@/components/ui/icons";
1617 import { Input } from "@/components/ui/input";
1718 import { Label } from "@/components/ui/label";
1819 import { PageSpinner } from "@/components/ui/page-spinner";
19-import { PaginationControls } from "@/components/ui/pagination-controls";
20+import { TablePagination } from "@/components/ui/table-pagination";
2021 import { Select } from "@/components/ui/select";
2122 import { courseKindLabel } from "@/lib/course-kind";
2223 import { SidePanel } from "@/components/ui/side-panel";
@@ -56,6 +57,7 @@ function CoursesContent() {
5657 // any şube has.
5758 const [taughtFilter, setTaughtFilter] = createSignal("all");
5859 const [page, setPage] = createSignal(0);
60+ const pageSize = createResponsivePageSize(PAGE_SIZE);
5961 const [search, setSearch] = createSignal("");
6062 const [error, setError] = createSignal("");
6163 const [pending, setPending] = createSignal(false);
@@ -68,7 +70,7 @@ function CoursesContent() {
6870 setPageKind(routeSearch().kind);
6971 });
7072 createEffect(() => {
71- pageKind(); taughtFilter(); search(); setPage(0);
73+ pageKind(); taughtFilter(); search(); pageSize(); setPage(0);
7274 });
7375
7476 const [limits, { refetch: refetchLimits }] = createResource(() => canCreate() ? getLimits() : null);
@@ -87,8 +89,8 @@ function CoursesContent() {
8789 return matchesSearch(query, course.title, course.description, personLabel(course.creator));
8890 });
8991 });
90- const totalPages = createMemo(() => Math.max(1, Math.ceil(filteredCourses().length / PAGE_SIZE)));
91- const visibleCourses = createMemo(() => filteredCourses().slice(page() * PAGE_SIZE, (page() + 1) * PAGE_SIZE));
92+ const totalPages = createMemo(() => Math.max(1, Math.ceil(filteredCourses().length / pageSize())));
93+ const visibleCourses = createMemo(() => filteredCourses().slice(page() * pageSize(), (page() + 1) * pageSize()));
9294
9395 const createCourse = async (event: SubmitEvent) => {
9496 event.preventDefault();
@@ -200,7 +202,7 @@ function CoursesContent() {
200202 )}
201203 </For>
202204 </div>
203- <PaginationControls page={page()} totalPages={totalPages()} onPageChange={setPage} />
205+ <TablePagination pageIndex={page()} pageCount={totalPages()} onPageChange={setPage} />
204206 </Show>
205207 </Show>
206208 </Suspense>
src/pages/exam-detail-page.tsxmodified+22 -10
@@ -1,5 +1,6 @@
11 import { Link, useLocation, useNavigate } from "@tanstack/solid-router";
2-import { For, Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
2+import { For, Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js";
3+import { createResponsivePageSize } from "@/lib/create-page-size";
34 import { createResource } from "@/lib/create-resource";
45 import type { ColumnDef } from "@tanstack/solid-table";
56 import { deleteExamById } from "@/api/exams";
@@ -33,7 +34,6 @@ import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
3334 import { EmptyState } from "@/components/ui/empty-state";
3435 import { IconCalendarDays, IconChart, IconChevronDown, IconClipboardCheck, IconClock, IconEdit, IconExam, IconEye, IconRefresh, IconSchool, IconTrash } from "@/components/ui/icons";
3536 import { Input } from "@/components/ui/input";
36-import { PaginationControls } from "@/components/ui/pagination-controls";
3737 import { PageSpinner } from "@/components/ui/page-spinner";
3838 import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
3939 import { SidePanel } from "@/components/ui/side-panel";
@@ -116,6 +116,8 @@ function ExamDetailContent() {
116116 const [removeUserId, setRemoveUserId] = createSignal<string | null>(null);
117117 const [gradeOpen, setGradeOpen] = createSignal(false);
118118 const [resultPage, setResultPage] = createSignal(0);
119+ const resultPageSize = createResponsivePageSize(RESULT_PAGE_SIZE);
120+ createEffect(on(resultPageSize, () => setResultPage(0), { defer: true }));
119121 const [answerSheetUserId, setAnswerSheetUserId] = createSignal<string | null>(null);
120122 const answerSheetOpen = () => answerSheetUserId() != null;
121123 const [answerMark, setAnswerMark] = createSignal("0");
@@ -153,11 +155,11 @@ function ExamDetailContent() {
153155 );
154156
155157 const [results, { refetch: refetchResults }] = createResource(
156- () => (hasCourseManagementRights() ? [id(), resultPage()] as const : null),
158+ () => (hasCourseManagementRights() ? [id(), resultPage(), resultPageSize()] as const : null),
157159 async (source) => {
158160 if (!source) return { items: [], total: 0, limit: RESULT_PAGE_SIZE, offset: 0 };
159- const [examId, page] = source;
160- return getExamResults(examId, { limit: RESULT_PAGE_SIZE, offset: page * RESULT_PAGE_SIZE });
161+ const [examId, page, size] = source;
162+ return getExamResults(examId, { limit: size, offset: page * size });
161163 },
162164 );
163165 const [gradeResults, { refetch: refetchGradeResults }] = createResource(
@@ -258,7 +260,7 @@ function ExamDetailContent() {
258260 async (examId) => examId ? getExamLive(examId) : null,
259261 );
260262 const resultTotal = () => results()?.total ?? 0;
261- const resultTotalPages = () => Math.max(1, Math.ceil(resultTotal() / RESULT_PAGE_SIZE));
263+ const resultTotalPages = () => Math.max(1, Math.ceil(resultTotal() / resultPageSize()));
262264 const setClampedAnswerMark = (value: string) => {
263265 if (value === "") {
264266 setAnswerMark(value);
@@ -735,10 +737,20 @@ function ExamDetailContent() {
735737 when={(results()?.items ?? []).length > 0}
736738 fallback={<EmptyState kind="exams" title={t("exams.noResults")} />}
737739 >
738- <DataTable columns={resultColumns()} data={results()?.items ?? []} filterColumn="user" />
739- <Show when={resultTotal() > RESULT_PAGE_SIZE}>
740- <PaginationControls page={Math.min(resultPage(), resultTotalPages() - 1)} totalPages={resultTotalPages()} onPageChange={setResultPage} />
741- </Show>
740+ {/* Server-paged: the table's own pager drives the fetch, so a
741+ phone's smaller page never shows up as a second pager
742+ slicing the fetched page again. */}
743+ <DataTable
744+ columns={resultColumns()}
745+ data={results()?.items ?? []}
746+ filterColumn="user"
747+ manualPagination={{
748+ pageIndex: Math.min(resultPage(), resultTotalPages() - 1),
749+ pageSize: resultPageSize(),
750+ total: resultTotal(),
751+ onPageChange: setResultPage,
752+ }}
753+ />
742754 </Show>
743755 </Suspense>
744756 </TabsContent>
src/pages/meals-page.tsxmodified+9 -6
@@ -1,4 +1,5 @@
1-import { For, Show, Suspense, createMemo, createSignal } from "solid-js";
1+import { For, Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js";
2+import { createResponsivePageSize } from "@/lib/create-page-size";
23 import { createResource } from "@/lib/create-resource";
34 import { getLimits } from "@/api/limits";
45 import { getMealMenuBookings, getMealMenus, postMealMenu } from "@/api/meals";
@@ -16,7 +17,7 @@ import { IconPlus } from "@/components/ui/icons";
1617 import { Input } from "@/components/ui/input";
1718 import { Label } from "@/components/ui/label";
1819 import { PageSpinner } from "@/components/ui/page-spinner";
19-import { PaginationControls } from "@/components/ui/pagination-controls";
20+import { TablePagination } from "@/components/ui/table-pagination";
2021 import { Select } from "@/components/ui/select";
2122 import { SidePanel } from "@/components/ui/side-panel";
2223 import { inputDateToIso, isoDateToInput } from "@/lib/datetime-input";
@@ -38,6 +39,8 @@ function MealsContent() {
3839 const { locale } = usePreferences();
3940 const canManage = () => hasMinRole(auth.user()?.role, "manager");
4041 const [page, setPage] = createSignal(0);
42+ const pageSize = createResponsivePageSize(PAGE_SIZE);
43+ createEffect(on(pageSize, () => setPage(0), { defer: true }));
4144 const [from, setFrom] = createSignal(today());
4245 const [slot, setSlot] = createSignal("all");
4346 const [showCreate, setShowCreate] = createSignal(false);
@@ -50,11 +53,11 @@ function MealsContent() {
5053 const [settings] = createResource(() => getSettings());
5154 const [limits, { refetch: refetchLimits }] = createResource(() => canManage() ? getLimits() : null);
5255 const [menus, { refetch }] = createResource(
53- () => [from(), page()] as const,
54- async ([start, index]) => getMealMenus({ from: start || undefined, limit: PAGE_SIZE, offset: index * PAGE_SIZE }),
56+ () => [from(), page(), pageSize()] as const,
57+ async ([start, index, size]) => getMealMenus({ from: start || undefined, limit: size, offset: index * size }),
5558 );
5659 const visible = createMemo(() => slot() === "all" ? menus()?.items ?? [] : (menus()?.items ?? []).filter((menu) => menu.slot === slot()));
57- const totalPages = createMemo(() => Math.max(1, Math.ceil((menus()?.total ?? 0) / PAGE_SIZE)));
60+ const totalPages = createMemo(() => Math.max(1, Math.ceil((menus()?.total ?? 0) / pageSize())));
5861
5962 // Real occupancy = confirmed bookings / capacity, both true fields — not the
6063 // fabricated İyi/Takipte/Risk badge Figma shows. `getMealMenuBookings` is
@@ -111,7 +114,7 @@ function MealsContent() {
111114 <Show when={menus.error}><ErrorAlert message={formatApiError(menus.error)} onRetry={() => void refetch()} /></Show>
112115 <Show when={visible().length > 0} fallback={<EmptyState kind="meals" title={t("meals.empty")} />}>
113116 <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"><For each={visible()}>{(menu) => <MealMenuCard menu={menu} locale={locale() === "tr" ? "tr-TR" : "en-US"} labels={{ dishes: t("meals.dishes"), capacity: t("meals.capacity"), conflict: t("meals.conflict"), reservations: t("meals.reservations"), topPick: t("meals.topPick") }} reservationCount={reservationCounts()?.get(menu.id) ?? undefined} />}</For></div>
114- <PaginationControls page={page()} totalPages={totalPages()} onPageChange={setPage} />
117+ <TablePagination pageIndex={page()} pageCount={totalPages()} onPageChange={setPage} />
115118 </Show>
116119 </Suspense>
117120 </DataSection>
src/pages/messages-page.tsxmodified+4 -4
@@ -8,7 +8,7 @@ import {
88 } from "solid-js";
99 import { createResource } from "@/lib/create-resource";
1010 import { RouteGuard } from "@/components/layout/route-guard";
11-import { PaginationControls } from "@/components/ui/pagination-controls";
11+import { TablePagination } from "@/components/ui/table-pagination";
1212 import { Button } from "@/components/ui/button";
1313 import {
1414 IconArchive,
@@ -421,10 +421,10 @@ export default function MessagesPage() {
421421
422422 <Show when={messagePage() && messagePage()!.total > limit}>
423423 <div class="p-4 border-t border-border-hairline">
424- <PaginationControls
425- page={page()}
424+ <TablePagination
425+ pageIndex={page()}
426426 onPageChange={setPage}
427- totalPages={Math.ceil((messagePage()?.total ?? 0) / limit)}
427+ pageCount={Math.ceil((messagePage()?.total ?? 0) / limit)}
428428 />
429429 </div>
430430 </Show>
src/pages/notes-page.tsxmodified+12 -9
@@ -1,4 +1,5 @@
1-import { Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
1+import { Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js";
2+import { createResponsivePageSize } from "@/lib/create-page-size";
23 import { createResource } from "@/lib/create-resource";
34 import { useLocation, useNavigate } from "@tanstack/solid-router";
45 import { deleteNoteById } from "@/api/notes";
@@ -13,7 +14,7 @@ import { NoteList } from "@/components/notes/note-list";
1314 import { Button } from "@/components/ui/button";
1415 import { IconPlus, IconUploadCloud } from "@/components/ui/icons";
1516 import { PageSpinner } from "@/components/ui/page-spinner";
16-import { PaginationControls } from "@/components/ui/pagination-controls";
17+import { TablePagination } from "@/components/ui/table-pagination";
1718 import { SidePanel } from "@/components/ui/side-panel";
1819 import { createFlash } from "@/lib/flash";
1920 import { loadListPage, totalPages as pagesOf } from "@/lib/list-page";
@@ -43,13 +44,15 @@ function NotesContent() {
4344 if (location().searchStr.includes("action=import")) setImportOpen(true);
4445 });
4546 const [page, setPage] = createSignal(0);
47+ const pageSize = createResponsivePageSize(NOTE_PAGE_SIZE);
48+ createEffect(on(pageSize, () => setPage(0), { defer: true }));
4649
4750 const [list, { refetch }] = createResource(
48- () => page(),
49- async (currentPage) =>
51+ () => ({ page: page(), size: pageSize() }),
52+ async (source) =>
5053 loadListPage({
51- page: currentPage,
52- pageSize: NOTE_PAGE_SIZE,
54+ page: source.page,
55+ pageSize: source.size,
5356 clientMode: false,
5457 fetch: getNotes,
5558 }),
@@ -57,7 +60,7 @@ function NotesContent() {
5760
5861 const total = () => list()?.total ?? 0;
5962 const pageItems = () => list()?.items ?? [];
60- const totalPages = createMemo(() => pagesOf(total(), NOTE_PAGE_SIZE));
63+ const totalPages = createMemo(() => pagesOf(total(), pageSize()));
6164 const safePage = createMemo(() => Math.min(page(), totalPages() - 1));
6265
6366 const wrap = async (fn: () => Promise<void>, okMessage: string) => {
@@ -129,8 +132,8 @@ function NotesContent() {
129132 }, t("common.deleted"))
130133 }
131134 />
132- <Show when={total() > NOTE_PAGE_SIZE}>
133- <PaginationControls page={safePage()} totalPages={totalPages()} onPageChange={setPage} />
135+ <Show when={total() > pageSize()}>
136+ <TablePagination pageIndex={safePage()} pageCount={totalPages()} onPageChange={setPage} />
134137 </Show>
135138 </Show>
136139 </Suspense>
src/pages/payments-page.tsxmodified+6 -3
@@ -1,5 +1,6 @@
11 import { useLocation, useNavigate } from "@tanstack/solid-router";
22 import { For, Index, Show, Suspense, createEffect, createMemo, createSignal, onCleanup } from "solid-js";
3+import { createResponsivePageSize } from "@/lib/create-page-size";
34 import { createResource } from "@/lib/create-resource";
45 import type { ColumnDef } from "@tanstack/solid-table";
56 import {
@@ -118,10 +119,12 @@ function PaymentsContent() {
118119 onCleanup(() => clearTimeout(queryTimer));
119120
120121 const [studentPage, setStudentPage] = createSignal(0);
121- // Reset to page 1 whenever the query or plan filter changes underneath it.
122+ const studentPageSize = createResponsivePageSize(STUDENT_PAGE_SIZE);
123+ // Reset to page 1 whenever the query, plan filter or page size changes underneath it.
122124 createEffect(() => {
123125 debouncedQuery();
124126 planFilter();
127+ studentPageSize();
125128 setStudentPage(0);
126129 });
127130
@@ -134,7 +137,7 @@ function PaymentsContent() {
134137 // (already name-resolved) plan roster and filters/pages it client-side —
135138 // a plan's assignees are a small, bounded list on their own.
136139 const [studentsPage, { refetch: refetchStudents }] = createResource(
137- () => ({ plan: planFilter(), q: debouncedQuery(), page: studentPage(), size: STUDENT_PAGE_SIZE }),
140+ () => ({ plan: planFilter(), q: debouncedQuery(), page: studentPage(), size: studentPageSize() }),
138141 async ({ plan, q, page, size }): Promise<{ items: PersonRef[]; total: number }> => {
139142 if (plan) {
140143 const assignments = await getPlanAssignments(plan, { limit: 500 });
@@ -650,7 +653,7 @@ function PaymentsContent() {
650653 enablePagination
651654 manualPagination={{
652655 pageIndex: studentPage(),
653- pageSize: STUDENT_PAGE_SIZE,
656+ pageSize: studentPageSize(),
654657 total: studentsTotal(),
655658 onPageChange: setStudentPage,
656659 }}
src/pages/question-bank-page.tsxmodified+9 -5
@@ -1,5 +1,6 @@
11 import { useNavigate } from "@tanstack/solid-router";
2-import { Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
2+import { Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js";
3+import { createResponsivePageSize } from "@/lib/create-page-size";
34 import { createResource } from "@/lib/create-resource";
45 import type { ColumnDef } from "@tanstack/solid-table";
56 import { deleteBankQuestionById, getBankQuestions } from "@/api/bank-questions";
@@ -45,6 +46,8 @@ function QuestionBankContent() {
4546 const visibilityFilter = () => (bankTab() === "school" ? "school" : "all") as "all" | "private" | "school";
4647 const [subjectFilter, setSubjectFilter] = createSignal("all");
4748 const [page, setPage] = createSignal(0);
49+ const pageSize = createResponsivePageSize(BANK_PAGE_SIZE);
50+ createEffect(on(pageSize, () => setPage(0), { defer: true }));
4851 const [query, setQuery, debouncedQuery] = createDebouncedSignal();
4952 const [createOpen, setCreateOpen] = createSignal(false);
5053 const [editing, setEditing] = createSignal<BankQuestion | null>(null);
@@ -58,6 +61,7 @@ function QuestionBankContent() {
5861 const [list, { refetch }] = createResource(
5962 () => ({
6063 page: page(),
64+ size: pageSize(),
6165 owner: ownerFilter(),
6266 subject: subjectFilter(),
6367 visibility: visibilityFilter(),
@@ -65,8 +69,8 @@ function QuestionBankContent() {
6569 }),
6670 async (filters) => {
6771 const result = await getBankQuestions({
68- limit: BANK_PAGE_SIZE,
69- offset: filters.page * BANK_PAGE_SIZE,
72+ limit: filters.size,
73+ offset: filters.page * filters.size,
7074 ...(filters.owner === "me" ? { owner: "me" } : {}),
7175 ...(filters.subject !== "all" ? { subject: filters.subject } : {}),
7276 ...(filters.visibility !== "all" ? { visibility: filters.visibility } : {}),
@@ -84,7 +88,7 @@ function QuestionBankContent() {
8488 // Deleting the last row of the last page shrinks the page count under the
8589 // current page; the table then hides its pagination bar entirely and the user
8690 // is stranded with no control to get back. Same clamp as exam-questions-panel.
87- const pageCount = () => Math.max(1, Math.ceil(total() / BANK_PAGE_SIZE));
91+ const pageCount = () => Math.max(1, Math.ceil(total() / pageSize()));
8892 createEffect(() => {
8993 if (page() >= pageCount()) setPage(pageCount() - 1);
9094 });
@@ -267,7 +271,7 @@ function QuestionBankContent() {
267271 setPage(0);
268272 }}
269273 enablePagination
270- manualPagination={{ pageIndex: page(), pageSize: BANK_PAGE_SIZE, total: total(), onPageChange: setPage }}
274+ manualPagination={{ pageIndex: page(), pageSize: pageSize(), total: total(), onPageChange: setPage }}
271275 empty={t("bank.empty")}
272276 storageKey="question-bank"
273277 onRowClick={(question) => navigate({ to: "/question-bank/$id", params: { id: question.id } })}
src/pages/staff-work-page.tsxmodified+7 -4
@@ -1,4 +1,5 @@
11 import { For, Show, createEffect, createMemo, createSignal } from "solid-js";
2+import { createResponsivePageSize } from "@/lib/create-page-size";
23 import { createResource } from "@/lib/create-resource";
34 import type { ColumnDef } from "@tanstack/solid-table";
45 import { deleteWorkEntryById } from "@/api/work";
@@ -23,7 +24,7 @@ import { DatePicker } from "@/components/ui/date-picker";
2324 import { IconChevronRight, IconEdit, IconTrash } from "@/components/ui/icons";
2425 import { Input } from "@/components/ui/input";
2526 import { Label } from "@/components/ui/label";
26-import { PaginationControls } from "@/components/ui/pagination-controls";
27+import { TablePagination } from "@/components/ui/table-pagination";
2728 import { SidePanel } from "@/components/ui/side-panel";
2829 import { TableRowActions } from "@/components/ui/table-row-actions";
2930 import { formatDateTime, formatDurationMinutes } from "@/lib/format";
@@ -145,6 +146,7 @@ function StaffWorkContent() {
145146
146147 const [staffSearch, setStaffSearch] = createSignal("");
147148 const [staffPage, setStaffPage] = createSignal(0);
149+ const peoplePageSize = createResponsivePageSize(PEOPLE_PAGE_SIZE);
148150
149151 const entryRows = () => entries().items;
150152 const peopleLoading = () => people.loading;
@@ -155,10 +157,11 @@ function StaffWorkContent() {
155157 const q = staffSearch().trim();
156158 return q ? people().filter((person) => searchPerson(person, q)) : people();
157159 });
158- const staffPageCount = createMemo(() => Math.max(1, Math.ceil(filteredPeople().length / PEOPLE_PAGE_SIZE)));
159- const pagedPeople = createMemo(() => filteredPeople().slice(staffPage() * PEOPLE_PAGE_SIZE, staffPage() * PEOPLE_PAGE_SIZE + PEOPLE_PAGE_SIZE));
160+ const staffPageCount = createMemo(() => Math.max(1, Math.ceil(filteredPeople().length / peoplePageSize())));
161+ const pagedPeople = createMemo(() => filteredPeople().slice(staffPage() * peoplePageSize(), (staffPage() + 1) * peoplePageSize()));
160162 createEffect(() => {
161163 staffSearch();
164+ peoplePageSize();
162165 setStaffPage(0);
163166 });
164167
@@ -326,7 +329,7 @@ function StaffWorkContent() {
326329 )}
327330 </For>
328331 </div>
329- <PaginationControls page={staffPage()} totalPages={staffPageCount()} onPageChange={setStaffPage} />
332+ <TablePagination pageIndex={staffPage()} pageCount={staffPageCount()} onPageChange={setStaffPage} />
330333 </Show>
331334 </Show>
332335 </div>
src/pages/students-roster-page.tsxmodified+13 -9
@@ -15,7 +15,7 @@ import { ComingSoonBadge, ComingSoonValue } from "@/components/ui/coming-soon";
1515 import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
1616 import { ErrorAlert } from "@/components/ui/error-alert";
1717 import { IconEye, IconPlus, IconUploadCloud } from "@/components/ui/icons";
18-import { Select } from "@/components/ui/select";
18+import { DropdownSelect } from "@/components/ui/select";
1919 import { TableRowActions } from "@/components/ui/table-row-actions";
2020 import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
2121 import { useT } from "@/stores/preferences-context";
@@ -154,14 +154,18 @@ function StudentsRosterContent() {
154154 }
155155 filters={
156156 <>
157- <Select aria-label={t("roster.class")} value={classFilter()} onChange={(e) => setClassFilter(e.currentTarget.value)} wrapperClass="w-auto">
158- <option value="">{t("roster.classAll")}</option>
159- <For each={value().classes}>{(cls) => <option value={cls.id}>{cls.name}</option>}</For>
160- </Select>
161- <Select aria-label={t("academicYears.year")} value={yearFilter()} onChange={(e) => setYearFilter(e.currentTarget.value)} wrapperClass="w-auto">
162- <option value="">{t("common.all")}</option>
163- <For each={value().years}>{(year) => <option value={year.id}>{year.name}</option>}</For>
164- </Select>
157+ <DropdownSelect
158+ labelPrefix={t("roster.class")}
159+ value={classFilter()}
160+ onChange={setClassFilter}
161+ options={[{ value: "", label: t("common.all") }, ...value().classes.map((cls) => ({ value: cls.id, label: cls.name }))]}
162+ />
163+ <DropdownSelect
164+ labelPrefix={t("academicYears.year")}
165+ value={yearFilter()}
166+ onChange={setYearFilter}
167+ options={[{ value: "", label: t("common.all") }, ...value().years.map((year) => ({ value: year.id, label: year.name }))]}
168+ />
165169 </>
166170 }
167171 enablePagination
src/pages/whiteboards-page.tsxmodified+9 -7
@@ -1,5 +1,6 @@
11 import { useNavigate } from "@tanstack/solid-router";
2-import { For, Show, Suspense, createEffect, createMemo, createSignal, onCleanup } from "solid-js";
2+import { For, Show, Suspense, createEffect, createMemo, createSignal, on, onCleanup } from "solid-js";
3+import { createResponsivePageSize } from "@/lib/create-page-size";
34 import { createResource } from "@/lib/create-resource";
45 import { getBoards, postBoard, type Board } from "@/api/boards";
56 import { getUserSearch } from "@/api/users";
@@ -38,14 +39,15 @@ function WhiteboardsContent() {
3839 const auth = useAuth();
3940 const navigate = useNavigate();
4041
41- const PAGE_SIZE = 12;
42+ const pageSize = createResponsivePageSize(12);
4243 const [page, setPage] = createSignal(0);
44+ createEffect(on(pageSize, () => setPage(0), { defer: true }));
4345 const [boards, { refetch }] = createResource(
44- page,
45- (pageIndex) => getBoards({ limit: PAGE_SIZE, offset: pageIndex * PAGE_SIZE }),
46+ () => ({ page: page(), size: pageSize() }),
47+ (source) => getBoards({ limit: source.size, offset: source.page * source.size }),
4648 );
4749 const [createOpen, setCreateOpen] = createSignal(false);
48- const pageCount = createMemo(() => Math.max(1, Math.ceil((boards.latest?.total ?? 0) / PAGE_SIZE)));
50+ const pageCount = createMemo(() => Math.max(1, Math.ceil((boards.latest?.total ?? 0) / pageSize())));
4951 const [query, setQuery] = createSignal("");
5052 // The board list endpoint has no server-side text filter, so this narrows
5153 // only the current page's real titles — a client-side search over real
@@ -98,11 +100,11 @@ function WhiteboardsContent() {
98100 </For>
99101 </div>
100102 </Show>
101- <Show when={(boards()?.total ?? 0) > PAGE_SIZE}>
103+ <Show when={(boards()?.total ?? 0) > pageSize()}>
102104 <TablePagination
103105 pageIndex={page()}
104106 pageCount={pageCount()}
105- pageSize={PAGE_SIZE}
107+ pageSize={pageSize()}
106108 total={boards()?.total ?? 0}
107109 onPageChange={setPage}
108110 />