import React, { useCallback, useEffect, useState } from 'react'; import { Link, NavLink, useNavigate, useParams } from 'react-router-dom'; import { Organization } from 'gql-client'; import { Typography, Option } from '@material-tailwind/react'; import { useGQLClient } from '../context/GQLClientContext'; import AsyncSelect from './shared/AsyncSelect'; const Sidebar = () => { const { orgSlug } = useParams(); const navigate = useNavigate(); const client = useGQLClient(); const [selectedOrgSlug, setSelectedOrgSlug] = useState(orgSlug); const [organizations, setOrganizations] = useState([]); const fetchUserOrganizations = useCallback(async () => { const { organizations } = await client.getOrganizations(); setOrganizations(organizations); }, [orgSlug]); useEffect(() => { fetchUserOrganizations(); setSelectedOrgSlug(orgSlug); }, [orgSlug]); return (

Snowball

{ setSelectedOrgSlug(value!); navigate(`/${value}`); }} selected={(_, index) => (
^
{organizations[index!]?.name} Organization
)} > {/* TODO: Show label organization and manage in option */} {organizations.map((org) => ( ))}
(isActive ? 'text-blue-500' : '')} > Projects
(isActive ? 'text-blue-500' : '')} > Settings
Documentation
Support
); }; export default Sidebar;