| 1 | import type React from 'react' |
| 2 | import { Home } from 'lucide-react' |
| 3 | import { GenerationLogPanel } from './GenerationLogPanel' |
| 4 | import type { GenerationLogEvent, GenerationRunStatus } from './types' |
| 5 | |
| 6 | export function GenerationSidebar({ |
| 7 | title, |
| 8 | backHomeLabel, |
| 9 | logTitle, |
| 10 | pageCountLabel, |
| 11 | growingLabel, |
| 12 | failedLabel, |
| 13 | events, |
| 14 | status, |
| 15 | onBackHome, |
| 16 | viewportRef, |
| 17 | onViewportScroll |
| 18 | }: { |
| 19 | title: string |
| 20 | backHomeLabel: string |
| 21 | logTitle: string |
| 22 | pageCountLabel: string |
| 23 | growingLabel: string |
| 24 | failedLabel: string |
| 25 | events: GenerationLogEvent[] |
| 26 | status: GenerationRunStatus |
| 27 | onBackHome: () => void |
| 28 | viewportRef?: React.Ref<HTMLDivElement> |
| 29 | onViewportScroll?: React.UIEventHandler<HTMLDivElement> |
| 30 | }): React.JSX.Element { |
| 31 | return ( |
| 32 | <aside className="flex min-h-0 w-full shrink-0 flex-col gap-3 lg:w-[250px]"> |
| 33 | <section className="rounded-lg border border-[#d8ccb5]/78 bg-[#fff9ef]/88 p-3 text-[#435138] shadow-[0_14px_30px_rgba(78,91,63,0.12)]"> |
| 34 | <div className="flex items-center gap-2.5"> |
| 35 | <button |
| 36 | type="button" |
| 37 | onClick={onBackHome} |
| 38 | className="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-[#d8ccb5]/80 bg-[#fffaf1] text-[#5d6b4d] transition-colors hover:bg-[#f4ecd9] hover:text-[#34402c]" |
| 39 | aria-label={backHomeLabel} |
| 40 | title={backHomeLabel} |
| 41 | > |
| 42 | <Home className="h-4 w-4" /> |
| 43 | </button> |
| 44 | <div className="flex min-h-8 min-w-0 flex-1 items-center"> |
| 45 | <h1 className="truncate text-[15px] font-semibold leading-5 text-[#2f3b28]" title={title}> |
| 46 | {title} |
| 47 | </h1> |
| 48 | </div> |
| 49 | </div> |
| 50 | </section> |
| 51 | |
| 52 | <GenerationLogPanel |
| 53 | events={events} |
| 54 | status={status} |
| 55 | pageCountLabel={pageCountLabel} |
| 56 | growingLabel={growingLabel} |
| 57 | failedLabel={failedLabel} |
| 58 | logTitle={logTitle} |
| 59 | viewportRef={viewportRef} |
| 60 | onViewportScroll={onViewportScroll} |
| 61 | /> |
| 62 | </aside> |
| 63 | ) |
| 64 | } |
| 65 |