forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB4e0a329Burak Boduroğlu2 months ago537 commits

note-reader-panel.tsx49 lines, 2.3 KiBHistoryRawDownload
1import { Show } from "solid-js";
2import type { Note } from "@/api/client";
3import type { NoteFileSource } from "@/lib/note-source";
4import { NoteFilesPanel } from "@/components/notes/note-files-panel";
5import { RagOutputsPanel } from "@/components/notes/rag-outputs-panel";
6import { SidePanel } from "@/components/ui/side-panel";
7import { useT } from "@/stores/preferences-context";
8
9export function NoteReaderPanel(props: {
10 note: Note | null;
11 source: NoteFileSource;
12 /** Read-only file section when false. Defaults to true. */
13 canManage?: boolean;
14 open: boolean;
15 onOpenChange: (open: boolean) => void;
16}) {
17 const t = useT();
18 const note = () => props.note;
19
20 return (
21 <SidePanel
22 open={props.open && note() != null}
23 onOpenChange={props.onOpenChange}
24 title={note()?.title ?? t("notes.title")}
25 size="wide"
26 >
27 <Show when={note()}>
28 {(n) => (
29 <div class="space-y-4">
30 <article class="overflow-hidden rounded-lg border border-amber-200/70 bg-[linear-gradient(90deg,rgba(245,158,11,0.14)_0,rgba(245,158,11,0.14)_3rem,transparent_3rem),repeating-linear-gradient(0deg,transparent_0,transparent_2.45rem,rgba(120,113,108,0.16)_2.5rem)] shadow-xs dark:border-amber-500/20 dark:bg-[linear-gradient(90deg,rgba(245,158,11,0.12)_0,rgba(245,158,11,0.12)_3rem,transparent_3rem),repeating-linear-gradient(0deg,transparent_0,transparent_2.45rem,rgba(214,211,209,0.12)_2.5rem)]">
31 <div class="min-h-80 space-y-4 px-5 py-5 pl-16">
32 <Show
33 when={note()?.content?.trim()}
34 fallback={<p class="text-sm italic leading-8 text-muted-foreground">{t("notes.noContent")}</p>}
35 >
36 <div class="whitespace-pre-wrap text-sm leading-8 text-foreground [&_ol]:ml-5 [&_ol]:list-decimal [&_ul]:ml-5 [&_ul]:list-disc" innerHTML={note()?.content ?? ""} />
37 </Show>
38 </div>
39 </article>
40 <NoteFilesPanel noteId={n().id} source={props.source} canManage={props.canManage} active={props.open} />
41 <Show when={props.source.listRagOutputs}>
42 <RagOutputsPanel noteId={n().id} source={props.source} canManage={props.canManage} active={props.open} />
43 </Show>
44 </div>
45 )}
46 </Show>
47 </SidePanel>
48 );
49}