diff --git a/pkg/interface/src/views/landscape/components/Sidebar/Sidebar.tsx b/pkg/interface/src/views/landscape/components/Sidebar/Sidebar.tsx index 558256a48..c32bbee0e 100644 --- a/pkg/interface/src/views/landscape/components/Sidebar/Sidebar.tsx +++ b/pkg/interface/src/views/landscape/components/Sidebar/Sidebar.tsx @@ -18,7 +18,8 @@ import { SidebarListHeader } from "./SidebarListHeader"; import { useLocalStorageState } from "~/logic/lib/useLocalStorageState"; import { getGroupFromWorkspace } from "~/logic/lib/workspace"; import { SidebarAppConfigs } from './types'; -import {SidebarList} from "./SidebarList"; +import { SidebarList } from "./SidebarList"; +import { SidebarInvite } from './SidebarInvite'; interface SidebarProps { children: ReactNode; @@ -50,6 +51,27 @@ const SidebarStickySpacer = styled(Box)` } `; +const inviteItems = (invites, api) => { + const returned = []; + Object.keys(invites).filter((e) => { + return e !== '/contacts'; + }).map((appKey) => { + const app = invites[appKey]; + Object.keys(app).map((uid) => { + const invite = app[uid]; + const inviteItem = + api.invite.accept(appKey, uid)} + onDecline={() => api.invite.decline(appKey, uid)} + />; + returned.push(inviteItem); + }); + }); + return returned; +}; + export function Sidebar(props: SidebarProps) { const { invites, api, associations, selected, apps, workspace } = props; const groupPath = getGroupFromWorkspace(workspace); @@ -65,6 +87,8 @@ export function Sidebar(props: SidebarProps) { hideUnjoined: false, } ); + const sidebarInvites = (workspace?.type === 'home') + ? inviteItems(invites, api) : null; return ( + {sidebarInvites}