From 258bd55dd213e25e560e84dae57d88323280955f Mon Sep 17 00:00:00 2001 From: Josh Perez <60019601+josh-signal@users.noreply.github.com> Date: Mon, 25 Jan 2021 20:01:19 -0500 Subject: [PATCH] Show about info from contact profiles --- stylesheets/_global.scss | 15 ------- stylesheets/_modules.scss | 41 +++++++++++++++++-- ts/components/ContactListItem.stories.tsx | 40 ++++-------------- ts/components/ContactListItem.tsx | 25 ++--------- ts/components/conversation/About.tsx | 22 ++++++++++ .../conversation/ContactModal.stories.tsx | 1 + ts/components/conversation/ContactModal.tsx | 4 ++ .../conversation/ConversationHero.stories.tsx | 7 ++++ .../conversation/ConversationHero.tsx | 8 ++++ ts/model-types.d.ts | 2 + ts/models/conversations.ts | 40 ++++++++++++++++++ ts/state/ducks/conversations.ts | 1 + ts/util/lint/exceptions.json | 10 ++--- 13 files changed, 140 insertions(+), 76 deletions(-) create mode 100644 ts/components/conversation/About.tsx diff --git a/stylesheets/_global.scss b/stylesheets/_global.scss index 8165ca42e2..8ca6bd3362 100644 --- a/stylesheets/_global.scss +++ b/stylesheets/_global.scss @@ -201,21 +201,6 @@ a { .container { outline: none; } - - .members .contact { - @include light-theme { - border-bottom: 1px solid $color-gray-05; - &:last-of-type { - border-bottom: none; - } - } - @include dark-theme { - border-bottom: 1px solid $color-gray-75; - &:last-of-type { - border-bottom: none; - } - } - } } .banner { diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 5576bcc9a2..8a31160caa 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -2077,6 +2077,32 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05', } } +.module-about { + &__container { + margin-bottom: 8px; + max-width: 248px; + } + + &__text { + @include font-body-1; + @include light-theme { + color: $color-gray-60; + } + @include dark-theme { + color: $color-gray-25; + } + max-width: 400px; + + img.emoji { + height: 1em; + margin-right: 3px; + margin-bottom: 3px; + vertical-align: middle; + width: 1em; + } + } +} + // Module: Embedded Contact .module-embedded-contact { @@ -2689,6 +2715,7 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05', .module-contact-list-item__text { margin-left: 8px; + align-items: center; display: flex; flex-direction: row; @@ -2696,7 +2723,13 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05', } .module-contact-list-item__text__name { - @include font-body-2-bold; + @include font-body-1-bold; + @include light-theme { + color: $color-gray-90; + } + @include dark-theme { + color: $color-gray-05; + } } .module-contact-list-item__text__profile-name { @@ -2731,7 +2764,7 @@ $timer-icons: '55', '50', '45', '40', '35', '30', '25', '20', '15', '10', '05', text-align: right; height: 100%; - @include font-body-2-bold; + @include font-body-2; } // Module: In Contacts Icon @@ -10299,7 +10332,7 @@ $contact-modal-padding: 18px; .module-contact-modal { @include font-body-2; - min-width: 250px; + min-width: 280px; padding: $contact-modal-padding; border-radius: 8px; overflow: hidden; @@ -10336,7 +10369,7 @@ $contact-modal-padding: 18px; } .module-contact-modal__name { - @include font-body-1-bold; + @include font-title-2; margin-top: 6px; } diff --git a/ts/components/ContactListItem.stories.tsx b/ts/components/ContactListItem.stories.tsx index 63aa15e8bd..fb88015a2d 100644 --- a/ts/components/ContactListItem.stories.tsx +++ b/ts/components/ContactListItem.stories.tsx @@ -23,7 +23,6 @@ storiesOf('Components/ContactListItem', module) title="Someone 🔥 Somewhere" name="Someone 🔥 Somewhere" phoneNumber="(202) 555-0011" - isVerified profileName="🔥Flames🔥" avatarPath={gifUrl} onClick={onClick} @@ -39,6 +38,7 @@ storiesOf('Components/ContactListItem', module) name="Someone 🔥 Somewhere" phoneNumber="(202) 555-0011" profileName="🔥Flames🔥" + about="👍 Free to chat" avatarPath={gifUrl} onClick={onClick} /> @@ -48,26 +48,13 @@ storiesOf('Components/ContactListItem', module) name="Another ❄️ Yes" phoneNumber="(202) 555-0011" profileName="❄️Ice❄️" + about="🙏 Be kind" avatarPath={gifUrl} onClick={onClick} /> ); }) - .add('With name and profile, verified', () => { - return ( - - ); - }) .add('With name and profile, admin', () => { return ( @@ -90,6 +77,7 @@ storiesOf('Components/ContactListItem', module) isAdmin title="(202) 555-0011" phoneNumber="(202) 555-0011" + about="👍 Free to chat" avatarPath={gifUrl} onClick={onClick} /> @@ -104,6 +92,7 @@ storiesOf('Components/ContactListItem', module) color="teal" phoneNumber="(202) 555-0011" profileName="🔥Flames🔥" + about="👍 Free to chat" onClick={onClick} /> ); @@ -115,39 +104,28 @@ storiesOf('Components/ContactListItem', module) phoneNumber="(202) 555-0011" title="🔥Flames🔥" profileName="🔥Flames🔥" + about="👍 Free to chat" onClick={onClick} /> ); }) - .add('Verified, profile, no name, no avatar', () => { + .add('No name, no profile, no avatar, no about', () => { return ( ); }) .add('No name, no profile, no avatar', () => { - return ( - - ); - }) - .add('Verified, no name, no profile, no avatar', () => { return ( ); diff --git a/ts/components/ContactListItem.tsx b/ts/components/ContactListItem.tsx index 857bb1f5f5..defeae2d13 100644 --- a/ts/components/ContactListItem.tsx +++ b/ts/components/ContactListItem.tsx @@ -4,6 +4,7 @@ import React from 'react'; import classNames from 'classnames'; +import { About } from './conversation/About'; import { Avatar } from './Avatar'; import { Emojify } from './conversation/Emojify'; import { InContactsIcon } from './InContactsIcon'; @@ -12,12 +13,12 @@ import { LocalizerType } from '../types/Util'; import { ColorType } from '../types/Colors'; type Props = { + about?: string; avatarPath?: string; color?: ColorType; i18n: LocalizerType; isAdmin?: boolean; isMe?: boolean; - isVerified?: boolean; name?: string; onClick?: () => void; phoneNumber?: string; @@ -53,24 +54,11 @@ export class ContactListItem extends React.Component { } public render(): JSX.Element { - const { - i18n, - isAdmin, - isMe, - isVerified, - name, - onClick, - phoneNumber, - profileName, - title, - } = this.props; + const { about, i18n, isAdmin, isMe, name, onClick, title } = this.props; const displayName = isMe ? i18n('you') : title; const shouldShowIcon = Boolean(name); - const showNumber = Boolean(isMe || name || profileName); - const showVerified = !isMe && isVerified; - return (