// Adapted from eurosky-social/eurosky-social-app (MIT), eurosky/fork. import {useState} from 'react' import {useWindowDimensions, View} from 'react-native' import {Trans, useLingui} from '@lingui/react/macro' import {atoms as a, useTheme, web} from '#/alf' import {Button, ButtonIcon, ButtonText} from '#/components/Button' import * as Dialog from '#/components/Dialog' import * as Toggle from '#/components/forms/Toggle' import { ChevronBottom_Stroke2_Corner0_Rounded as ChevronDownIcon, ChevronTop_Stroke2_Corner0_Rounded as ChevronUpIcon, } from '#/components/icons/Chevron' import {Text} from '#/components/Typography' import {KeyboardKey} from './KeyboardKey' import {useKeyboardShortcutsPreference} from './preferences' export function KeyboardShortcutsDialog({ control, onOpen, onClose, }: { control: Dialog.DialogControlProps onOpen?: () => void onClose?: () => void }) { return ( ) } function KeyboardShortcutsDialogInner() { const {t: l} = useLingui() const t = useTheme() const {enabled, setEnabled} = useKeyboardShortcutsPreference() const {width} = useWindowDimensions() const twoColumns = width >= 900 return ( Keyboard shortcuts Navigate and interact without needing a mouse! Enable app keyboard shortcuts You can turn app shortcuts back on later in Settings → Accessibility. ']} shortcutLabel={l`less than or greater than`} label={l`Decrease or increase video playback speed`} /> ) } function ShortcutGroup({ title, children, }: { title: string children: React.ReactNode }) { const {t: l} = useLingui() const t = useTheme() const [expanded, setExpanded] = useState(true) return ( {expanded && {children}} ) } function ShortcutRow({ shortcut, shortcutLabel, note, label, }: { shortcut: string | (string | {separator: string})[] shortcutLabel?: string note?: string label: string }) { const t = useTheme() return ( {label} {note && ( {note} )} {(typeof shortcut === 'string' ? [shortcut] : shortcut).map( (part, index) => typeof part === 'string' ? ( {part} ) : ( {part.separator} ), )} ) }