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 { useDisconnect } from 'wagmi'; import { useGQLClient } from '../context/GQLClientContext'; import AsyncSelect from './shared/AsyncSelect'; const Sidebar = () => { const { orgSlug } = useParams(); const navigate = useNavigate(); const client = useGQLClient(); const { disconnect } = useDisconnect(); 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]); const handleLogOut = useCallback(() => { disconnect(); navigate('/login'); }, [disconnect, navigate]); 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
Log Out Documentation Support
); }; export default Sidebar;