diff --git a/src/assets/illustrations/README.md b/src/assets/illustrations/README.md new file mode 100644 index 0000000..3be3b1f --- /dev/null +++ b/src/assets/illustrations/README.md @@ -0,0 +1,27 @@ +# Illustrations + +Scenes from [unDraw](https://undraw.co/illustrations) by Katerina Limpitsouni, +used under the [unDraw license](https://undraw.co/license): free for personal +and commercial use, no attribution required. The license forbids redistributing +the files as a collection or using them to train AI models. + +Files are kept exactly as downloaded (`https://cdn.undraw.co/illustrations/.svg`); +`src/lib/illustrations.ts` maps their stock palette onto theme tokens at load time. + +| File | unDraw slug | +| --- | --- | +| coming-soon.svg | under-construction_hdrn | +| courses.svg | online-learning_tgmv | +| empty.svg | empty_4zx0 | +| events.svg | events-calendar_sudy | +| exams.svg | online-test_cqv0 | +| homework.svg | studying_n5uj | +| meals.svg | breakfast_rgx5 | +| messages.svg | inbox-cleanup_be27 | +| no-results.svg | not-found_6bgl | +| notes.svg | personal-notes_xrz8 | +| payments.svg | payments_nbqu | +| people.svg | group-project_kow1 | +| schedule.svg | schedule_ry1w | +| whiteboard.svg | blank-canvas_a6x5 | +| work.svg | time-management_4ss6 | diff --git a/src/assets/illustrations/coming-soon.svg b/src/assets/illustrations/coming-soon.svg new file mode 100644 index 0000000..82e6803 --- /dev/null +++ b/src/assets/illustrations/coming-soon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/courses.svg b/src/assets/illustrations/courses.svg new file mode 100644 index 0000000..92baf22 --- /dev/null +++ b/src/assets/illustrations/courses.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/empty.svg b/src/assets/illustrations/empty.svg new file mode 100644 index 0000000..3aa6652 --- /dev/null +++ b/src/assets/illustrations/empty.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/events.svg b/src/assets/illustrations/events.svg new file mode 100644 index 0000000..d898851 --- /dev/null +++ b/src/assets/illustrations/events.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/exams.svg b/src/assets/illustrations/exams.svg new file mode 100644 index 0000000..2b75876 --- /dev/null +++ b/src/assets/illustrations/exams.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/homework.svg b/src/assets/illustrations/homework.svg new file mode 100644 index 0000000..7bbc649 --- /dev/null +++ b/src/assets/illustrations/homework.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/meals.svg b/src/assets/illustrations/meals.svg new file mode 100644 index 0000000..a7819d4 --- /dev/null +++ b/src/assets/illustrations/meals.svg @@ -0,0 +1 @@ +breakfast \ No newline at end of file diff --git a/src/assets/illustrations/messages.svg b/src/assets/illustrations/messages.svg new file mode 100644 index 0000000..d0d2c69 --- /dev/null +++ b/src/assets/illustrations/messages.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/no-results.svg b/src/assets/illustrations/no-results.svg new file mode 100644 index 0000000..f37ffaf --- /dev/null +++ b/src/assets/illustrations/no-results.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/notes.svg b/src/assets/illustrations/notes.svg new file mode 100644 index 0000000..171f996 --- /dev/null +++ b/src/assets/illustrations/notes.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/payments.svg b/src/assets/illustrations/payments.svg new file mode 100644 index 0000000..22a8ac4 --- /dev/null +++ b/src/assets/illustrations/payments.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/people.svg b/src/assets/illustrations/people.svg new file mode 100644 index 0000000..eef33f9 --- /dev/null +++ b/src/assets/illustrations/people.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/schedule.svg b/src/assets/illustrations/schedule.svg new file mode 100644 index 0000000..f92a4dc --- /dev/null +++ b/src/assets/illustrations/schedule.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/whiteboard.svg b/src/assets/illustrations/whiteboard.svg new file mode 100644 index 0000000..7ab1def --- /dev/null +++ b/src/assets/illustrations/whiteboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/illustrations/work.svg b/src/assets/illustrations/work.svg new file mode 100644 index 0000000..bb6d8ed --- /dev/null +++ b/src/assets/illustrations/work.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/courses/course-subjects-panel.tsx b/src/components/courses/course-subjects-panel.tsx index fa55682..589dba1 100644 --- a/src/components/courses/course-subjects-panel.tsx +++ b/src/components/courses/course-subjects-panel.tsx @@ -160,7 +160,7 @@ export function CourseSubjectsPanel(props: { courseId: string; canManage: boolea {error() &&

