import type { FunctionalComponent } from 'preact'; import { TeamDropdown } from './TeamDropdown/TeamDropdown'; import ChevronDown from '../icons/dropdown.svg'; import { useTeamId } from '../hooks/use-team-id'; import TeamProgress from '../icons/team-progress.svg'; import SettingsIcon from '../icons/cog.svg'; import MapIcon from '../icons/map.svg'; import GroupIcon from '../icons/group.svg'; import { useState } from 'preact/hooks'; import { useStore } from '@nanostores/preact'; import { $canManageCurrentTeam, $currentTeam } from '../stores/team'; import { WarningIcon } from './ReactIcons/WarningIcon'; export const TeamSidebar: FunctionalComponent<{ activePageId: string; }> = ({ activePageId, children }) => { const [menuShown, setMenuShown] = useState(false); const currentTeam = useStore($currentTeam); const { teamId } = useTeamId(); const sidebarLinks = [ { title: 'Progress', href: `/team/progress?t=${teamId}`, id: 'progress', icon: TeamProgress, }, { title: 'Roadmaps', href: `/team/roadmaps?t=${teamId}`, id: 'roadmaps', icon: MapIcon, hasWarning: currentTeam?.roadmaps?.length === 0, }, { title: 'Members', href: `/team/members?t=${teamId}`, id: 'members', icon: GroupIcon, }, { title: 'Settings', href: `/team/settings?t=${teamId}`, id: 'settings', icon: SettingsIcon, }, ]; return ( <>
{menuShown && ( )}
{children}
); };