mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-07 07:30:23 +03:00
Merge pull request #4341 from urbit/mp/contacts/detail-2
contacts: update profile overlay
This commit is contained in:
commit
b2ffbe2bd5
@ -24,7 +24,7 @@ export function ChatResource(props: ChatResourceProps) {
|
|||||||
const station = props.association['app-path'];
|
const station = props.association['app-path'];
|
||||||
const groupPath = props.association['group-path'];
|
const groupPath = props.association['group-path'];
|
||||||
const group = props.groups[groupPath];
|
const group = props.groups[groupPath];
|
||||||
const contacts = props.contacts[groupPath] || {};
|
const contacts = props.contacts;
|
||||||
|
|
||||||
const graph = props.graphs[station.slice(7)];
|
const graph = props.graphs[station.slice(7)];
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ export function ChatResource(props: ChatResourceProps) {
|
|||||||
const unreadCount = props.unreads.graph?.[station]?.['/']?.unreads || 0;
|
const unreadCount = props.unreads.graph?.[station]?.['/']?.unreads || 0;
|
||||||
|
|
||||||
const [,, owner, name] = station.split('/');
|
const [,, owner, name] = station.split('/');
|
||||||
const ourContact = contacts?.[window.ship];
|
const ourContact = contacts?.[`~${window.ship}`];
|
||||||
|
|
||||||
const chatInput = useRef<ChatInput>();
|
const chatInput = useRef<ChatInput>();
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ export const MessageWithSigil = (props) => {
|
|||||||
const dark = useLocalState(state => state.dark);
|
const dark = useLocalState(state => state.dark);
|
||||||
|
|
||||||
const datestamp = moment.unix(msg['time-sent'] / 1000).format(DATESTAMP_FORMAT);
|
const datestamp = moment.unix(msg['time-sent'] / 1000).format(DATESTAMP_FORMAT);
|
||||||
const contact = msg.author in contacts ? contacts[msg.author] : false;
|
const contact = `~${msg.author}` in contacts ? contacts[`~${msg.author}`] : false;
|
||||||
const showNickname = useShowNickname(contact);
|
const showNickname = useShowNickname(contact);
|
||||||
const name = showNickname ? contact.nickname : cite(msg.author);
|
const name = showNickname ? contact.nickname : cite(msg.author);
|
||||||
const color = contact ? `#${uxToHex(contact.color)}` : dark ? '#000000' :'#FFFFFF'
|
const color = contact ? `#${uxToHex(contact.color)}` : dark ? '#000000' :'#FFFFFF'
|
||||||
|
@ -110,7 +110,6 @@ class OverlaySigil extends PureComponent<OverlaySigilProps, OverlaySigilState> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
cursor='pointer'
|
|
||||||
position='relative'
|
position='relative'
|
||||||
onClick={this.profileShow}
|
onClick={this.profileShow}
|
||||||
ref={this.containerRef}
|
ref={this.containerRef}
|
||||||
|
@ -4,7 +4,8 @@ import { Contact, Group } from '~/types';
|
|||||||
import { cite, useShowNickname } from '~/logic/lib/util';
|
import { cite, useShowNickname } from '~/logic/lib/util';
|
||||||
import { Sigil } from '~/logic/lib/sigil';
|
import { Sigil } from '~/logic/lib/sigil';
|
||||||
|
|
||||||
import { Box, Col, Button, Text, BaseImage, ColProps } from '@tlon/indigo-react';
|
import { Box, Col, Row, Text, BaseImage, ColProps, Icon } from '@tlon/indigo-react';
|
||||||
|
import { Dropdown } from './Dropdown';
|
||||||
import { withLocalState } from '~/logic/state/local';
|
import { withLocalState } from '~/logic/state/local';
|
||||||
|
|
||||||
export const OVERLAY_HEIGHT = 250;
|
export const OVERLAY_HEIGHT = 250;
|
||||||
@ -60,7 +61,6 @@ class ProfileOverlay extends PureComponent<ProfileOverlayProps, {}> {
|
|||||||
color,
|
color,
|
||||||
topSpace,
|
topSpace,
|
||||||
bottomSpace,
|
bottomSpace,
|
||||||
group = false,
|
|
||||||
hideAvatars,
|
hideAvatars,
|
||||||
hideNicknames,
|
hideNicknames,
|
||||||
history,
|
history,
|
||||||
@ -78,75 +78,112 @@ class ProfileOverlay extends PureComponent<ProfileOverlayProps, {}> {
|
|||||||
if (!(top || bottom)) {
|
if (!(top || bottom)) {
|
||||||
bottom = `-${Math.round(OVERLAY_HEIGHT / 2)}px`;
|
bottom = `-${Math.round(OVERLAY_HEIGHT / 2)}px`;
|
||||||
}
|
}
|
||||||
const containerStyle = { top, bottom, left: '100%', maxWidth: '160px' };
|
const containerStyle = { top, bottom, left: '100%' };
|
||||||
|
|
||||||
const isOwn = window.ship === ship;
|
const isOwn = window.ship === ship;
|
||||||
|
|
||||||
const img = contact?.avatar && !hideAvatars
|
const img = contact?.avatar && !hideAvatars
|
||||||
? <BaseImage display='inline-block' src={contact.avatar} height={160} width={160} className="brt2" />
|
? <BaseImage display='inline-block' src={contact.avatar} height={72} width={72} className="brt2" />
|
||||||
: <Sigil
|
: <Sigil
|
||||||
ship={ship}
|
ship={ship}
|
||||||
size={160}
|
size={72}
|
||||||
color={color}
|
color={color}
|
||||||
classes="brt2"
|
classes="brt2"
|
||||||
svgClass="brt2"
|
svgClass="brt2"
|
||||||
/>;
|
/>;
|
||||||
const showNickname = useShowNickname(contact, hideNicknames);
|
const showNickname = useShowNickname(contact, hideNicknames);
|
||||||
|
|
||||||
// TODO: we need to rethink this "top-level profile view" of other ships
|
|
||||||
/* if (!group.hidden) {
|
|
||||||
}*/
|
|
||||||
|
|
||||||
const isHidden = group ? group.hidden : false;
|
|
||||||
|
|
||||||
const rootSettings = history.location.pathname.slice(0, history.location.pathname.indexOf("/resource"));
|
const rootSettings = history.location.pathname.slice(0, history.location.pathname.indexOf("/resource"));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col
|
<Col
|
||||||
ref={this.popoverRef}
|
ref={this.popoverRef}
|
||||||
boxShadow="2px 4px 20px rgba(0, 0, 0, 0.25)"
|
backgroundColor="white"
|
||||||
|
color="washedGray"
|
||||||
|
border={1}
|
||||||
|
borderRadius={2}
|
||||||
|
borderColor="lightGray"
|
||||||
|
boxShadow="0px 0px 0px 3px"
|
||||||
position='absolute'
|
position='absolute'
|
||||||
backgroundColor='white'
|
|
||||||
zIndex='3'
|
zIndex='3'
|
||||||
fontSize='0'
|
fontSize='0'
|
||||||
|
height="250px"
|
||||||
|
width="250px"
|
||||||
|
padding={3}
|
||||||
|
justifyContent="space-between"
|
||||||
style={containerStyle}
|
style={containerStyle}
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
<Box height='160px' width='160px'>
|
<Row color='black' width='100%' height="3rem">
|
||||||
|
<Dropdown
|
||||||
|
dropWidth="150px"
|
||||||
|
width="auto"
|
||||||
|
alignY="top"
|
||||||
|
alignX="left"
|
||||||
|
options={
|
||||||
|
<Col
|
||||||
|
mt='4'
|
||||||
|
p='1'
|
||||||
|
backgroundColor="white"
|
||||||
|
color="washedGray"
|
||||||
|
border={1}
|
||||||
|
borderRadius={2}
|
||||||
|
borderColor="lightGray"
|
||||||
|
boxShadow="0px 0px 0px 3px">
|
||||||
|
<Row
|
||||||
|
p={1}
|
||||||
|
color='black'
|
||||||
|
cursor='pointer'
|
||||||
|
fontSize={0}
|
||||||
|
onClick={() => history.push('/~profile/' + window.ship)}>
|
||||||
|
View Profile
|
||||||
|
</Row>
|
||||||
|
{(!isOwn) && (
|
||||||
|
<Row
|
||||||
|
p={1}
|
||||||
|
color='black'
|
||||||
|
cursor='pointer'
|
||||||
|
fontSize={0}
|
||||||
|
onClick={() => history.push(`/~landscape/dm/${ship}`)}
|
||||||
|
>
|
||||||
|
Send Message
|
||||||
|
</Row>
|
||||||
|
)}
|
||||||
|
</Col>
|
||||||
|
}>
|
||||||
|
<Icon icon="Menu" mr='3'/>
|
||||||
|
</Dropdown>
|
||||||
|
{(!isOwn) && (
|
||||||
|
<Icon icon="Chat" size={16} onClick={() => history.push(`/~landscape/dm/${ship}`)}/>
|
||||||
|
)}
|
||||||
|
</Row>
|
||||||
|
<Box alignSelf="center" height="72px">
|
||||||
{img}
|
{img}
|
||||||
</Box>
|
</Box>
|
||||||
<Box p='3'>
|
<Col height="3rem" alignItems="end" justifyContent="flex-end">
|
||||||
{showNickname && (
|
|
||||||
<Text
|
<Text
|
||||||
fontWeight='600'
|
fontWeight='600'
|
||||||
|
mono={!showNickname}
|
||||||
display='block'
|
display='block'
|
||||||
textOverflow='ellipsis'
|
textOverflow='ellipsis'
|
||||||
overflow='hidden'
|
overflow='hidden'
|
||||||
whiteSpace='pre'
|
whiteSpace='pre'
|
||||||
|
lineHeight="tall"
|
||||||
>
|
>
|
||||||
{contact.nickname}
|
{showNickname ? contact.nickname : cite(ship)}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
<Text
|
||||||
<Text mono gray>{cite(`~${ship}`)}</Text>
|
contentEditable={isOwn}
|
||||||
{!isOwn && (
|
display={(!contact?.status && !isOwn) ? 'none' : 'inline'}
|
||||||
<Button mt={2} fontSize='0' width="100%" style={{ cursor: 'pointer' }} onClick={() => history.push(`/~landscape/dm/${ship}`)}>
|
gray={(!contact?.status && isOwn)}
|
||||||
Send Message
|
// onBlur={() => api.contacts.edit()...}
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
{(isOwn) ? (
|
|
||||||
<Button
|
|
||||||
mt='2'
|
|
||||||
width='100%'
|
|
||||||
style={{ cursor: 'pointer ' }}
|
|
||||||
onClick={() => (isHidden) ? history.push('/~profile/identity') : history.push(`${rootSettings}/popover/profile`)}
|
|
||||||
>
|
>
|
||||||
Edit Identity
|
{(!contact?.status && isOwn) ? "Set a status" : contact.status}
|
||||||
</Button>
|
</Text>
|
||||||
) : <div />}
|
</Col>
|
||||||
</Box>
|
|
||||||
</Col>
|
</Col>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withLocalState(ProfileOverlay, ['hideAvatars', 'hideNicknames']);
|
export default withLocalState(ProfileOverlay, ['hideAvatars', 'hideNicknames']);
|
||||||
|
@ -67,7 +67,15 @@ const StatusBar = (props) => {
|
|||||||
alignY="top"
|
alignY="top"
|
||||||
alignX="right"
|
alignX="right"
|
||||||
options={
|
options={
|
||||||
<Col mt='6' p='1' backgroundColor="white" color="washedGray" border={1} borderRadius={2} borderColor="lightGray" boxShadow="0px 0px 0px 3px">
|
<Col
|
||||||
|
mt='6'
|
||||||
|
p='1'
|
||||||
|
backgroundColor="white"
|
||||||
|
color="washedGray"
|
||||||
|
border={1}
|
||||||
|
borderRadius={2}
|
||||||
|
borderColor="lightGray"
|
||||||
|
boxShadow="0px 0px 0px 3px">
|
||||||
<Row
|
<Row
|
||||||
p={1}
|
p={1}
|
||||||
color='black'
|
color='black'
|
||||||
|
@ -91,6 +91,7 @@ export class OmniboxResult extends Component {
|
|||||||
<Text
|
<Text
|
||||||
display="inline-block"
|
display="inline-block"
|
||||||
verticalAlign="middle"
|
verticalAlign="middle"
|
||||||
|
mono={(icon == 'profile' && text.startsWith('~'))}
|
||||||
color={this.state.hovered || selected === link ? 'white' : 'black'}
|
color={this.state.hovered || selected === link ? 'white' : 'black'}
|
||||||
maxWidth="60%"
|
maxWidth="60%"
|
||||||
style={{ flexShrink: 0 }}
|
style={{ flexShrink: 0 }}
|
||||||
|
Loading…
Reference in New Issue
Block a user