"use client"; import { useCallback, useMemo, useState } from "react"; import { Panel, PanelGroup } from "react-resizable-panels"; import { PERSISTENCE_KEY } from "@/config/persistence-keys"; import { toolGroups } from "@/config/tools"; import { DiffEditor } from "@/components/ui/diff-editor"; import { Editor } from "@/components/ui/editor"; import * as Button from "@/components/buttons"; import { Configuration } from "@/components/configuration"; import { Configurations } from "@/components/configurations"; import { ControlMenu } from "@/components/control-menu"; import * as icons from "@/components/icons"; import { LabeledSwitch } from "@/components/labeled-switch"; import { PageRootSection } from "@/components/page-root-section"; import { PageSection } from "@/components/page-section"; import { PanelResizeHandle } from "@/components/panel-resize-handler"; /** No particular reason for these sizes, just feels like a good balance */ const VERTICAL_PANEL_MAX_SIZE = 80; const HORIZONTAL_PANEL_MAX_SIZE = 90; const PANEL_FULL_SIZE = 100; export default function Page() { const [input1, setInput1] = useState("Hello world"); const [input2, setInput2] = useState("Hello, World!"); const [diffFullHeight, setDiffFullHeight] = useState(false); const [inlineMode, setInlineMode] = useState(false); const diffPanelMaxSize = useMemo( () => (diffFullHeight ? PANEL_FULL_SIZE : VERTICAL_PANEL_MAX_SIZE), [diffFullHeight] ); const clearInput1 = useCallback(() => setInput1(""), [setInput1]); const clearInput2 = useCallback(() => setInput2(""), [setInput2]); const toggleFullHeight = useCallback(() => setDiffFullHeight(prev => !prev), [setDiffFullHeight]); const inlineModeConfig = useMemo( () => ( } title="Inline mode" control={ } /> ), [inlineMode, setInlineMode] ); const input1Control = useMemo( () => ( , , , ]} /> ), [setInput1, clearInput1] ); const input2Control = useMemo( () => ( , , , ]} /> ), [setInput2, clearInput2] ); const diffControl = useMemo( () => ( , ]} /> ), [diffFullHeight, toggleFullHeight] ); const hiddenInFullHeightMode = useMemo(() => (diffFullHeight ? "hidden" : ""), [diffFullHeight]); return ( ); }