{error()}

} }> - 0} fallback={}> + 0} fallback={}> diff --git a/src/components/courses/course-teachers-panel.tsx b/src/components/courses/course-teachers-panel.tsx index a15da45..4a3e3d7 100644 --- a/src/components/courses/course-teachers-panel.tsx +++ b/src/components/courses/course-teachers-panel.tsx @@ -114,6 +114,7 @@ export function CourseTeachersPanel(props: { when={props.teachers.length > 0} fallback={ } diff --git a/src/components/dashboard/command-search-field.tsx b/src/components/dashboard/command-search-field.tsx new file mode 100644 index 0000000..4fa5183 --- /dev/null +++ b/src/components/dashboard/command-search-field.tsx @@ -0,0 +1,32 @@ +import { IconSearch } from "@/components/ui/icons"; +import { cn } from "@/lib/cn"; +import { openCommandPalette } from "@/stores/command-palette"; +import { useAuth } from "@/stores/auth-context"; +import { useT } from "@/stores/preferences-context"; + +/** The home page's search field: the one visible door into the command + * palette now that the topbar no longer carries it (Ctrl/Cmd K still works). */ +export function CommandSearchField(props: { class?: string }) { + const t = useT(); + const auth = useAuth(); + const placeholder = () => + auth.user()?.role === "admin" ? t("dashboard.hero.searchPlaceholderAdmin") : t("dashboard.hero.searchPlaceholderAll"); + + return ( + + ); +} diff --git a/src/components/homework/course-homework-panel.tsx b/src/components/homework/course-homework-panel.tsx index 57984b1..946aef5 100644 --- a/src/components/homework/course-homework-panel.tsx +++ b/src/components/homework/course-homework-panel.tsx @@ -207,7 +207,7 @@ export function CourseHomeworkPanel(props: { }> - 0} fallback={}> + 0} fallback={}> void navigate({ to: "/homework/$id", params: { id: item.id } })} /> diff --git a/src/components/homework/homework-report-view.tsx b/src/components/homework/homework-report-view.tsx index e1d2bfc..ac607b5 100644 --- a/src/components/homework/homework-report-view.tsx +++ b/src/components/homework/homework-report-view.tsx @@ -89,7 +89,7 @@ export function HomeworkReportView(props: { userId: string }) { return ( }> - 0} fallback={}> + 0} fallback={}> setTab(value as ReportTab)}> {t("common.all")} diff --git a/src/components/layout/app-shell.tsx b/src/components/layout/app-shell.tsx index b316663..045ce4f 100644 --- a/src/components/layout/app-shell.tsx +++ b/src/components/layout/app-shell.tsx @@ -1,4 +1,4 @@ -import { Show, createMemo, createSignal, type ParentProps } from "solid-js"; +import { Show, createEffect, createMemo, createSignal, type ParentProps } from "solid-js"; import { Link, useLocation, useNavigate } from "@tanstack/solid-router"; import { LogoMark } from "@/components/brand/logo-mark"; import { AccountProfileDialog } from "@/components/users/account-profile-dialog"; @@ -13,10 +13,11 @@ import { ShellMessagesButton } from "@/components/layout/shell-messages-button"; import { MobileNavSheet } from "@/components/layout/mobile-nav-sheet"; import { SideNav } from "@/components/layout/side-nav"; import { SidebarAccount } from "@/components/layout/sidebar-account"; -import { IconChevronLeft, IconPanelLeft, IconSearch, IconSparkles } from "@/components/ui/icons"; +import { IconChevronLeft, IconSparkles } from "@/components/ui/icons"; import { Toaster } from "@/components/ui/toast"; import { useAuth } from "@/stores/auth-context"; import { useModules } from "@/stores/modules-context"; +import { commandPaletteOpen, openCommandPalette, setCommandPaletteOpen } from "@/stores/command-palette"; import { ShellFeedProvider } from "@/stores/shell-feed-context"; import { usePreferences, useT } from "@/stores/preferences-context"; import { cn } from "@/lib/cn"; @@ -32,7 +33,6 @@ export function AppShell(props: ParentProps) { const navigate = useNavigate(); const [mobileOpen, setMobileOpen] = createSignal(false); const [celebiOpen, setCelebiOpen] = createSignal(false); - const [commandOpen, setCommandOpen] = createSignal(false); const [profileOpen, setProfileOpen] = createSignal(false); const collapsed = () => prefs.sidebarCollapsed(); const location = useLocation(); @@ -42,6 +42,12 @@ export function AppShell(props: ParentProps) { const key = routeLabelKey(location().pathname, auth.user()?.role); return key ? t(key) : ""; }); + // One place names the browser tab for every shell route, from the same + // label the header shows. + createEffect(() => { + const label = routeLabel(); + document.title = label ? `${label} · ${t("app.name")}` : t("app.name"); + }); const logout = async () => { await auth.logout(); void navigate({ to: "/login" }); @@ -57,7 +63,7 @@ export function AppShell(props: ParentProps) { @@ -142,22 +141,7 @@ export function AppShell(props: ParentProps) { -
- -
+
@@ -194,14 +178,14 @@ export function AppShell(props: ParentProps) { {/* MobileTabBar stays inside the provider — it is a shell surface, so a useShellFeed() badge there must not throw. */} - setMobileOpen(true)} /> + setMobileOpen(true)} onSearch={openCommandPalette} /> setCelebiOpen(true)} onOpenProfile={() => setProfileOpen(true)} /> diff --git a/src/components/layout/command-palette.tsx b/src/components/layout/command-palette.tsx index 3c22db3..525767c 100644 --- a/src/components/layout/command-palette.tsx +++ b/src/components/layout/command-palette.tsx @@ -1,5 +1,5 @@ import { useNavigate } from "@tanstack/solid-router"; -import { For, Show, createEffect, createMemo, createSignal, onCleanup, onMount } from "solid-js"; +import { For, Show, createEffect, createMemo, createResource, createSignal, onCleanup, onMount } from "solid-js"; import { Dialog, DialogContent, DialogDescription, DialogTitle } from "@/components/ui/dialog"; import { IconBook, @@ -17,6 +17,7 @@ import { IconUsers, IconX, } from "@/components/ui/icons"; +import { getUserSearch } from "@/api/users"; import { HOME_ITEM, visibleNavGroups } from "@/components/layout/nav-items"; import { hasMinRole } from "@/lib/roles"; import { useAuth } from "@/stores/auth-context"; @@ -31,7 +32,7 @@ export type CommandPaletteProps = { onOpenProfile?: () => void; }; -type CommandCategory = "actions" | "pages" | "system"; +type CommandCategory = "people" | "actions" | "pages" | "system"; type CommandItem = { id: string; @@ -60,6 +61,22 @@ export function CommandPalette(props: CommandPaletteProps) { const role = () => auth.user()?.role; + // Student lookup moved here from the dashboard hero. `/users/search` is the + // app's only search endpoint and the user detail page is admin-only, so the + // "people" section exists for admins alone. + const [peopleQuery, setPeopleQuery] = createSignal(""); + let peopleDebounce: ReturnType | undefined; + createEffect(() => { + const q = query().trim(); + clearTimeout(peopleDebounce); + peopleDebounce = setTimeout(() => setPeopleQuery(q.length >= 2 ? q : ""), 250); + }); + onCleanup(() => clearTimeout(peopleDebounce)); + const [people] = createResource( + () => (props.open && role() === "admin" && peopleQuery() ? peopleQuery() : null), + (q) => getUserSearch(q, undefined, "student", { limit: 6 }), + ); + const items = createMemo(() => { const list: CommandItem[] = []; const userRole = role(); @@ -269,11 +286,21 @@ export function CommandPalette(props: CommandPaletteProps) { const filteredItems = createMemo(() => { const q = query().trim().toLocaleLowerCase(prefs.locale()); if (!q) return items(); - return items().filter((item) => + const peopleLabel = t("command.group.people"); + const found: CommandItem[] = (people.latest?.items ?? []).map((person) => ({ + id: `person-${person.id}`, + category: "people", + categoryLabel: peopleLabel, + title: person.display_name || person.username, + description: person.username, + icon: IconUsers, + onSelect: () => void navigate({ to: "/admin/users/$id", params: { id: person.id } }), + })); + return [...found, ...items().filter((item) => `${item.title} ${item.description ?? ""} ${item.keywords ?? ""} ${item.categoryLabel}` .toLocaleLowerCase(prefs.locale()) .includes(q), - ); + )]; }); // Group items by category while preserving single flat index order for keyboard navigation @@ -290,7 +317,7 @@ export function CommandPalette(props: CommandPaletteProps) { map.get(item.category)!.push({ item, globalIndex: idx }); }); - const order: CommandCategory[] = ["actions", "pages", "system"]; + const order: CommandCategory[] = ["people", "actions", "pages", "system"]; for (const cat of order) { const itemsInCat = map.get(cat); if (itemsInCat && itemsInCat.length > 0) { diff --git a/src/components/layout/mobile-tab-bar.tsx b/src/components/layout/mobile-tab-bar.tsx index 5472ebd..3107d1a 100644 --- a/src/components/layout/mobile-tab-bar.tsx +++ b/src/components/layout/mobile-tab-bar.tsx @@ -1,13 +1,13 @@ import { For } from "solid-js"; import { Link, useRouterState } from "@tanstack/solid-router"; -import { IconMenu } from "@/components/ui/icons"; +import { IconMenu, IconSearch } from "@/components/ui/icons"; import { primaryNavItems, primaryPathActive } from "@/components/layout/nav-items"; import { cn } from "@/lib/cn"; import { useAuth } from "@/stores/auth-context"; import { useModules } from "@/stores/modules-context"; import { useT } from "@/stores/preferences-context"; -export function MobileTabBar(props: { onMenu: () => void }) { +export function MobileTabBar(props: { onMenu: () => void; onSearch: () => void }) { const auth = useAuth(); const t = useT(); const modules = useModules(); @@ -21,7 +21,7 @@ export function MobileTabBar(props: { onMenu: () => void }) { >
    {(item) => { @@ -45,6 +45,19 @@ export function MobileTabBar(props: { onMenu: () => void }) { ); }} +
  • + +
- }> 0} fallback={}> + }> 0} fallback={}> diff --git a/src/pages/dashboard-page.tsx b/src/pages/dashboard-page.tsx index 7c11e0c..3a065e7 100644 --- a/src/pages/dashboard-page.tsx +++ b/src/pages/dashboard-page.tsx @@ -1,4 +1,4 @@ -import { For, Show, Suspense, createEffect, createMemo, createResource, createSignal, onCleanup, type Component } from "solid-js"; +import { For, Show, Suspense, createEffect, createMemo, createResource, createSignal, type Component } from "solid-js"; import { useNavigate } from "@tanstack/solid-router"; import type { ColumnDef } from "@tanstack/solid-table"; import type { Role } from "@/api/client"; @@ -15,7 +15,7 @@ import { getPaymentStatementByUserId } from "@/api/payments"; import { getPomodoroMe } from "@/api/pomodoro"; import { getMyAttendance, getMyCourses, getMyMarks, getUserAttendance } from "@/api/reports"; import { getTime } from "@/api/time/getTime"; -import { getUsers, getUserSearch } from "@/api/users"; +import { getUsers } from "@/api/users"; import { RouteGuard } from "@/components/layout/route-guard"; import { Badge } from "@/components/ui/badge"; import { ComingSoonBadge, ComingSoonPanel } from "@/components/ui/coming-soon"; @@ -24,6 +24,7 @@ import { ChartHeatmap, type HeatmapEntry } from "@/components/ui/chart-heatmap"; import { ChartLine } from "@/components/ui/chart-line"; import { ChartProgressRing } from "@/components/ui/chart-progress-ring"; import { DataTable } from "@/components/ui/data-table"; +import { CommandSearchField } from "@/components/dashboard/command-search-field"; import { QuickLinkColumn, type QuickLinkRow } from "@/components/dashboard/quick-link-column"; import { StatTile } from "@/components/dashboard/stat-tile"; import { @@ -34,7 +35,6 @@ import { IconClock, IconExam, IconHomework, - IconSearch, IconUsers, IconUtensils, IconPackage, @@ -336,23 +336,6 @@ function DashboardContent() { }); }); - // Hero search. `/users/search` is the only search endpoint the app has, so - // this box only ever finds students — it never claims to search classes, - // exams, or modules the way the Figma copy does. - const [searchInput, setSearchInput] = createSignal(""); - const [searchQuery, setSearchQuery] = createSignal(""); - let searchDebounce: ReturnType | undefined; - const onSearchInput = (value: string) => { - setSearchInput(value); - clearTimeout(searchDebounce); - searchDebounce = setTimeout(() => setSearchQuery(value.trim()), 250); - }; - onCleanup(() => clearTimeout(searchDebounce)); - const [searchResults] = createResource( - () => (isAdminHome() && searchQuery() ? searchQuery() : null), - (q) => getUserSearch(q, undefined, "student", { limit: 6 }), - ); - const fullName = () => [user().name, user().surname].filter(Boolean).join(" ") || user().username; const now = () => clock()?.now ?? Date.now(); @@ -647,6 +630,7 @@ function DashboardContent() {

