import React from 'react'; import { YStack } from '@tamagui/stacks'; import { SizableText as Text } from '@tamagui/text'; import { Button } from '@tamagui/button'; import { useGuestThemeVariant } from '../lib/guestTheme'; export type CompassAction = { key: string; label: string; icon?: React.ReactNode; onPress?: () => void; }; type CompassHubProps = { open: boolean; onOpenChange: (open: boolean) => void; quadrants: [CompassAction, CompassAction, CompassAction, CompassAction]; centerAction: CompassAction; title?: string; }; const quadrantPositions: Array<{ top?: number; right?: number; bottom?: number; left?: number; }> = [ { top: 0, left: 0 }, { top: 0, right: 0 }, { bottom: 0, left: 0 }, { bottom: 0, right: 0 }, ]; export default function CompassHub({ open, onOpenChange, quadrants, centerAction, title = 'Quick jump', }: CompassHubProps) { const close = () => onOpenChange(false); const { isDark } = useGuestThemeVariant(); const [visible, setVisible] = React.useState(open); const [closing, setClosing] = React.useState(false); React.useEffect(() => { if (open) { setVisible(true); setClosing(false); return; } if (!visible) return; setClosing(true); const timeout = window.setTimeout(() => { setVisible(false); setClosing(false); }, 520); return () => { window.clearTimeout(timeout); }; }, [open, visible]); if (!visible) { return null; } return ( {title} {quadrants.map((action, index) => ( ))} Tap outside to close ); }