From ad33ad81b260beba372cc155849afc3c31d33ca9 Mon Sep 17 00:00:00 2001 From: human058382928 <162091348+human058382928@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:13:00 -0800 Subject: [PATCH 1/2] add edit crew toggle --- src/components/crews/CrewManagement.tsx | 16 +++------------- src/components/dashboard/Dashboard.tsx | 10 ---------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/src/components/crews/CrewManagement.tsx b/src/components/crews/CrewManagement.tsx index 9f654435..4df74996 100644 --- a/src/components/crews/CrewManagement.tsx +++ b/src/components/crews/CrewManagement.tsx @@ -7,6 +7,7 @@ import { Button } from "@/components/ui/button"; import { Circle, CheckCircle, + Settings, PlusIcon, Trash2Icon, UserIcon, @@ -29,9 +30,7 @@ import { ChatBubbleIcon } from "@radix-ui/react-icons"; export function CrewManagement({ initialCrews, - onCrewSelect, onCrewUpdate, - selectedCrew, }: CrewManagementProps) { const [crews, setCrews] = useState(initialCrews); const [isDialogOpen, setIsDialogOpen] = useState(false); @@ -68,10 +67,6 @@ export function CrewManagement({ const updatedCrews = crews.filter((crew) => crew.id !== id); setCrews(updatedCrews); - if (selectedCrew?.id === id) { - onCrewSelect(null); - } - onCrewUpdate(updatedCrews); toast({ title: "Crew deleted", @@ -171,15 +166,10 @@ export function CrewManagement({ {crew.name}

diff --git a/src/components/dashboard/Dashboard.tsx b/src/components/dashboard/Dashboard.tsx index 7fc31f7a..6831f25d 100644 --- a/src/components/dashboard/Dashboard.tsx +++ b/src/components/dashboard/Dashboard.tsx @@ -24,7 +24,6 @@ export default function Dashboard() { const [hasClonedAnalyzer, setHasClonedAnalyzer] = useState(false); const [error, setError] = useState(null); const [isLoading, setIsLoading] = useState(true); - const [selectedCrew, setSelectedCrew] = useState(null); const [isSheetOpen, setIsSheetOpen] = useState(false); const fetchCrews = useCallback(async () => { @@ -85,10 +84,6 @@ export default function Dashboard() { initializeDashboard(); }, [fetchCrews, checkClonedAnalyzer]); - const handleCrewSelect = useCallback((crew: Crew | null) => { - setSelectedCrew(crew); - }, []); - const handleCloneComplete = useCallback(() => { setHasClonedAnalyzer(true); fetchCrews(); @@ -97,9 +92,6 @@ export default function Dashboard() { const handleCrewsUpdated = useCallback( (updatedCrews: Crew[]) => { setCrews(updatedCrews); - if (updatedCrews.length === 0) { - setSelectedCrew(null); - } checkClonedAnalyzer(); }, [checkClonedAnalyzer] @@ -136,9 +128,7 @@ export default function Dashboard() { ) : ( )} From 953e331a49698fd71c4a038448399d09d8ae413c Mon Sep 17 00:00:00 2001 From: human058382928 <162091348+human058382928@users.noreply.github.com> Date: Mon, 11 Nov 2024 09:18:21 -0800 Subject: [PATCH 2/2] fix bugs --- src/components/crews/CrewManagement.tsx | 2 -- src/types/supabase.ts | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/components/crews/CrewManagement.tsx b/src/components/crews/CrewManagement.tsx index 4df74996..74a61de2 100644 --- a/src/components/crews/CrewManagement.tsx +++ b/src/components/crews/CrewManagement.tsx @@ -5,8 +5,6 @@ import { useRouter } from "next/navigation"; import { supabase } from "@/utils/supabase/client"; import { Button } from "@/components/ui/button"; import { - Circle, - CheckCircle, Settings, PlusIcon, Trash2Icon, diff --git a/src/types/supabase.ts b/src/types/supabase.ts index 961998f6..323807c9 100644 --- a/src/types/supabase.ts +++ b/src/types/supabase.ts @@ -10,9 +10,7 @@ export interface Crew { // Interface for props of the CrewManagement component export interface CrewManagementProps { initialCrews: Crew[] - onCrewSelect: (crew: Crew | null) => void onCrewUpdate: (updatedCrews: Crew[]) => void - selectedCrew: Crew | null } // Interface for props of the CrewForm component