mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 04:52:06 +03:00
interface: only display our contact when appropriate
This commit is contained in:
parent
249b7555bc
commit
70866fb7c5
@ -139,9 +139,6 @@ export function ChatResource(props: ChatResourceProps) {
|
|||||||
return <Loading />;
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const modifiedContacts = { ...contacts };
|
|
||||||
delete modifiedContacts[`~${window.ship}`];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col {...bind} height="100%" overflow="hidden" position="relative">
|
<Col {...bind} height="100%" overflow="hidden" position="relative">
|
||||||
<ShareProfile
|
<ShareProfile
|
||||||
@ -160,10 +157,7 @@ export function ChatResource(props: ChatResourceProps) {
|
|||||||
history={props.history}
|
history={props.history}
|
||||||
graph={graph}
|
graph={graph}
|
||||||
unreadCount={unreadCount}
|
unreadCount={unreadCount}
|
||||||
contacts={
|
showOurContact={ !showBanner && hasLoadedAllowed }
|
||||||
(!showBanner && hasLoadedAllowed) ?
|
|
||||||
contacts : modifiedContacts
|
|
||||||
}
|
|
||||||
association={props.association}
|
association={props.association}
|
||||||
pendingSize={Object.keys(graphTimesentMap[graphPath] || {}).length}
|
pendingSize={Object.keys(graphTimesentMap[graphPath] || {}).length}
|
||||||
group={group}
|
group={group}
|
||||||
@ -181,9 +175,6 @@ export function ChatResource(props: ChatResourceProps) {
|
|||||||
(!showBanner && hasLoadedAllowed) ? ourContact : null
|
(!showBanner && hasLoadedAllowed) ? ourContact : null
|
||||||
}
|
}
|
||||||
envelopes={[]}
|
envelopes={[]}
|
||||||
contacts={
|
|
||||||
(!showBanner && hasLoadedAllowed) ? contacts : modifiedContacts
|
|
||||||
}
|
|
||||||
onUnmount={appendUnsent}
|
onUnmount={appendUnsent}
|
||||||
placeholder="Message..."
|
placeholder="Message..."
|
||||||
message={unsent[station] || ''}
|
message={unsent[station] || ''}
|
||||||
|
@ -263,6 +263,7 @@ class ChatMessage extends Component<ChatMessageProps> {
|
|||||||
history,
|
history,
|
||||||
api,
|
api,
|
||||||
highlighted,
|
highlighted,
|
||||||
|
showOurContact,
|
||||||
fontSize
|
fontSize
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
@ -295,6 +296,7 @@ class ChatMessage extends Component<ChatMessageProps> {
|
|||||||
style,
|
style,
|
||||||
containerClass,
|
containerClass,
|
||||||
isPending,
|
isPending,
|
||||||
|
showOurContact,
|
||||||
history,
|
history,
|
||||||
api,
|
api,
|
||||||
scrollWindow,
|
scrollWindow,
|
||||||
@ -355,6 +357,7 @@ export const MessageAuthor = ({
|
|||||||
api,
|
api,
|
||||||
history,
|
history,
|
||||||
scrollWindow,
|
scrollWindow,
|
||||||
|
showOurContact,
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
const osDark = useLocalState((state) => state.dark);
|
const osDark = useLocalState((state) => state.dark);
|
||||||
@ -367,7 +370,11 @@ export const MessageAuthor = ({
|
|||||||
.unix(msg['time-sent'] / 1000)
|
.unix(msg['time-sent'] / 1000)
|
||||||
.format(DATESTAMP_FORMAT);
|
.format(DATESTAMP_FORMAT);
|
||||||
const contact =
|
const contact =
|
||||||
`~${msg.author}` in contacts ? contacts[`~${msg.author}`] : false;
|
( ( (msg.author === window.ship && showOurContact) ||
|
||||||
|
msg.author !== window.ship) &&
|
||||||
|
`~${msg.author}` in contacts
|
||||||
|
) ? contacts[`~${msg.author}`] : false;
|
||||||
|
|
||||||
const showNickname = useShowNickname(contact);
|
const showNickname = useShowNickname(contact);
|
||||||
const { hideAvatars } = useSettingsState(selectCalmState);
|
const { hideAvatars } = useSettingsState(selectCalmState);
|
||||||
const shipName = showNickname ? contact.nickname : cite(msg.author);
|
const shipName = showNickname ? contact.nickname : cite(msg.author);
|
||||||
|
@ -209,7 +209,7 @@ class ChatWindow extends Component<
|
|||||||
api,
|
api,
|
||||||
association,
|
association,
|
||||||
group,
|
group,
|
||||||
contacts,
|
showOurContact,
|
||||||
graph,
|
graph,
|
||||||
history,
|
history,
|
||||||
groups,
|
groups,
|
||||||
@ -219,13 +219,14 @@ class ChatWindow extends Component<
|
|||||||
const messageProps = {
|
const messageProps = {
|
||||||
association,
|
association,
|
||||||
group,
|
group,
|
||||||
contacts,
|
showOurContact,
|
||||||
unreadMarkerRef,
|
unreadMarkerRef,
|
||||||
history,
|
history,
|
||||||
api,
|
api,
|
||||||
groups,
|
groups,
|
||||||
associations
|
associations
|
||||||
};
|
};
|
||||||
|
|
||||||
const msg = graph.get(index)?.post;
|
const msg = graph.get(index)?.post;
|
||||||
if (!msg) return null;
|
if (!msg) return null;
|
||||||
if (!this.state.initialized) {
|
if (!this.state.initialized) {
|
||||||
@ -256,6 +257,7 @@ class ChatWindow extends Component<
|
|||||||
msg,
|
msg,
|
||||||
...messageProps
|
...messageProps
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ChatMessage
|
<ChatMessage
|
||||||
key={index.toString()}
|
key={index.toString()}
|
||||||
@ -277,6 +279,7 @@ class ChatWindow extends Component<
|
|||||||
history,
|
history,
|
||||||
groups,
|
groups,
|
||||||
associations,
|
associations,
|
||||||
|
showOurContact,
|
||||||
pendingSize
|
pendingSize
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
@ -292,6 +295,9 @@ class ChatWindow extends Component<
|
|||||||
const unreadIndex = graph.keys()[this.props.unreadCount];
|
const unreadIndex = graph.keys()[this.props.unreadCount];
|
||||||
const unreadMsg = unreadIndex && graph.get(unreadIndex);
|
const unreadMsg = unreadIndex && graph.get(unreadIndex);
|
||||||
|
|
||||||
|
const contactsModified =
|
||||||
|
showOurContact ? 0 : 100;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col height='100%' overflow='hidden' position='relative'>
|
<Col height='100%' overflow='hidden' position='relative'>
|
||||||
<UnreadNotice
|
<UnreadNotice
|
||||||
@ -317,7 +323,7 @@ class ChatWindow extends Component<
|
|||||||
onScroll={this.onScroll}
|
onScroll={this.onScroll}
|
||||||
data={graph}
|
data={graph}
|
||||||
size={graph.size}
|
size={graph.size}
|
||||||
pendingSize={pendingSize}
|
pendingSize={pendingSize + contactsModified}
|
||||||
id={association.resource}
|
id={association.resource}
|
||||||
averageHeight={22}
|
averageHeight={22}
|
||||||
renderer={this.renderer}
|
renderer={this.renderer}
|
||||||
|
Loading…
Reference in New Issue
Block a user