From 1865086675a8c7469da873d9891d8137af13710d Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Thu, 17 Sep 2020 11:54:45 +1000 Subject: [PATCH] groups: sidebar restructure --- pkg/interface/src/views/apps/groups/app.tsx | 58 ++++++++++++++++--- .../groups/components/lib/ContactCard.tsx | 14 ++++- .../src/views/components/Resource.tsx | 3 +- 3 files changed, 63 insertions(+), 12 deletions(-) diff --git a/pkg/interface/src/views/apps/groups/app.tsx b/pkg/interface/src/views/apps/groups/app.tsx index a4e45043e..fed701e11 100644 --- a/pkg/interface/src/views/apps/groups/app.tsx +++ b/pkg/interface/src/views/apps/groups/app.tsx @@ -1,10 +1,11 @@ import React, { Component } from 'react'; import { Route, Switch } from 'react-router-dom'; -import Helmet from 'react-helmet'; +import { Box, Center } from '@tlon/indigo-react'; import './css/custom.css'; import { Skeleton } from './components/skeleton'; +import { Skeleton as NewSkeleton } from '~/views/components/Skeleton'; import { NewScreen } from './components/new'; import { ContactSidebar } from './components/lib/contact-sidebar'; import { ContactCard } from './components/lib/contact-card'; @@ -12,10 +13,14 @@ import { AddScreen } from './components/lib/add-contact'; import { JoinScreen } from './components/join'; import GroupDetail from './components/lib/group-detail'; -import { PatpNoSig } from '~/types/noun'; +import { PatpNoSig, AppName } from '~/types/noun'; import GlobalApi from '~/logic/api/global'; import { StoreState } from '~/logic/store/type'; import GlobalSubscription from '~/logic/subscription/global'; +import {Resource} from '~/views/components/Resource'; +import {PopoverRoutes} from './components/PopoverRoutes'; +import {UnjoinedResource} from '~/views/components/UnjoinedResource'; +import {GroupsPane} from '~/views/components/GroupsPane'; type GroupsAppProps = StoreState & { @@ -26,14 +31,18 @@ type GroupsAppProps = StoreState & { export default class GroupsApp extends Component { componentDidMount() { + document.title = 'OS1 - Groups'; // preload spinner asset new Image().src = '/~landscape/img/Spinner.png'; this.props.subscription.startApp('groups') + this.props.subscription.startApp('chat') + } componentWillUnmount() { this.props.subscription.stopApp('groups') + this.props.subscription.stopApp('chat') } @@ -55,10 +64,6 @@ export default class GroupsApp extends Component { return ( - <> - - OS1 - Groups - { @@ -131,7 +136,7 @@ export default class GroupsApp extends Component { ); }} /> - { const groupPath = `/ship/${props.match.params.ship}/${props.match.params.group}`; @@ -278,6 +283,17 @@ export default class GroupsApp extends Component { ); }} /> + { + const { host, name } = routeProps.match.params as Record; + const groupPath = `/ship/${host}/${name}`; + const baseUrl = `/~groups${groupPath}`; + + return ( + + ) + }}/> + { const groupPath = @@ -333,8 +349,34 @@ export default class GroupsApp extends Component { ); }} /> + { + const me = defaultContacts[window.ship] || {}; + + return ( + + + + ); + }} + /> - ); } } diff --git a/pkg/interface/src/views/apps/groups/components/lib/ContactCard.tsx b/pkg/interface/src/views/apps/groups/components/lib/ContactCard.tsx index f8438417d..fa6a132a3 100644 --- a/pkg/interface/src/views/apps/groups/components/lib/ContactCard.tsx +++ b/pkg/interface/src/views/apps/groups/components/lib/ContactCard.tsx @@ -53,6 +53,16 @@ const formSchema = Yup.object({ ), }); +const emptyContact = { + avatar: null, + color: '0', + nickname: '', + email: '', + phone: '', + website: '', + notes: '' +}; + export function ContactCard(props: ContactCardProps) { const us = `~${window.ship}`; const { contact } = props; @@ -84,13 +94,13 @@ export function ContactCard(props: ContactCardProps) { } }; - const hexColor = contact.color ? `#${uxToHex(contact.color)}` : "#000000"; + const hexColor = contact?.color ? `#${uxToHex(contact.color)}` : "#000000"; return (
diff --git a/pkg/interface/src/views/components/Resource.tsx b/pkg/interface/src/views/components/Resource.tsx index 3cabb2bf3..5765eae12 100644 --- a/pkg/interface/src/views/components/Resource.tsx +++ b/pkg/interface/src/views/components/Resource.tsx @@ -1,7 +1,6 @@ import React from "react"; import { ChatResource } from "~/views/apps/chat/ChatResource"; -import { LinkResource } from "~/views/apps/links/LinkResource"; import { PublishResource } from "~/views/apps/publish/PublishResource"; import { Association } from "~/types/metadata-update"; @@ -26,7 +25,7 @@ export function Resource(props: ResourceProps) { return ; } if (app === 'link') { - return ; + return null; //return ; } return null; }