Open History to see the last commit
1import type { ComponentProps, ReactNode } from "react";
2
3/**
4 * What stands where the composer would for a thread that takes no messages. `children` say what
5 * the thread is and how it is doing; `actions` sit at the trailing edge.
6 */
7export function ReadOnlyComposerBar(props: {
8 readonly children: ReactNode;
9 readonly actions?: ReactNode;
10}) {
11 // Sized by the composer, not the viewport: a docked side panel narrows the
12 // chat column on a wide window, and one row there squeezes out the lead
13 // and status, so the status drops to its own line instead.
14 return (
15 <div className="flex min-h-12 items-center gap-3 rounded-2xl py-2 ps-5 pe-2 text-sm">
16 <div className="flex min-w-0 flex-1 items-center gap-3 @max-[560px]/composer-surface:flex-col @max-[560px]/composer-surface:items-start @max-[560px]/composer-surface:gap-0.5">
17 {props.children}
18 </div>
19 {props.actions}
20 </div>
21 );
22}
23
24/** The bar's first line: an icon and what the thread is. */
25export function ReadOnlyComposerLead(props: { readonly children: ReactNode }) {
26 return <span className="flex min-w-0 max-w-full items-center gap-2">{props.children}</span>;
27}
28
29/** The bar's second line, which drops under the lead in a narrow composer. */
30export function ReadOnlyComposerStatus(props: Omit<ComponentProps<"span">, "className">) {
31 return (
32 <span
33 className="min-w-0 max-w-full truncate text-muted-foreground tabular-nums @max-[560px]/composer-surface:text-xs"
34 {...props}
35 />
36 );
37}