From ee6d57a245b5924fbd2d6c9fbd0ae8640d6dc679 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Tue, 24 Feb 2026 22:34:42 -0800 Subject: [PATCH] chore: remove unused SpaceSwitcher component Co-Authored-By: Claude Opus 4.6 --- frontend/components/SpaceSwitcher.tsx | 115 -------------------------- 1 file changed, 115 deletions(-) delete mode 100644 frontend/components/SpaceSwitcher.tsx diff --git a/frontend/components/SpaceSwitcher.tsx b/frontend/components/SpaceSwitcher.tsx deleted file mode 100644 index f70b491..0000000 --- a/frontend/components/SpaceSwitcher.tsx +++ /dev/null @@ -1,115 +0,0 @@ -'use client'; - -import { useState, useRef, useEffect } from 'react'; -import { getSpaceIdFromCookie } from '@/lib/spaces'; - -const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000/api'; - -interface SpaceItem { - id: string; - name: string; - tagline: string; - domain: string; - logo_url: string | null; -} - -export function SpaceSwitcher() { - const [open, setOpen] = useState(false); - const [spaces, setSpaces] = useState([]); - const [currentSpaceId, setCurrentSpaceId] = useState('default'); - const ref = useRef(null); - - useEffect(() => { - setCurrentSpaceId(getSpaceIdFromCookie()); - }, []); - - useEffect(() => { - fetch(`${API_URL}/spaces`) - .then((res) => (res.ok ? res.json() : [])) - .then((data: SpaceItem[]) => setSpaces(data)) - .catch(() => {}); - }, []); - - useEffect(() => { - function handleClick(e: MouseEvent) { - if (ref.current && !ref.current.contains(e.target as Node)) { - setOpen(false); - } - } - document.addEventListener('click', handleClick); - return () => document.removeEventListener('click', handleClick); - }, []); - - const currentSpace = spaces.find((s) => s.id === currentSpaceId) || { - id: 'default', - name: 'rSwag', - tagline: 'Community Merch, On Demand', - domain: 'rswag.online', - logo_url: null, - }; - - if (spaces.length <= 1) return null; - - return ( -
- - - {open && ( - - )} -
- ); -}