import React from 'react'; import { XStack, YStack } from '@tamagui/stacks'; import { SizableText as Text } from '@tamagui/text'; import { Button } from '@tamagui/button'; import { X } from 'lucide-react'; import { useGuestThemeVariant } from '../lib/guestTheme'; import { getBentoSurfaceTokens } from '../lib/bento'; 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 bentoSurface = getBentoSurfaceTokens(isDark); const tileShadow = isDark ? '0 10px 0 rgba(2, 6, 23, 0.55), 0 20px 24px rgba(2, 6, 23, 0.45)' : '0 10px 0 rgba(15, 23, 42, 0.18), 0 18px 22px rgba(15, 23, 42, 0.16)'; 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 ( {quadrants.map((action, index) => ( ))} ); }