"use client"; import { useCallback, useState } from "react"; import { toolGroups } from "@/config/tools"; import { safeDecodeURIComponent, safeEncodeURIComponent } from "@/lib/uri"; import { Textarea, TextareaProps } from "@/components/ui/textarea"; import { ClearButton } from "@/components/buttons/clear"; import { CopyButton } from "@/components/buttons/copy"; import { FileButton } from "@/components/buttons/file"; import { PasteButton } from "@/components/buttons/paste"; import { ControlMenu } from "@/components/control-menu"; import { PageRootSection } from "@/components/page-root-section"; import { PageSection } from "@/components/page-section"; export default function Page() { const [form, setForm] = useState({ decoded: '> It\'s "URL encoding"?', encoded: "%3E%20It's%20%22URL%20encoding%22%3F", }); const setDecodedReactively = useCallback((text: string) => { setForm({ decoded: text, encoded: safeEncodeURIComponent(text).unwrapOr(""), }); }, []); const setEncodedReactively = useCallback((text: string) => { setForm({ encoded: text, decoded: safeDecodeURIComponent(text).unwrapOr(""), }); }, []); const clearBoth = useCallback(() => { setForm({ decoded: "", encoded: "", }); }, []); const onDecodedChange: TextareaProps["onChange"] = ({ currentTarget: { value } }) => setDecodedReactively(value); const onEncodedChange: TextareaProps["onChange"] = ({ currentTarget: { value } }) => setEncodedReactively(value); const decodedPasteButton = ; const encodedPasteButton = ; const decodedFileButton = ( ); const encodedFileButton = ( ); const decodedCopyButton = ; const encodedCopyButton = ; const clearButton = ( ); const decodedControl = ( ); const encodedControl = ( ); return (