| 91 | } |
| 92 | |
| 93 | const handleRemoveGroup = async (id: string) => { |
| 94 | const { error } = await supabase.from("groups").delete().eq("id", id) |
| 95 | |
| 96 | if (error) { |
| 97 | clientLogger.error('Error removing group', { error }) |
| 98 | toast({ variant: "destructive", description: "Failed to remove group" }) |
| 99 | } else { |
| 100 | setGroups(groups.filter((group) => group.id !== id)) |
| 101 | setHasChanges(true) |
| 102 | router.refresh() |
| 103 | toast({ description: "Group removed successfully" }) |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | const handleAddGroup = async () => { |
| 108 | const newColor = getColorForGroup(groups.length) |