chat: sets 'copied' message in inter

Fixes urbit/landscape#331
This commit is contained in:
James Acklin 2021-01-31 12:42:50 -05:00
parent fcefea0cc9
commit e23cd5dd2d

View File

@ -185,14 +185,20 @@ export const MessageWithSigil = (props) => {
const color = contact ? `#${uxToHex(contact.color)}` : dark ? '#000000' :'#FFFFFF'
const sigilClass = contact ? '' : dark ? 'mix-blend-diff' : 'mix-blend-darken';
const [displayName, setDisplayName] = useState(shipName);
const [nameMono, setNameMono] = useState((showNickname ? false : true));
const { hovering, bind } = useHovering();
const showCopyNotice = () => {
setDisplayName(copyNotice);
setNameMono(false);
};
useEffect(() => {
const timer = setTimeout(() => setDisplayName(shipName), 800);
const resetDisplay = () => {
setDisplayName(shipName);
setNameMono((showNickname ? false : true));
};
const timer = setTimeout(() => resetDisplay(), 800);
return () => clearTimeout(timer);
}, [displayName]);
@ -225,15 +231,17 @@ export const MessageWithSigil = (props) => {
fontSize={0}
mr={3}
flexShrink={0}
mono={!showNickname}
fontWeight={(showNickname) ? '500' : '400'}
mono={nameMono}
fontWeight={nameMono ? '400' : '500'}
className={`mw5 db truncate pointer`}
onClick={() => {
writeText(`~${msg.author}`),
showCopyNotice();
}}
title={`~${msg.author}`}
>{displayName}</Text>
>
{displayName}
</Text>
<Text flexShrink={0} fontSize={0} gray mono>{timestamp}</Text>
<Text
flexShrink={0}