"use client" import * as React from "react" import { CalendarHeartIcon, Check, PlusIcon, } from "lucide-react" import { Avatar, AvatarFallback, AvatarImage, } from "../ui/avatar" import { Button } from "../ui/button" import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, } from "../ui/command" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "../ui/dialog" import { Input } from "../ui/input" import { Label } from "../ui/label" import { Popover, PopoverContent, PopoverTrigger, } from "../ui/popover" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../ui/select" import { cn } from "../utils" const groups = [ { label: "Personal Account", teams: [ { label: "Alicia Koch", value: "personal", }, ], }, { label: "Teams", teams: [ { label: "Acme Inc.", value: "acme-inc", }, { label: "Monsters Inc.", value: "monsters", }, ], }, ] type Team = (typeof groups)[number]["teams"][number] type PopoverTriggerProps = React.ComponentPropsWithoutRef interface TeamSwitcherProps extends PopoverTriggerProps { } export default function TeamSwitcher({ className }: TeamSwitcherProps) { const [open, setOpen] = React.useState(false) const [showNewTeamDialog, setShowNewTeamDialog] = React.useState(false) const [selectedTeam, setSelectedTeam] = React.useState( groups[0].teams[0] ) return ( No team found. {groups.map((group) => ( {group.teams.map((team) => ( { setSelectedTeam(team) setOpen(false) }} className="text-sm" > SC {team.label} ))} ))} { setOpen(false) setShowNewTeamDialog(true) }} > Create Team Create team Add a new team to manage products and customers.
) }