"use client"; import { useState, useEffect } from "react"; import { motion, AnimatePresence } from "framer-motion"; import { fetchFilteredSpaces } from "@/utils/network"; import { Space as SpaceProps } from "@/utils/types"; import { Space } from "@/components/space"; import { ButtonShuffler } from "./button"; import { Card } from "@/components/animate/card"; export const SpaceBrowser = ({ initialHardwareType = 'gpu', initialSearchQuery = '', }: { initialHardwareType?: 'gpu' | 'cpu'; initialSearchQuery?: string; }) => { const [hardwareType, setHardwareType] = useState<'gpu' | 'cpu'>(initialHardwareType); const [searchQuery, setSearchQuery] = useState(initialSearchQuery); const [spaces, setSpaces] = useState([]); const [index, setIndex] = useState(0); useEffect(() => { fetchFilteredSpaces(hardwareType, searchQuery).then(setSpaces); }, [hardwareType, searchQuery]); return (
setSearchQuery(e.target.value)} className="p-2 border border-gray-300 rounded" />
{spaces.map((space, i) => ( ))}
); };