Merge pull request #3677 from urbit/mp/groups/restore-calmness

groups: pass hideAvatars / nicknames to participants list
This commit is contained in:
matildepark 2020-10-08 13:55:19 -04:00 committed by GitHub
commit 8697c116b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 3 deletions

View File

@ -70,6 +70,8 @@ export function GroupsPane(props: GroupsPaneProps) {
group={group!} group={group!}
api={api} api={api}
s3={props.s3} s3={props.s3}
hideAvatars={props.hideAvatars}
hideNicknames={props.hideNicknames}
{...routeProps} {...routeProps}
baseUrl={baseUrl} baseUrl={baseUrl}
/> />

View File

@ -102,8 +102,10 @@ export function Participants(props: {
group: Group; group: Group;
association: Association; association: Association;
api: GlobalApi; api: GlobalApi;
hideAvatars: boolean;
hideNicknames: boolean;
}) { }) {
const { api } = props; const { api, hideAvatars, hideNicknames } = props;
const tabFilters: Record< const tabFilters: Record<
ParticipantsTabId, ParticipantsTabId,
(p: Participant) => boolean (p: Participant) => boolean
@ -228,6 +230,8 @@ export function Participants(props: {
group={props.group} group={props.group}
contact={c} contact={c}
association={props.association} association={props.association}
hideAvatars={hideAvatars}
hideNicknames={hideNicknames}
/> />
)) ))
) : ( ) : (
@ -248,6 +252,8 @@ function Participant(props: {
group: Group; group: Group;
role?: RoleTags; role?: RoleTags;
api: GlobalApi; api: GlobalApi;
hideAvatars: boolean;
hideNicknames: boolean;
}) { }) {
const { contact, association, group, api } = props; const { contact, association, group, api } = props;
const { title } = association.metadata; const { title } = association.metadata;
@ -282,13 +288,24 @@ function Participant(props: {
}); });
}, [api, association]); }, [api, association]);
const avatar = (
(contact?.avatar !== null) && !props.hideAvatars)
? <img src={contact.avatar} height={32} width={32} className="dib" />
: <Sigil
ship={contact.patp}
size={32}
color={`#${color}`}
/>;
const hasNickname = contact.nickname && !props.hideNicknames;
return ( return (
<> <>
<Box> <Box>
<Sigil ship={contact.patp} size={32} color={`#${color}`} /> {avatar}
</Box> </Box>
<Col justifyContent="center" gapY="1" height="100%"> <Col justifyContent="center" gapY="1" height="100%">
{contact.nickname && ( {hasNickname && (
<TruncText title={contact.nickname} maxWidth="85%" color="black"> <TruncText title={contact.nickname} maxWidth="85%" color="black">
{contact.nickname} {contact.nickname}
</TruncText> </TruncText>

View File

@ -39,6 +39,8 @@ export function PopoverRoutes(
association: Association; association: Association;
s3: S3State; s3: S3State;
api: GlobalApi; api: GlobalApi;
hideAvatars: boolean;
hideNicknames: boolean;
} & RouteComponentProps } & RouteComponentProps
) { ) {
const relativeUrl = (url: string) => `${props.baseUrl}/popover${url}`; const relativeUrl = (url: string) => `${props.baseUrl}/popover${url}`;
@ -131,6 +133,8 @@ export function PopoverRoutes(
contacts={props.contacts} contacts={props.contacts}
association={props.association} association={props.association}
api={props.api} api={props.api}
hideAvatars={props.hideAvatars}
hideNicknames={props.hideNicknames}
/> />
)} )}
{view === "profile" && ( {view === "profile" && (