import { type ReactNode } from "react";
import { Box, Text } from "../../../../ui";
import { SegmentedControl } from "../../../../components";
import { Button } from "../../../../components/ui";
import { colors } from "../../../../theme/colors";
import type {
SeriesEditorActionModel,
SeriesEditorFieldModel,
SeriesEditorFocus,
} from "./model";
function TuiEditorField({
label,
focused,
onFocus,
children,
}: {
label: string;
focused: boolean;
onFocus: () => void;
children: ReactNode;
}) {
return (
{focused ? `› ${label}` : label}
{children}
);
}
export function OpenTuiSeriesEditorFields({
fields,
keyboardFocus,
dialogId,
onFocus,
}: {
fields: SeriesEditorFieldModel[];
keyboardFocus: SeriesEditorFocus;
dialogId?: string;
onFocus: (focus: SeriesEditorFocus) => void;
}) {
return (
<>
{fields.map((field) => {
const focused = keyboardFocus === field.id;
return (
onFocus(field.id)}
>
{field.kind === "panel" ? (
) : (
)}
);
})}
>
);
}
export function OpenTuiSeriesEditorActions({ actions }: { actions: SeriesEditorActionModel[] }) {
// A narrow terminal wraps the row instead of clipping Save off its end.
return (
{actions.map((action) => (
))}
);
}