diff --git a/pkg/interface/chat/src/js/components/lib/chat-input.js b/pkg/interface/chat/src/js/components/lib/chat-input.js index 503e93b62..6a61b57f1 100644 --- a/pkg/interface/chat/src/js/components/lib/chat-input.js +++ b/pkg/interface/chat/src/js/components/lib/chat-input.js @@ -31,7 +31,6 @@ const MARKDOWN_CONFIG = { } }; - export class ChatInput extends Component { constructor(props) { super(props); @@ -117,7 +116,6 @@ export class ChatInput extends Component { return; } this.setState({ patpSearch: match[1].toLowerCase() }); - } clearSearch() { @@ -276,6 +274,15 @@ export class ChatInput extends Component { const sigilClass = props.ownerContact ? '' : 'mix-blend-diff'; + const img = (props.ownerContact && (props.ownerContact.avatar !== null)) + ? + : ; + const candidates = _.chain(this.props.envelopes) .defaultTo([]) .map('author') @@ -324,12 +331,7 @@ export class ChatInput extends Component { height: 24 }} > - + {img}
+ className="w-20 dib list-ship black white-d f8 pointer" + > Ban ); @@ -34,20 +32,24 @@ export class MemberElement extends Component { ); } - let name = !!props.contact + const name = props.contact ? `${props.contact.nickname} (${cite(props.ship)})` : `${cite(props.ship)}`; - let color = !!props.contact ? uxToHex(props.contact.color) : '000000'; + const color = props.contact ? uxToHex(props.contact.color) : '000000'; + + const img = (props.contact && (props.contact.avatar !== null)) + ? + : ; return (
- + {img}

{name}

+ 'w-70 mono list-ship dib v-mid black white-d ml2 nowrap f8' + } + >{name}

{actionElem}
); } } - diff --git a/pkg/interface/chat/src/js/components/lib/overlay-sigil.js b/pkg/interface/chat/src/js/components/lib/overlay-sigil.js index 3fb1dbe6c..39ed8c2c2 100644 --- a/pkg/interface/chat/src/js/components/lib/overlay-sigil.js +++ b/pkg/interface/chat/src/js/components/lib/overlay-sigil.js @@ -1,9 +1,9 @@ -import React, { Component } from "react"; -import { Sigil } from "/components/lib/icons/sigil"; +import React, { Component } from 'react'; +import { Sigil } from '/components/lib/icons/sigil'; import { ProfileOverlay, OVERLAY_HEIGHT -} from "/components/lib/profile-overlay"; +} from '/components/lib/profile-overlay'; export class OverlaySigil extends Component { constructor() { @@ -49,7 +49,6 @@ export class OverlaySigil extends Component { const parent = this.containerRef.current.offsetParent; const { offsetTop } = this.containerRef.current; - let bottomSpace, topSpace; if(navigator.userAgent.includes('Firefox')) { @@ -58,7 +57,6 @@ export class OverlaySigil extends Component { } else { topSpace = offsetTop + parent.scrollHeight - parent.clientHeight - parent.scrollTop; bottomSpace = parent.clientHeight - topSpace - OVERLAY_HEIGHT; - } this.setState({ topSpace, @@ -69,12 +67,22 @@ export class OverlaySigil extends Component { render() { const { props, state } = this; - return ( + + const img = (props.contact && (props.contact.avatar !== null)) + ? + : ; + + return (
{state.profileClicked && ( )} - + {img}
); } diff --git a/pkg/interface/chat/src/js/components/lib/profile-overlay.js b/pkg/interface/chat/src/js/components/lib/profile-overlay.js index a95e8604d..9305f1962 100644 --- a/pkg/interface/chat/src/js/components/lib/profile-overlay.js +++ b/pkg/interface/chat/src/js/components/lib/profile-overlay.js @@ -1,7 +1,7 @@ -import React, { Component } from "react"; -import { Link } from "react-router-dom"; -import { cite } from "/lib/util"; -import { Sigil } from "/components/lib/icons/sigil"; +import React, { Component } from 'react'; +import { Link } from 'react-router-dom'; +import { cite } from '/lib/util'; +import { Sigil } from '/components/lib/icons/sigil'; export const OVERLAY_HEIGHT = 250; @@ -14,13 +14,13 @@ export class ProfileOverlay extends Component { } componentDidMount() { - document.addEventListener("mousedown", this.onDocumentClick); - document.addEventListener("touchstart", this.onDocumentClick); + document.addEventListener('mousedown', this.onDocumentClick); + document.addEventListener('touchstart', this.onDocumentClick); } componentWillUnmount() { - document.removeEventListener("mousedown", this.onDocumentClick); - document.removeEventListener("touchstart", this.onDocumentClick); + document.removeEventListener('mousedown', this.onDocumentClick); + document.removeEventListener('touchstart', this.onDocumentClick); } onDocumentClick(event) { @@ -38,21 +38,31 @@ export class ProfileOverlay extends Component { let top, bottom; if (topSpace < OVERLAY_HEIGHT / 2) { - top = `0px`; + top = '0px'; } if (bottomSpace < OVERLAY_HEIGHT / 2) { - bottom = `0px`; + bottom = '0px'; } if (!(top || bottom)) { bottom = `-${Math.round(OVERLAY_HEIGHT / 2)}px`; } - const containerStyle = { top, bottom, left: "100%" }; + const containerStyle = { top, bottom, left: '100%' }; const isOwn = window.ship === ship; - const identityHref = group["group-path"].startsWith("/~/") - ? "/~groups/me" - : `/~groups/view${group["group-path"]}/${window.ship}`; + const identityHref = group['group-path'].startsWith('/~/') + ? '/~groups/me' + : `/~groups/view${group['group-path']}/${window.ship}`; + + const img = (contact && (contact.avatar !== null)) + ? + : ; return (
-
- +
+ {img}
{contact && contact.nickname && (