From 9b8d197e8f028fcf26da44356be89ca8d1a07c46 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Fri, 9 Oct 2020 14:35:27 -0400 Subject: [PATCH 1/2] interface: sidebarInvite in indigo-react --- .../components/Sidebar/SidebarInvite.tsx | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/pkg/interface/src/views/landscape/components/Sidebar/SidebarInvite.tsx b/pkg/interface/src/views/landscape/components/Sidebar/SidebarInvite.tsx index eb57b9731..837e8b260 100644 --- a/pkg/interface/src/views/landscape/components/Sidebar/SidebarInvite.tsx +++ b/pkg/interface/src/views/landscape/components/Sidebar/SidebarInvite.tsx @@ -1,30 +1,40 @@ import React, { Component } from 'react'; import { Invite } from '~/types/invite-update'; +import { Text, Box, Button, Row } from '@tlon/indigo-react'; export class SidebarInvite extends Component<{invite: Invite, onAccept: Function, onDecline: Function}, {}> { render() { const { props } = this; return ( -
-
-

- {props.invite.text ? props.invite.text : props.invite.path} -

-
- + + You have been invited to: + + {props.invite.path.substr(1)} + + + +
+ + + ); } } From 072a9643eb9cbc3527f2f324244cd321991c2d59 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Fri, 9 Oct 2020 14:35:40 -0400 Subject: [PATCH 2/2] groups: show invites in home workspace --- .../landscape/components/Sidebar/Sidebar.tsx | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) 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}