profile: address comments

This commit is contained in:
Liam Fitzgerald 2020-08-27 10:05:29 +10:00
parent 6085752f21
commit e63c050a6e
4 changed files with 16 additions and 10 deletions

View File

@ -47,12 +47,14 @@ const renderWithSigil = (props, timestamp) => {
const contact = props.msg.author in props.contacts const contact = props.msg.author in props.contacts
? props.contacts[props.msg.author] : false; ? props.contacts[props.msg.author] : false;
const showNickname = !props.hideNicknames && contact?.nickname;
let name = `~${props.msg.author}`; let name = `~${props.msg.author}`;
let color = '#000000'; let color = '#000000';
let sigilClass = 'mix-blend-diff'; let sigilClass = 'mix-blend-diff';
if (contact) { if (contact) {
name = (contact.nickname.length > 0 && !props.hideNicknames) name = showNickname
? contact.nickname : `~${props.msg.author}`; ? contact.nickname
: `~${props.msg.author}`;
color = `#${uxToHex(contact.color)}`; color = `#${uxToHex(contact.color)}`;
sigilClass = ''; sigilClass = '';
} }
@ -71,6 +73,7 @@ const renderWithSigil = (props, timestamp) => {
association={props.association} association={props.association}
group={props.group} group={props.group}
hideAvatars={props.hideAvatars} hideAvatars={props.hideAvatars}
hideNicknames={props.hideNicknames}
className="fl pr3 v-top bg-white bg-gray0-d" className="fl pr3 v-top bg-white bg-gray0-d"
/> />
<div className="fr clamp-message white-d" <div className="fr clamp-message white-d"
@ -80,7 +83,7 @@ const renderWithSigil = (props, timestamp) => {
<span <span
className={ className={
'mw5 db truncate pointer ' + 'mw5 db truncate pointer ' +
(contact.nickname ? '' : 'mono') (showNickname ? '' : 'mono')
} }
onClick={() => { onClick={() => {
writeText(props.msg.author); writeText(props.msg.author);

View File

@ -90,6 +90,8 @@ export class OverlaySigil extends Component {
association={props.association} association={props.association}
group={props.group} group={props.group}
onDismiss={this.profileHide} onDismiss={this.profileHide}
hideAvatars={hideAvatars}
hideNicknames={props.hideNicknames}
/> />
)} )}
{img} {img}

View File

@ -34,7 +34,7 @@ export class ProfileOverlay extends Component {
} }
render() { render() {
const { contact, ship, color, topSpace, bottomSpace, group, association } = this.props; const { contact, ship, color, topSpace, bottomSpace, group, association, hideNicknames, hideAvatars } = this.props;
let top, bottom; let top, bottom;
if (topSpace < OVERLAY_HEIGHT / 2) { if (topSpace < OVERLAY_HEIGHT / 2) {
@ -51,10 +51,10 @@ export class ProfileOverlay extends Component {
const isOwn = window.ship === ship; const isOwn = window.ship === ship;
const identityHref = group.hidden const identityHref = group.hidden
? '/~groups/me' ? '/~profile/identity'
: `/~groups/view${association['group-path']}/${window.ship}`; : `/~groups/view${association['group-path']}/${window.ship}`;
let img = (contact && (contact.avatar !== null)) let img = contact?.avatar && !hideAvatars
? <img src={contact.avatar} height={160} width={160} className="brt2 dib" /> ? <img src={contact.avatar} height={160} width={160} className="brt2 dib" />
: <Sigil : <Sigil
ship={ship} ship={ship}
@ -63,6 +63,7 @@ export class ProfileOverlay extends Component {
classes="brt2" classes="brt2"
svgClass="brt2" svgClass="brt2"
/>; />;
const showNickname = contact?.nickname && !hideNicknames;
if (!group.hidden) { if (!group.hidden) {
img = <Link to={`/~groups/view${association['group-path']}/${ship}`}>{img}</Link>; img = <Link to={`/~groups/view${association['group-path']}/${ship}`}>{img}</Link>;
@ -78,7 +79,7 @@ export class ProfileOverlay extends Component {
{img} {img}
</div> </div>
<div className="pv3 pl3 pr2"> <div className="pv3 pl3 pr2">
{contact && contact.nickname && ( {showNickname && (
<div className="b white-d truncate">{contact.nickname}</div> <div className="b white-d truncate">{contact.nickname}</div>
)} )}
<div className="mono gray2">{cite(`~${ship}`)}</div> <div className="mono gray2">{cite(`~${ship}`)}</div>

View File

@ -86,12 +86,12 @@ export default function ProfileScreen(props: any) {
</Box> </Box>
</Box> </Box>
<Box width="100%" py={3}> <Box width="100%" py={3}>
<SidebarItem current={view} view="settings">
Ship Settings
</SidebarItem>
<SidebarItem current={view} view="identity"> <SidebarItem current={view} view="identity">
Your Identity Your Identity
</SidebarItem> </SidebarItem>
<SidebarItem current={view} view="settings">
Ship Settings
</SidebarItem>
</Box> </Box>
</Col> </Col>
<Box <Box