diff --git a/packages/frontend/src/components/shared/Sidebar/Sidebar.tsx b/packages/frontend/src/components/shared/Sidebar/Sidebar.tsx index 0d746749..1dbb3b6d 100644 --- a/packages/frontend/src/components/shared/Sidebar/Sidebar.tsx +++ b/packages/frontend/src/components/shared/Sidebar/Sidebar.tsx @@ -1,14 +1,11 @@ -import React, { useCallback, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { Link, NavLink, useNavigate, useParams } from 'react-router-dom'; import { Organization } from 'gql-client'; -import { Option } from '@material-tailwind/react'; import { useDisconnect } from 'wagmi'; import { useGQLClient } from 'context/GQLClientContext'; -import AsyncSelect from 'components/shared/AsyncSelect'; import { - ChevronGrabberHorizontal, FolderIcon, GlobeIcon, LifeBuoyIcon, @@ -17,6 +14,7 @@ import { } from 'components/shared/CustomIcon'; import { Tabs } from 'components/shared/Tabs'; import { Heading } from 'components/shared/Heading'; +import { UserSelect } from 'components/shared/UserSelect'; export const Sidebar = () => { const { orgSlug } = useParams(); @@ -37,6 +35,22 @@ export const Sidebar = () => { setSelectedOrgSlug(orgSlug); }, [orgSlug]); + const formattedSelected = useMemo(() => { + const selected = organizations.find((org) => org.slug === selectedOrgSlug); + return { + value: selected?.slug ?? '', + label: selected?.name ?? '', + imgSrc: '/logo.svg', + }; + }, [organizations, selectedOrgSlug, orgSlug]); + const formattedSelectOptions = useMemo(() => { + return organizations.map((org) => ({ + value: org.slug, + label: org.name, + imgSrc: '/logo.svg', + })); + }, [organizations, selectedOrgSlug, orgSlug]); + const handleLogOut = useCallback(() => { disconnect(); navigate('/login'); @@ -57,49 +71,10 @@ export const Sidebar = () => { {/* Switch organization */}
- { - setSelectedOrgSlug(value!); - navigate(`/${value}`); - }} - selected={(_, index) => ( -
- Application Logo -
-
- {organizations[index!]?.name} -
-
Organization
-
-
- )} - arrow={} - > - {/* // TODO: Show label organization and manage in option */} - {organizations.map((org) => ( - - ))} -
+ {[