From ebd3f75804b1be13bcabc9cf63e91c7280f91825 Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Sun, 7 May 2023 14:44:12 +0200 Subject: [PATCH] Added horizontal support for transcript tool --- src/pages/dev/transcript.tsx | 116 +++++++++++++++++++++++------------ 1 file changed, 76 insertions(+), 40 deletions(-) diff --git a/src/pages/dev/transcript.tsx b/src/pages/dev/transcript.tsx index 4891a60..af9c257 100644 --- a/src/pages/dev/transcript.tsx +++ b/src/pages/dev/transcript.tsx @@ -18,9 +18,14 @@ import { cIf, cJoin } from "helpers/className"; * ────────────────────────────────────────╯ CONSTANTS ╰────────────────────────────────────────── */ +type Orientation = "horizontal" | "vertical"; + const textAtom = atomPairing(atomWithStorage("transcriptText", "")); const fontSizeAtom = atomPairing(atomWithStorage("transcriptFontSize", 1)); -const textOffset = atomPairing(atomWithStorage("transcriptTextOffset", 0)); +const textOffsetAtom = atomPairing(atomWithStorage("transcriptTextOffset", 0)); +const orientationAtom = atomPairing( + atomWithStorage("transcriptOrientation", "vertical") +); const SIZE_MULTIPLIER = 1000; @@ -50,7 +55,8 @@ const swapChar = (char: string, swaps: string[]): string => { const Transcript = (props: Props): JSX.Element => { const [text, setText] = useAtomPair(textAtom); const [fontSize, setFontSize] = useAtomPair(fontSizeAtom); - const [xOffset, setXOffset] = useAtomPair(textOffset); + const [offset, setOffset] = useAtomPair(textOffsetAtom); + const [orientation, setOrientation] = useAtomPair(orientationAtom); const [lineIndex, setLineIndex] = useState(0); const textAreaRef = useRef(null); @@ -409,52 +415,32 @@ const Transcript = (props: Props): JSX.Element => { ); const contentPanel = ( - -
-