{t("dashboard.welcomeBack", { name: fullName() })}

{t("dashboard.welcomeHint")}

+
{t(roleKeys[role()])} @@ -667,37 +651,7 @@ function DashboardContent() {

{t("dashboard.hero.heading")}

-
- - onSearchInput(event.currentTarget.value)} - placeholder={t("dashboard.hero.searchPlaceholder")} - class="h-[46px] w-full rounded-lg border border-border-line bg-surface-base pl-11 pr-4 text-sm text-text-default shadow-sm placeholder:text-text-placeholder focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring" - /> - -
- 0} - fallback={

{t("dashboard.hero.searchEmpty")}

} - > - - {(person) => ( - - )} - -
-
-
-
+
}> {formatApiError(marks.error)}}> - }> + }> {(report) => } diff --git a/src/pages/meal-detail-page.tsx b/src/pages/meal-detail-page.tsx index d1fe688..149e289 100644 --- a/src/pages/meal-detail-page.tsx +++ b/src/pages/meal-detail-page.tsx @@ -227,7 +227,7 @@ function MealDetailContent() { )}
- +

{activeBooking() ? t("meals.booked") : t("meals.notBooked")}

{cutoffClosed() ? t("meals.cutoffPassed") : t("meals.bookingHelp")}

diff --git a/src/pages/my-students-page.tsx b/src/pages/my-students-page.tsx index 1c06b30..d134573 100644 --- a/src/pages/my-students-page.tsx +++ b/src/pages/my-students-page.tsx @@ -74,7 +74,7 @@ function MyStudentsContent() { }> - 0} fallback={}> + 0} fallback={}>
{(student) => ( diff --git a/src/pages/payment-statement-page.tsx b/src/pages/payment-statement-page.tsx index 6022358..8bd05f3 100644 --- a/src/pages/payment-statement-page.tsx +++ b/src/pages/payment-statement-page.tsx @@ -161,7 +161,7 @@ function StatementContent() { void refetch()} /> - 0} fallback={}> + 0} fallback={}> void refetchStudents()} /> - 0} fallback={}> + 0} fallback={}> 0} fallback={
- +
@@ -765,7 +765,7 @@ function PaymentsContent() { void refetchPlans()} /> - 0} fallback={}> + 0} fallback={}> diff --git a/src/pages/question-bank-page.tsx b/src/pages/question-bank-page.tsx index 0c46e9e..7f07187 100644 --- a/src/pages/question-bank-page.tsx +++ b/src/pages/question-bank-page.tsx @@ -38,9 +38,6 @@ function QuestionBankContent() { const auth = useAuth(); const navigate = useNavigate(); const t = useT(); - createEffect(() => { - document.title = `${t("nav.questionBank")} · Hezarfen`; - }); const [bankTab, setBankTab] = createSignal<"all" | "mine" | "school">("all"); const ownerFilter = () => (bankTab() === "mine" ? "me" : "all") as "all" | "me"; const visibilityFilter = () => (bankTab() === "school" ? "school" : "all") as "all" | "private" | "school"; diff --git a/src/pages/questions-page.tsx b/src/pages/questions-page.tsx index 42ecf24..e25fd41 100644 --- a/src/pages/questions-page.tsx +++ b/src/pages/questions-page.tsx @@ -110,7 +110,7 @@ function QuestionsContent() {
}> - 0} fallback={}> + 0} fallback={}>
{(question) => ( diff --git a/src/pages/staff-work-page.tsx b/src/pages/staff-work-page.tsx index b71fd34..bb42997 100644 --- a/src/pages/staff-work-page.tsx +++ b/src/pages/staff-work-page.tsx @@ -308,7 +308,7 @@ function StaffWorkContent() { /> }> - 0} fallback={}> + 0} fallback={}>
{(person) => ( @@ -348,7 +348,7 @@ function StaffWorkContent() { }> 0} - fallback={} + fallback={} >
diff --git a/src/pages/terms-page.tsx b/src/pages/terms-page.tsx index 0918124..7a9b32c 100644 --- a/src/pages/terms-page.tsx +++ b/src/pages/terms-page.tsx @@ -230,6 +230,7 @@ function TermsContent() { when={terms().length > 0} fallback={ } diff --git a/src/pages/whiteboards-page.tsx b/src/pages/whiteboards-page.tsx index b99feb0..4d58637 100644 --- a/src/pages/whiteboards-page.tsx +++ b/src/pages/whiteboards-page.tsx @@ -75,7 +75,7 @@ function WhiteboardsContent() { 0} - fallback={} + fallback={} >
- 0} fallback={}> + 0} fallback={}>
{(board) => ( diff --git a/src/pages/work-log-page.tsx b/src/pages/work-log-page.tsx index 00a1a41..c49d2c0 100644 --- a/src/pages/work-log-page.tsx +++ b/src/pages/work-log-page.tsx @@ -128,7 +128,7 @@ function WorkLogContent() { 0} - fallback={} + fallback={} >