import { useState } from "react"; import { useCreateSetup, useSetups } from "../hooks/useSetups"; import { SetupCard } from "./SetupCard"; export function SetupsView() { const [newSetupName, setNewSetupName] = useState(""); const { data: setups, isLoading } = useSetups(); const createSetup = useCreateSetup(); function handleCreateSetup(e: React.FormEvent) { e.preventDefault(); const name = newSetupName.trim(); if (!name) return; createSetup.mutate({ name }, { onSuccess: () => setNewSetupName("") }); } return (
{/* Create setup form */}
setNewSetupName(e.target.value)} placeholder="New setup name..." className="flex-1 px-3 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-gray-400 focus:border-transparent" />
{/* Loading skeleton */} {isLoading && (
{[1, 2].map((i) => (
))}
)} {/* Empty state */} {!isLoading && (!setups || setups.length === 0) && (

Build your perfect loadout

1

Create a setup

Name your loadout for a specific trip or activity

2

Add items

Pick gear from your collection to include in the setup

3

Track weight

See weight breakdown and optimize your pack

)} {/* Setup grid */} {!isLoading && setups && setups.length > 0 && (
{setups.map((setup) => ( ))}
)}
); }