mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 09:25:27 +00:00
Fix: Emojis showing through spoilers.
Fix: Copy ID copies wrong ID. Messaging: Add context menu to avatar / username.
This commit is contained in:
2
external/lang
vendored
2
external/lang
vendored
Submodule external/lang updated: 755f35fcdd...099fb74131
@@ -32,6 +32,8 @@ function Message({ attachContext, message, contrast, content: replacement, head:
|
|||||||
|
|
||||||
const content = message.content as string;
|
const content = message.content as string;
|
||||||
const head = preferHead || (message.replies && message.replies.length > 0);
|
const head = preferHead || (message.replies && message.replies.length > 0);
|
||||||
|
const userContext = attachContext ? attachContextMenu('Menu', { user: message.author, contextualChannel: message.channel }) : undefined as any; // ! FIXME: tell fatal to make this type generic
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{ message.replies?.map((message_id, index) => <MessageReply index={index} id={message_id} channel={message.channel} />) }
|
{ message.replies?.map((message_id, index) => <MessageReply index={index} id={message_id} channel={message.channel} />) }
|
||||||
@@ -44,12 +46,14 @@ function Message({ attachContext, message, contrast, content: replacement, head:
|
|||||||
onContextMenu={attachContext ? attachContextMenu('Menu', { message, contextualChannel: message.channel, queued }) : undefined}>
|
onContextMenu={attachContext ? attachContextMenu('Menu', { message, contextualChannel: message.channel, queued }) : undefined}>
|
||||||
<MessageInfo>
|
<MessageInfo>
|
||||||
{ head ?
|
{ head ?
|
||||||
<UserIcon target={user} size={36} /> :
|
<UserIcon target={user} size={36} onContextMenu={userContext} /> :
|
||||||
<MessageDetail message={message} position="left" /> }
|
<MessageDetail message={message} position="left" /> }
|
||||||
</MessageInfo>
|
</MessageInfo>
|
||||||
<MessageContent>
|
<MessageContent>
|
||||||
{ head && <span className="author">
|
{ head && <span className="detail">
|
||||||
<Username user={user} />
|
<span className="author">
|
||||||
|
<Username user={user} onContextMenu={userContext} />
|
||||||
|
</span>
|
||||||
<MessageDetail message={message} position="top" />
|
<MessageDetail message={message} position="top" />
|
||||||
</span> }
|
</span> }
|
||||||
{ replacement ?? <Markdown content={content} /> }
|
{ replacement ?? <Markdown content={content} /> }
|
||||||
|
|||||||
@@ -53,12 +53,20 @@ export default styled.div<BaseMessageProps>`
|
|||||||
color: var(--error);
|
color: var(--error);
|
||||||
` }
|
` }
|
||||||
|
|
||||||
.author {
|
.detail {
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.author {
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.copy {
|
.copy {
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
@@ -89,6 +97,10 @@ export const MessageInfo = styled.div`
|
|||||||
color: var(--tertiary-foreground);
|
color: var(--tertiary-foreground);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
time {
|
time {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { User } from "revolt.js";
|
|||||||
import UserIcon from "./UserIcon";
|
import UserIcon from "./UserIcon";
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
|
|
||||||
export function Username({ user }: { user?: User }) {
|
export function Username({ user, ...otherProps }: { user?: User } & JSX.HTMLAttributes<HTMLElement>) {
|
||||||
return <b>{ user?.username ?? <Text id="app.main.channel.unknown_user" /> }</b>;
|
return <b {...otherProps}>{ user?.username ?? <Text id="app.main.channel.unknown_user" /> }</b>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function UserShort({ user, size }: { user?: User, size?: number }) {
|
export default function UserShort({ user, size }: { user?: User, size?: number }) {
|
||||||
|
|||||||
@@ -115,15 +115,23 @@
|
|||||||
padding: 0 2px;
|
padding: 0 2px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
color: transparent;
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
color: transparent;
|
||||||
background: #151515;
|
background: #151515;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
&:global(.shown) {
|
&:global(.shown) {
|
||||||
cursor: auto;
|
cursor: auto;
|
||||||
user-select: all;
|
user-select: all;
|
||||||
color: var(--foreground);
|
color: var(--foreground);
|
||||||
background: var(--secondary-background);
|
background: var(--secondary-background);
|
||||||
|
|
||||||
|
> * {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,8 +97,7 @@ export function ChannelButton({ active, alert, alertCount, channel, user, compac
|
|||||||
const { openScreen } = useIntermediate();
|
const { openScreen } = useIntermediate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div data-active={active}
|
||||||
data-active={active}
|
|
||||||
data-alert={typeof alert === 'string'}
|
data-alert={typeof alert === 'string'}
|
||||||
className={classNames(styles.item, { [styles.compact]: compact })}
|
className={classNames(styles.item, { [styles.compact]: compact })}
|
||||||
onContextMenu={attachContextMenu('Menu', { channel: channel._id, unread: typeof channel.unread !== 'undefined' })}>
|
onContextMenu={attachContextMenu('Menu', { channel: channel._id, unread: typeof channel.unread !== 'undefined' })}>
|
||||||
|
|||||||
@@ -562,7 +562,7 @@ function ContextMenus(props: WithDispatcher) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let id = server?._id ?? channel?._id ?? user?._id ?? message?._id;
|
let id = sid ?? cid ?? uid ?? message?._id;
|
||||||
if (id) {
|
if (id) {
|
||||||
pushDivider();
|
pushDivider();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user