import { Button } from '@/components/ui/button' import { Label } from '@/components/ui/label' import { Switch } from '@/components/ui/switch' import { useSocialGraphFilter } from '@/providers/SocialGraphFilterProvider' import { Loader2, Minus, Plus } from 'lucide-react' import { useTranslation } from 'react-i18next' const DEPTH_LABELS: Record = { 1: 'Direct follows', 2: 'Follows of follows' } interface SocialGraphFilterProps { temporaryProximity: number | null temporaryIncludeMode: boolean onTemporaryProximityChange: (level: number | null) => void onTemporaryIncludeModeChange: (include: boolean) => void } export default function SocialGraphFilter({ temporaryProximity, temporaryIncludeMode, onTemporaryProximityChange, onTemporaryIncludeModeChange }: SocialGraphFilterProps) { const { t } = useTranslation() const { graphPubkeyCount, isLoading } = useSocialGraphFilter() const isEnabled = temporaryProximity !== null const depth = temporaryProximity ?? 1 const handleToggle = (enabled: boolean) => { onTemporaryProximityChange(enabled ? 1 : null) } const handleIncrease = () => { if (depth < 2) { onTemporaryProximityChange(depth + 1) } } const handleDecrease = () => { if (depth > 1) { onTemporaryProximityChange(depth - 1) } } return (
{isEnabled && ( <> {/* Include/Exclude toggle */}
{/* Depth stepper */}

{t(DEPTH_LABELS[depth])}

{isLoading ? ( {t('Loading...')} ) : ( t('{{count}} users', { count: graphPubkeyCount }) )}

{depth}
{/* Mode description */}

{temporaryIncludeMode ? t('Only show notes from users in your social graph') : t('Hide notes from users in your social graph')}

)}
) }