💬 drop Çelebi starter suggestion cards for an illustrated empty state
Browse files at this commit9e04469692af14a16b8ad63c0fbc3d50f382c28bParent: 4e0a329- style
- 💬 drop Çelebi starter suggestion cards for an illustrated empty state
4 changed files +8 -85
- src/components/layout/celebi-panel.tsx +3 -12
- src/components/layout/celebi-suggestions.tsx +0 -34
- src/components/ui/empty-inline.tsx +5 -3
- src/i18n/messages.ts +0 -36
src/components/layout/celebi-panel.tsxmodified+3 -12
| @@ -5,10 +5,10 @@ import { formatApiError } from "@/api/client"; | |||
| 5 | import { CelebiComposer } from "@/components/layout/celebi-composer"; | 5 | import { CelebiComposer } from "@/components/layout/celebi-composer"; |
| 6 | import { CelebiMarkdown } from "@/components/layout/celebi-markdown"; | 6 | import { CelebiMarkdown } from "@/components/layout/celebi-markdown"; |
| 7 | import { CelebiReplyActions } from "@/components/layout/celebi-reply-actions"; | 7 | import { CelebiReplyActions } from "@/components/layout/celebi-reply-actions"; |
| 8 | -import { CelebiSuggestions } from "@/components/layout/celebi-suggestions"; | ||
| 9 | import { CelebiThinkingLabel } from "@/components/layout/celebi-thinking-label"; | 8 | import { CelebiThinkingLabel } from "@/components/layout/celebi-thinking-label"; |
| 10 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 9 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 11 | -import { IconAlert, IconBotSquare, IconCopy, IconEdit, IconPlus, IconSparkles, IconTrash } from "@/components/ui/icons"; | 10 | +import { EmptyInline } from "@/components/ui/empty-inline"; |
| 11 | +import { IconAlert, IconBotSquare, IconCopy, IconEdit, IconPlus, IconTrash } from "@/components/ui/icons"; | ||
| 12 | import { SidePanel } from "@/components/ui/side-panel"; | 12 | import { SidePanel } from "@/components/ui/side-panel"; |
| 13 | import { cn } from "@/lib/cn"; | 13 | import { cn } from "@/lib/cn"; |
| 14 | import { usePreferences, useT } from "@/stores/preferences-context"; | 14 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| @@ -244,16 +244,7 @@ export function CelebiPanel(props: { open: boolean; onOpenChange: (open: boolean | |||
| 244 | <Show | 244 | <Show |
| 245 | when={messages().length > 0} | 245 | when={messages().length > 0} |
| 246 | fallback={ | 246 | fallback={ |
| 247 | - <div class="space-y-3"> | 247 | + <EmptyInline class="h-full py-10" size="md" illustration="messages" title={t("ai.title")} hint={t("ai.empty")} /> |
| 248 | - <div class="relative overflow-hidden rounded-lg border border-border bg-card px-5 py-8 text-center text-sm text-muted-foreground"> | ||
| 249 | - <div class="absolute inset-x-8 top-0 h-px bg-gradient-to-r from-transparent via-primary/60 to-transparent" /> | ||
| 250 | - <span class="mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-primary/10 text-primary ring-1 ring-primary/20"> | ||
| 251 | - <IconSparkles class="h-5 w-5" /> | ||
| 252 | - </span> | ||
| 253 | - {t("ai.empty")} | ||
| 254 | - </div> | ||
| 255 | - <CelebiSuggestions onPick={(text) => void send(text)} /> | ||
| 256 | - </div> | ||
| 257 | } | 248 | } |
| 258 | > | 249 | > |
| 259 | <div class="flex flex-col gap-3"> | 250 | <div class="flex flex-col gap-3"> |
src/components/layout/celebi-suggestions.tsxdeleted+0 -34
| @@ -1,34 +0,0 @@ | |||
| 1 | -import { For } from "solid-js"; | ||
| 2 | -import type { MessageKey } from "@/i18n/messages"; | ||
| 3 | -import { useAuth } from "@/stores/auth-context"; | ||
| 4 | -import { useT } from "@/stores/preferences-context"; | ||
| 5 | - | ||
| 6 | -const STUDENT_KEYS: MessageKey[] = ["ai.suggest1", "ai.suggest2", "ai.suggest3", "ai.suggest4"]; | ||
| 7 | -const STAFF_KEYS: MessageKey[] = ["ai.suggestStaff1", "ai.suggestStaff2", "ai.suggestStaff3", "ai.suggestStaff4"]; | ||
| 8 | -const PARENT_KEYS: MessageKey[] = ["ai.suggestParent1", "ai.suggestParent2", "ai.suggestParent3", "ai.suggestParent4"]; | ||
| 9 | - | ||
| 10 | -export function CelebiSuggestions(props: { onPick: (text: string) => void }) { | ||
| 11 | - const t = useT(); | ||
| 12 | - const auth = useAuth(); | ||
| 13 | - const keys = () => { | ||
| 14 | - const role = auth.user()?.role; | ||
| 15 | - if (role === "parent") return PARENT_KEYS; | ||
| 16 | - if (role === "teacher" || role === "manager" || role === "admin") return STAFF_KEYS; | ||
| 17 | - return STUDENT_KEYS; | ||
| 18 | - }; | ||
| 19 | - return ( | ||
| 20 | - <div class="grid gap-2 sm:grid-cols-2"> | ||
| 21 | - <For each={keys()}> | ||
| 22 | - {(key) => ( | ||
| 23 | - <button | ||
| 24 | - type="button" | ||
| 25 | - class="rounded-xl border border-border bg-card px-3 py-2.5 text-left text-xs leading-5 text-foreground shadow-xs transition-all hover:border-primary/40 hover:bg-muted active:scale-[0.98] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring" | ||
| 26 | - onClick={() => props.onPick(t(key))} | ||
| 27 | - > | ||
| 28 | - {t(key)} | ||
| 29 | - </button> | ||
| 30 | - )} | ||
| 31 | - </For> | ||
| 32 | - </div> | ||
| 33 | - ); | ||
| 34 | -} | ||
src/components/ui/empty-inline.tsxmodified+5 -3
| @@ -9,15 +9,17 @@ export function EmptyInline(props: { | |||
| 9 | title: string; | 9 | title: string; |
| 10 | hint?: string; | 10 | hint?: string; |
| 11 | illustration?: IllustrationName; | 11 | illustration?: IllustrationName; |
| 12 | + /** "md" for roomy containers such as a side panel. */ | ||
| 13 | + size?: "sm" | "md"; | ||
| 12 | class?: string; | 14 | class?: string; |
| 13 | }) { | 15 | }) { |
| 14 | return ( | 16 | return ( |
| 15 | <div class={cn("flex flex-col items-center justify-center gap-2 px-4 py-5 text-center", props.class)}> | 17 | <div class={cn("flex flex-col items-center justify-center gap-2 px-4 py-5 text-center", props.class)}> |
| 16 | - <Illustration name={props.illustration ?? "empty"} class="h-16 w-24" /> | 18 | + <Illustration name={props.illustration ?? "empty"} class={props.size === "md" ? "h-32 w-48" : "h-16 w-24"} /> |
| 17 | <div> | 19 | <div> |
| 18 | - <p class="text-xs font-semibold text-foreground/80">{props.title}</p> | 20 | + <p class={cn("font-semibold text-foreground/80", props.size === "md" ? "text-sm" : "text-xs")}>{props.title}</p> |
| 19 | <Show when={props.hint}> | 21 | <Show when={props.hint}> |
| 20 | - <p class="mt-0.5 text-[11px] text-muted-foreground">{props.hint}</p> | 22 | + <p class={cn("mt-0.5 text-muted-foreground", props.size === "md" ? "mx-auto max-w-xs text-xs" : "text-[11px]")}>{props.hint}</p> |
| 21 | </Show> | 23 | </Show> |
| 22 | </div> | 24 | </div> |
| 23 | </div> | 25 | </div> |
src/i18n/messages.tsmodified+0 -36
| @@ -22,18 +22,6 @@ export type MessageKey = | |||
| 22 | | "ai.thinking2" | 22 | | "ai.thinking2" |
| 23 | | "ai.thinking3" | 23 | | "ai.thinking3" |
| 24 | | "ai.hint" | 24 | | "ai.hint" |
| 25 | - | "ai.suggest1" | ||
| 26 | - | "ai.suggest2" | ||
| 27 | - | "ai.suggest3" | ||
| 28 | - | "ai.suggest4" | ||
| 29 | - | "ai.suggestStaff1" | ||
| 30 | - | "ai.suggestStaff2" | ||
| 31 | - | "ai.suggestStaff3" | ||
| 32 | - | "ai.suggestStaff4" | ||
| 33 | - | "ai.suggestParent1" | ||
| 34 | - | "ai.suggestParent2" | ||
| 35 | - | "ai.suggestParent3" | ||
| 36 | - | "ai.suggestParent4" | ||
| 37 | | "ai.goTo" | 25 | | "ai.goTo" |
| 38 | | "ai.didYouMean" | 26 | | "ai.didYouMean" |
| 39 | | "ai.skipTyping" | 27 | | "ai.skipTyping" |
| @@ -1890,18 +1878,6 @@ const en: Dict = { | |||
| 1890 | "ai.thinking2": "Looking into it…", | 1878 | "ai.thinking2": "Looking into it…", |
| 1891 | "ai.thinking3": "Almost there…", | 1879 | "ai.thinking3": "Almost there…", |
| 1892 | "ai.hint": "Enter to send · Shift+Enter for a new line · AI-generated", | 1880 | "ai.hint": "Enter to send · Shift+Enter for a new line · AI-generated", |
| 1893 | - "ai.suggest1": "What are my classes today?", | ||
| 1894 | - "ai.suggest2": "Which exams are coming up?", | ||
| 1895 | - "ai.suggest3": "Do I have any missing homework?", | ||
| 1896 | - "ai.suggest4": "How is my attendance this term?", | ||
| 1897 | - "ai.suggestStaff1": "What is on the schedule today?", | ||
| 1898 | - "ai.suggestStaff2": "Which exams are coming up?", | ||
| 1899 | - "ai.suggestStaff3": "Which students have low attendance?", | ||
| 1900 | - "ai.suggestStaff4": "Summarize this week's events.", | ||
| 1901 | - "ai.suggestParent1": "What are my child's classes today?", | ||
| 1902 | - "ai.suggestParent2": "Which exams does my child have soon?", | ||
| 1903 | - "ai.suggestParent3": "How is my child's attendance this term?", | ||
| 1904 | - "ai.suggestParent4": "What is on this week's meal menu?", | ||
| 1905 | "ai.goTo": "Go to the page", | 1881 | "ai.goTo": "Go to the page", |
| 1906 | "ai.didYouMean": "Did you mean one of these?", | 1882 | "ai.didYouMean": "Did you mean one of these?", |
| 1907 | "ai.skipTyping": "Show the whole answer", | 1883 | "ai.skipTyping": "Show the whole answer", |
| @@ -3769,18 +3745,6 @@ const tr: Dict = { | |||
| 3769 | "ai.thinking2": "Araştırıyor…", | 3745 | "ai.thinking2": "Araştırıyor…", |
| 3770 | "ai.thinking3": "Neredeyse hazır…", | 3746 | "ai.thinking3": "Neredeyse hazır…", |
| 3771 | "ai.hint": "Enter gönder · Shift+Enter alt satır · Yapay zekâ üretimi", | 3747 | "ai.hint": "Enter gönder · Shift+Enter alt satır · Yapay zekâ üretimi", |
| 3772 | - "ai.suggest1": "Bugün hangi derslerim var?", | ||
| 3773 | - "ai.suggest2": "Yaklaşan sınavlarım neler?", | ||
| 3774 | - "ai.suggest3": "Eksik ödevim var mı?", | ||
| 3775 | - "ai.suggest4": "Bu dönem devamsızlığım nasıl?", | ||
| 3776 | - "ai.suggestStaff1": "Bugün programda neler var?", | ||
| 3777 | - "ai.suggestStaff2": "Yaklaşan sınavlar neler?", | ||
| 3778 | - "ai.suggestStaff3": "Hangi öğrencilerin devamsızlığı yüksek?", | ||
| 3779 | - "ai.suggestStaff4": "Bu haftanın etkinliklerini özetle.", | ||
| 3780 | - "ai.suggestParent1": "Çocuğumun bugün hangi dersleri var?", | ||
| 3781 | - "ai.suggestParent2": "Çocuğumun yaklaşan sınavları neler?", | ||
| 3782 | - "ai.suggestParent3": "Çocuğumun bu dönem devamsızlığı nasıl?", | ||
| 3783 | - "ai.suggestParent4": "Bu haftanın yemek menüsünde ne var?", | ||
| 3784 | "ai.goTo": "Sayfaya git", | 3748 | "ai.goTo": "Sayfaya git", |
| 3785 | "ai.didYouMean": "Bunu mu demek istedin?", | 3749 | "ai.didYouMean": "Bunu mu demek istedin?", |
| 3786 | "ai.skipTyping": "Cevabın tamamını göster", | 3750 | "ai.skipTyping": "Cevabın tamamını göster", |