-
-
- props.onSearchInput?.(value)}
- />
-
- {props.filters}
-
+ // One wrapping row, ordered by width — the same shape as DataTable's
+ // toolbar. Phones: search and actions share the first line and the
+ // filters take the next one; nothing is squeezed into a fixed row, where
+ // the search box shrank to a sliver and a filter painted over its icon.
+ // From `sm`: search, filters, then actions pushed to the right edge.
+
+
+ props.onSearchInput?.(value)}
+ />
+
+
+ {props.filters}
+
- {props.actions}
+ {props.actions}
);
diff --git a/src/components/ui/pagination-controls.tsx b/src/components/ui/pagination-controls.tsx
deleted file mode 100644
index 720d975..0000000
--- a/src/components/ui/pagination-controls.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { Button } from "@/components/ui/button";
-import { IconChevronLeft, IconChevronRight } from "@/components/ui/icons";
-import { useT } from "@/stores/preferences-context";
-
-export function PaginationControls(props: {
- page: number;
- totalPages: number;
- onPageChange: (page: number) => void;
-}) {
- const t = useT();
- return (
-
-
-
- {t("common.pageOf", { page: props.page + 1, total: props.totalPages })}
-
-
-
- );
-}
diff --git a/src/components/ui/table-pagination.tsx b/src/components/ui/table-pagination.tsx
index 5717174..a26dbd3 100644
--- a/src/components/ui/table-pagination.tsx
+++ b/src/components/ui/table-pagination.tsx
@@ -1,55 +1,78 @@
+import { Show } from "solid-js";
import { Button } from "@/components/ui/button";
import { IconChevronLeft, IconChevronRight } from "@/components/ui/icons";
+import { cn } from "@/lib/cn";
import { useT } from "@/stores/preferences-context";
export type TablePaginationProps = {
/** Zero-based current page index. */
pageIndex: number;
pageCount: number;
- pageSize: number;
+ /** With `total`, prints "a-b / total"; without either only the page counter shows. */
+ pageSize?: number;
/** Total row count (across all pages). */
- total: number;
+ total?: number;
onPageChange: (pageIndex: number) => void;
+ class?: string;
};
-/** Footer: "X kayıttan a-b arası" + prev/next + "page / total". */
+/**
+ * Footer: "a-b / total" + prev / "page / count" / next, on one row at every
+ * width. The buttons are full touch targets on phones and compact from `sm`
+ * up. A single page keeps the row count but drops the buttons — two disabled
+ * arrows around "1 / 1" only take room.
+ */
export function TablePagination(props: TablePaginationProps) {
const t = useT();
- const start = () => (props.total === 0 ? 0 : props.pageIndex * props.pageSize + 1);
- const end = () => Math.min((props.pageIndex + 1) * props.pageSize, props.total);
+ const hasRange = () => props.total != null && props.pageSize != null;
+ const start = () => (!props.total || !props.pageSize ? 0 : props.pageIndex * props.pageSize + 1);
+ const end = () => Math.min((props.pageIndex + 1) * (props.pageSize ?? 0), props.total ?? 0);
+ 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]";
return (
-
-
- {t("common.pageRange", { start: start(), end: end(), total: props.total })}
+ // Nothing to count and nowhere to go: an empty frame would only take room.
+ 1}>
+
+
+ {t("common.pageRange", { start: start(), end: end(), total: props.total ?? 0 })}
-
-
-
- {t("common.pageOf", { page: props.pageIndex + 1, total: props.pageCount })}
-
-
-
+
1}>
+
+
+
);
}
diff --git a/src/components/ui/table-row-actions.tsx b/src/components/ui/table-row-actions.tsx
index 637afd2..57aa46b 100644
--- a/src/components/ui/table-row-actions.tsx
+++ b/src/components/ui/table-row-actions.tsx
@@ -34,10 +34,11 @@ export function TableRowActions(props: { label: string; actions: TableRowAction[
class={props.compact
? "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"
: "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"}
+ data-row-actions-trigger
aria-label={props.label}
title={props.label}
>
- {!props.compact && {props.triggerLabel ?? t("common.action")}}
+ {!props.compact && {props.triggerLabel ?? t("common.action")}}
@@ -64,6 +65,7 @@ export function TableRowActions(props: { label: string; actions: TableRowAction[
{(action) => (
-
+
diff --git a/src/pages/exam-detail-page.tsx b/src/pages/exam-detail-page.tsx
index 3d9e5d3..80e6529 100644
--- a/src/pages/exam-detail-page.tsx
+++ b/src/pages/exam-detail-page.tsx
@@ -1,5 +1,6 @@
import { Link, useLocation, useNavigate } from "@tanstack/solid-router";
-import { For, Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
+import { For, Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js";
+import { createResponsivePageSize } from "@/lib/create-page-size";
import { createResource } from "@/lib/create-resource";
import type { ColumnDef } from "@tanstack/solid-table";
import { deleteExamById } from "@/api/exams";
@@ -33,7 +34,6 @@ import { DataTable, DataTableSkeleton } from "@/components/ui/data-table";
import { EmptyState } from "@/components/ui/empty-state";
import { IconCalendarDays, IconChart, IconChevronDown, IconClipboardCheck, IconClock, IconEdit, IconExam, IconEye, IconRefresh, IconSchool, IconTrash } from "@/components/ui/icons";
import { Input } from "@/components/ui/input";
-import { PaginationControls } from "@/components/ui/pagination-controls";
import { PageSpinner } from "@/components/ui/page-spinner";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { SidePanel } from "@/components/ui/side-panel";
@@ -116,6 +116,8 @@ function ExamDetailContent() {
const [removeUserId, setRemoveUserId] = createSignal
(null);
const [gradeOpen, setGradeOpen] = createSignal(false);
const [resultPage, setResultPage] = createSignal(0);
+ const resultPageSize = createResponsivePageSize(RESULT_PAGE_SIZE);
+ createEffect(on(resultPageSize, () => setResultPage(0), { defer: true }));
const [answerSheetUserId, setAnswerSheetUserId] = createSignal(null);
const answerSheetOpen = () => answerSheetUserId() != null;
const [answerMark, setAnswerMark] = createSignal("0");
@@ -153,11 +155,11 @@ function ExamDetailContent() {
);
const [results, { refetch: refetchResults }] = createResource(
- () => (hasCourseManagementRights() ? [id(), resultPage()] as const : null),
+ () => (hasCourseManagementRights() ? [id(), resultPage(), resultPageSize()] as const : null),
async (source) => {
if (!source) return { items: [], total: 0, limit: RESULT_PAGE_SIZE, offset: 0 };
- const [examId, page] = source;
- return getExamResults(examId, { limit: RESULT_PAGE_SIZE, offset: page * RESULT_PAGE_SIZE });
+ const [examId, page, size] = source;
+ return getExamResults(examId, { limit: size, offset: page * size });
},
);
const [gradeResults, { refetch: refetchGradeResults }] = createResource(
@@ -258,7 +260,7 @@ function ExamDetailContent() {
async (examId) => examId ? getExamLive(examId) : null,
);
const resultTotal = () => results()?.total ?? 0;
- const resultTotalPages = () => Math.max(1, Math.ceil(resultTotal() / RESULT_PAGE_SIZE));
+ const resultTotalPages = () => Math.max(1, Math.ceil(resultTotal() / resultPageSize()));
const setClampedAnswerMark = (value: string) => {
if (value === "") {
setAnswerMark(value);
@@ -735,10 +737,20 @@ function ExamDetailContent() {
when={(results()?.items ?? []).length > 0}
fallback={}
>
-
- RESULT_PAGE_SIZE}>
-
-
+ {/* Server-paged: the table's own pager drives the fetch, so a
+ phone's smaller page never shows up as a second pager
+ slicing the fetched page again. */}
+
diff --git a/src/pages/meals-page.tsx b/src/pages/meals-page.tsx
index 0dbc048..98ac31f 100644
--- a/src/pages/meals-page.tsx
+++ b/src/pages/meals-page.tsx
@@ -1,4 +1,5 @@
-import { For, Show, Suspense, createMemo, createSignal } from "solid-js";
+import { For, Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js";
+import { createResponsivePageSize } from "@/lib/create-page-size";
import { createResource } from "@/lib/create-resource";
import { getLimits } from "@/api/limits";
import { getMealMenuBookings, getMealMenus, postMealMenu } from "@/api/meals";
@@ -16,7 +17,7 @@ import { IconPlus } from "@/components/ui/icons";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { PageSpinner } from "@/components/ui/page-spinner";
-import { PaginationControls } from "@/components/ui/pagination-controls";
+import { TablePagination } from "@/components/ui/table-pagination";
import { Select } from "@/components/ui/select";
import { SidePanel } from "@/components/ui/side-panel";
import { inputDateToIso, isoDateToInput } from "@/lib/datetime-input";
@@ -38,6 +39,8 @@ function MealsContent() {
const { locale } = usePreferences();
const canManage = () => hasMinRole(auth.user()?.role, "manager");
const [page, setPage] = createSignal(0);
+ const pageSize = createResponsivePageSize(PAGE_SIZE);
+ createEffect(on(pageSize, () => setPage(0), { defer: true }));
const [from, setFrom] = createSignal(today());
const [slot, setSlot] = createSignal("all");
const [showCreate, setShowCreate] = createSignal(false);
@@ -50,11 +53,11 @@ function MealsContent() {
const [settings] = createResource(() => getSettings());
const [limits, { refetch: refetchLimits }] = createResource(() => canManage() ? getLimits() : null);
const [menus, { refetch }] = createResource(
- () => [from(), page()] as const,
- async ([start, index]) => getMealMenus({ from: start || undefined, limit: PAGE_SIZE, offset: index * PAGE_SIZE }),
+ () => [from(), page(), pageSize()] as const,
+ async ([start, index, size]) => getMealMenus({ from: start || undefined, limit: size, offset: index * size }),
);
const visible = createMemo(() => slot() === "all" ? menus()?.items ?? [] : (menus()?.items ?? []).filter((menu) => menu.slot === slot()));
- const totalPages = createMemo(() => Math.max(1, Math.ceil((menus()?.total ?? 0) / PAGE_SIZE)));
+ const totalPages = createMemo(() => Math.max(1, Math.ceil((menus()?.total ?? 0) / pageSize())));
// Real occupancy = confirmed bookings / capacity, both true fields — not the
// fabricated İyi/Takipte/Risk badge Figma shows. `getMealMenuBookings` is
@@ -111,7 +114,7 @@ function MealsContent() {
void refetch()} />
0} fallback={}>
{(menu) => }
-
+
diff --git a/src/pages/messages-page.tsx b/src/pages/messages-page.tsx
index d570d1f..68165c5 100644
--- a/src/pages/messages-page.tsx
+++ b/src/pages/messages-page.tsx
@@ -8,7 +8,7 @@ import {
} from "solid-js";
import { createResource } from "@/lib/create-resource";
import { RouteGuard } from "@/components/layout/route-guard";
-import { PaginationControls } from "@/components/ui/pagination-controls";
+import { TablePagination } from "@/components/ui/table-pagination";
import { Button } from "@/components/ui/button";
import {
IconArchive,
@@ -421,10 +421,10 @@ export default function MessagesPage() {
limit}>
diff --git a/src/pages/notes-page.tsx b/src/pages/notes-page.tsx
index 03235fc..c946ffa 100644
--- a/src/pages/notes-page.tsx
+++ b/src/pages/notes-page.tsx
@@ -1,4 +1,5 @@
-import { Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
+import { Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js";
+import { createResponsivePageSize } from "@/lib/create-page-size";
import { createResource } from "@/lib/create-resource";
import { useLocation, useNavigate } from "@tanstack/solid-router";
import { deleteNoteById } from "@/api/notes";
@@ -13,7 +14,7 @@ import { NoteList } from "@/components/notes/note-list";
import { Button } from "@/components/ui/button";
import { IconPlus, IconUploadCloud } from "@/components/ui/icons";
import { PageSpinner } from "@/components/ui/page-spinner";
-import { PaginationControls } from "@/components/ui/pagination-controls";
+import { TablePagination } from "@/components/ui/table-pagination";
import { SidePanel } from "@/components/ui/side-panel";
import { createFlash } from "@/lib/flash";
import { loadListPage, totalPages as pagesOf } from "@/lib/list-page";
@@ -43,13 +44,15 @@ function NotesContent() {
if (location().searchStr.includes("action=import")) setImportOpen(true);
});
const [page, setPage] = createSignal(0);
+ const pageSize = createResponsivePageSize(NOTE_PAGE_SIZE);
+ createEffect(on(pageSize, () => setPage(0), { defer: true }));
const [list, { refetch }] = createResource(
- () => page(),
- async (currentPage) =>
+ () => ({ page: page(), size: pageSize() }),
+ async (source) =>
loadListPage({
- page: currentPage,
- pageSize: NOTE_PAGE_SIZE,
+ page: source.page,
+ pageSize: source.size,
clientMode: false,
fetch: getNotes,
}),
@@ -57,7 +60,7 @@ function NotesContent() {
const total = () => list()?.total ?? 0;
const pageItems = () => list()?.items ?? [];
- const totalPages = createMemo(() => pagesOf(total(), NOTE_PAGE_SIZE));
+ const totalPages = createMemo(() => pagesOf(total(), pageSize()));
const safePage = createMemo(() => Math.min(page(), totalPages() - 1));
const wrap = async (fn: () => Promise, okMessage: string) => {
@@ -129,8 +132,8 @@ function NotesContent() {
}, t("common.deleted"))
}
/>
- NOTE_PAGE_SIZE}>
-
+ pageSize()}>
+
diff --git a/src/pages/payments-page.tsx b/src/pages/payments-page.tsx
index 7fde63d..5b02df7 100644
--- a/src/pages/payments-page.tsx
+++ b/src/pages/payments-page.tsx
@@ -1,5 +1,6 @@
import { useLocation, useNavigate } from "@tanstack/solid-router";
import { For, Index, Show, Suspense, createEffect, createMemo, createSignal, onCleanup } from "solid-js";
+import { createResponsivePageSize } from "@/lib/create-page-size";
import { createResource } from "@/lib/create-resource";
import type { ColumnDef } from "@tanstack/solid-table";
import {
@@ -118,10 +119,12 @@ function PaymentsContent() {
onCleanup(() => clearTimeout(queryTimer));
const [studentPage, setStudentPage] = createSignal(0);
- // Reset to page 1 whenever the query or plan filter changes underneath it.
+ const studentPageSize = createResponsivePageSize(STUDENT_PAGE_SIZE);
+ // Reset to page 1 whenever the query, plan filter or page size changes underneath it.
createEffect(() => {
debouncedQuery();
planFilter();
+ studentPageSize();
setStudentPage(0);
});
@@ -134,7 +137,7 @@ function PaymentsContent() {
// (already name-resolved) plan roster and filters/pages it client-side —
// a plan's assignees are a small, bounded list on their own.
const [studentsPage, { refetch: refetchStudents }] = createResource(
- () => ({ plan: planFilter(), q: debouncedQuery(), page: studentPage(), size: STUDENT_PAGE_SIZE }),
+ () => ({ plan: planFilter(), q: debouncedQuery(), page: studentPage(), size: studentPageSize() }),
async ({ plan, q, page, size }): Promise<{ items: PersonRef[]; total: number }> => {
if (plan) {
const assignments = await getPlanAssignments(plan, { limit: 500 });
@@ -650,7 +653,7 @@ function PaymentsContent() {
enablePagination
manualPagination={{
pageIndex: studentPage(),
- pageSize: STUDENT_PAGE_SIZE,
+ pageSize: studentPageSize(),
total: studentsTotal(),
onPageChange: setStudentPage,
}}
diff --git a/src/pages/question-bank-page.tsx b/src/pages/question-bank-page.tsx
index a50ec7e..4b40f97 100644
--- a/src/pages/question-bank-page.tsx
+++ b/src/pages/question-bank-page.tsx
@@ -1,5 +1,6 @@
import { useNavigate } from "@tanstack/solid-router";
-import { Show, Suspense, createEffect, createMemo, createSignal } from "solid-js";
+import { Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js";
+import { createResponsivePageSize } from "@/lib/create-page-size";
import { createResource } from "@/lib/create-resource";
import type { ColumnDef } from "@tanstack/solid-table";
import { deleteBankQuestionById, getBankQuestions } from "@/api/bank-questions";
@@ -45,6 +46,8 @@ function QuestionBankContent() {
const visibilityFilter = () => (bankTab() === "school" ? "school" : "all") as "all" | "private" | "school";
const [subjectFilter, setSubjectFilter] = createSignal("all");
const [page, setPage] = createSignal(0);
+ const pageSize = createResponsivePageSize(BANK_PAGE_SIZE);
+ createEffect(on(pageSize, () => setPage(0), { defer: true }));
const [query, setQuery, debouncedQuery] = createDebouncedSignal();
const [createOpen, setCreateOpen] = createSignal(false);
const [editing, setEditing] = createSignal(null);
@@ -58,6 +61,7 @@ function QuestionBankContent() {
const [list, { refetch }] = createResource(
() => ({
page: page(),
+ size: pageSize(),
owner: ownerFilter(),
subject: subjectFilter(),
visibility: visibilityFilter(),
@@ -65,8 +69,8 @@ function QuestionBankContent() {
}),
async (filters) => {
const result = await getBankQuestions({
- limit: BANK_PAGE_SIZE,
- offset: filters.page * BANK_PAGE_SIZE,
+ limit: filters.size,
+ offset: filters.page * filters.size,
...(filters.owner === "me" ? { owner: "me" } : {}),
...(filters.subject !== "all" ? { subject: filters.subject } : {}),
...(filters.visibility !== "all" ? { visibility: filters.visibility } : {}),
@@ -84,7 +88,7 @@ function QuestionBankContent() {
// Deleting the last row of the last page shrinks the page count under the
// current page; the table then hides its pagination bar entirely and the user
// is stranded with no control to get back. Same clamp as exam-questions-panel.
- const pageCount = () => Math.max(1, Math.ceil(total() / BANK_PAGE_SIZE));
+ const pageCount = () => Math.max(1, Math.ceil(total() / pageSize()));
createEffect(() => {
if (page() >= pageCount()) setPage(pageCount() - 1);
});
@@ -267,7 +271,7 @@ function QuestionBankContent() {
setPage(0);
}}
enablePagination
- manualPagination={{ pageIndex: page(), pageSize: BANK_PAGE_SIZE, total: total(), onPageChange: setPage }}
+ manualPagination={{ pageIndex: page(), pageSize: pageSize(), total: total(), onPageChange: setPage }}
empty={t("bank.empty")}
storageKey="question-bank"
onRowClick={(question) => navigate({ to: "/question-bank/$id", params: { id: question.id } })}
diff --git a/src/pages/staff-work-page.tsx b/src/pages/staff-work-page.tsx
index d0c6d10..f17c94c 100644
--- a/src/pages/staff-work-page.tsx
+++ b/src/pages/staff-work-page.tsx
@@ -1,4 +1,5 @@
import { For, Show, createEffect, createMemo, createSignal } from "solid-js";
+import { createResponsivePageSize } from "@/lib/create-page-size";
import { createResource } from "@/lib/create-resource";
import type { ColumnDef } from "@tanstack/solid-table";
import { deleteWorkEntryById } from "@/api/work";
@@ -23,7 +24,7 @@ import { DatePicker } from "@/components/ui/date-picker";
import { IconChevronRight, IconEdit, IconTrash } from "@/components/ui/icons";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
-import { PaginationControls } from "@/components/ui/pagination-controls";
+import { TablePagination } from "@/components/ui/table-pagination";
import { SidePanel } from "@/components/ui/side-panel";
import { TableRowActions } from "@/components/ui/table-row-actions";
import { formatDateTime, formatDurationMinutes } from "@/lib/format";
@@ -145,6 +146,7 @@ function StaffWorkContent() {
const [staffSearch, setStaffSearch] = createSignal("");
const [staffPage, setStaffPage] = createSignal(0);
+ const peoplePageSize = createResponsivePageSize(PEOPLE_PAGE_SIZE);
const entryRows = () => entries().items;
const peopleLoading = () => people.loading;
@@ -155,10 +157,11 @@ function StaffWorkContent() {
const q = staffSearch().trim();
return q ? people().filter((person) => searchPerson(person, q)) : people();
});
- const staffPageCount = createMemo(() => Math.max(1, Math.ceil(filteredPeople().length / PEOPLE_PAGE_SIZE)));
- const pagedPeople = createMemo(() => filteredPeople().slice(staffPage() * PEOPLE_PAGE_SIZE, staffPage() * PEOPLE_PAGE_SIZE + PEOPLE_PAGE_SIZE));
+ const staffPageCount = createMemo(() => Math.max(1, Math.ceil(filteredPeople().length / peoplePageSize())));
+ const pagedPeople = createMemo(() => filteredPeople().slice(staffPage() * peoplePageSize(), (staffPage() + 1) * peoplePageSize()));
createEffect(() => {
staffSearch();
+ peoplePageSize();
setStaffPage(0);
});
@@ -326,7 +329,7 @@ function StaffWorkContent() {
)}
-