"use client"; import { useState } from "react"; import { toolGroups } from "@/config/tools"; import { safeJsonParse } from "@/lib/json"; import { Editor, EditorProps } from "@/components/ui/editor"; import * as Select from "@/components/ui/select"; 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 { PageRootSection } from "@/components/page-root-section"; import { PageSection } from "@/components/page-section"; const indentations = { two: " ", four: " ", zero: "", tab: "\t", }; const INDENTATION = { TWO_SPACES: "two", FOUR_SPACES: "four", TAB: "tab", ZERO: "zero", } as const; type Indentation = (typeof INDENTATION)[keyof typeof INDENTATION]; export default function Page() { const [indentation, setIndentation] = useState(INDENTATION.TWO_SPACES); const [input, setInput] = useState('{\n"foo":"bar"\n}'); const parsed = safeJsonParse(input); const output = parsed.map(x => JSON.stringify(x, null, indentations[indentation])).unwrapOr(""); const clearInput = () => setInput(""); // @ts-expect-error react 19 beta error // eslint-disable-next-line @typescript-eslint/no-unsafe-argument const onJsonChange: EditorProps["onChange"] = value => setInput(value ?? ""); const indentationConfig = ( } title="Indentation" control={ setIndentation(value as Indentation)} > 2 spaces 4 spaces 1 tab minified } /> ); const inputPasteButton = ; const inputFileButton = ( ); const inputClearButton = ; const outputCopyButton = ; const inputControl = ; const outputControl = ; return (
{/* @ts-expect-error react 19 beta error */} {/* @ts-expect-error react 19 beta error */}
); }