feat: new replies

This commit is contained in:
trashtemp 2022-01-21 00:02:55 +01:00
parent 6e89e10461
commit 0de078a794
No known key found for this signature in database
GPG key ID: D1F0DB65081B0FC6
5 changed files with 107 additions and 78 deletions

2
external/lang vendored

@ -1 +1 @@
Subproject commit d6c59b4665ec9fd0b47797b3bf82e458bc65ff51 Subproject commit 699af07d7b8806b4790b187a38987089ae99af25

View file

@ -56,6 +56,7 @@ export type UploadState =
| { type: "failed"; files: File[]; error: string }; | { type: "failed"; files: File[]; error: string };
const Base = styled.div` const Base = styled.div`
z-index: 10;
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
background: var(--message-box); background: var(--message-box);

View file

@ -28,30 +28,24 @@ export const ReplyBase = styled.div<{
fail?: boolean; fail?: boolean;
preview?: boolean; preview?: boolean;
}>` }>`
gap: 4px; gap: 8px;
min-width: 0; min-width: 0;
display: flex; display: flex;
margin-inline-start: 30px; margin-inline-start: 30px;
margin-inline-end: 12px; margin-inline-end: 12px;
font-size: 0.8em; font-size: 0.8em;
user-select: none; user-select: none;
align-items: center; align-items: end;
color: var(--secondary-foreground); color: var(--secondary-foreground);
/* nizune's Discord replies,
does not scale properly with messages,
reverted temporarily
&::before { &::before {
content: ""; content: "";
width: 22px;
height: 10px; height: 10px;
width: 28px; border-inline-start: 3px solid #4f515d;
margin-inline-end: 2px; border-top: 3px solid #4f515d;
align-self: flex-end; align-self: flex-end;
display: flex; }
border-top: 2.2px solid var(--tertiary-foreground);
border-inline-start: 2.2px solid var(--tertiary-foreground);
border-start-start-radius: 6px;
}*/
* { * {
overflow: hidden; overflow: hidden;
@ -75,13 +69,6 @@ export const ReplyBase = styled.div<{
text-decoration: underline; text-decoration: underline;
} }
} }
/*&::before {
position:relative;
width: 50px;
height: 2px;
background: red;
}*/
} }
.content { .content {
@ -120,10 +107,6 @@ export const ReplyBase = styled.div<{
> * { > * {
pointer-events: none; pointer-events: none;
} }
/*> span > p {
display: flex;
}*/
} }
> svg:first-child { > svg:first-child {
@ -142,6 +125,10 @@ export const ReplyBase = styled.div<{
props.head && props.head &&
css` css`
margin-top: 12px; margin-top: 12px;
&::before {
border-start-start-radius: 4px;
}
`} `}
${(props) => ${(props) =>
@ -184,7 +171,8 @@ export const MessageReply = observer(
return ( return (
<ReplyBase head={index === 0}> <ReplyBase head={index === 0}>
<Reply size={16} /> {/*<Reply size={16} />*/}
{message.author?.relationship === RelationshipStatus.Blocked ? ( {message.author?.relationship === RelationshipStatus.Blocked ? (
<Text id="app.main.channel.misc.blocked_user" /> <Text id="app.main.channel.misc.blocked_user" />
) : ( ) : (
@ -195,7 +183,7 @@ export const MessageReply = observer(
<> <>
<div className="user"> <div className="user">
<UserShort <UserShort
size={16} size={14}
showServerIdentity showServerIdentity
user={message.author} user={message.author}
masquerade={message.masquerade!} masquerade={message.masquerade!}

View file

@ -10,7 +10,7 @@ import { isTouchscreenDevice } from "../../../../lib/isTouchscreenDevice";
import { getRenderer } from "../../../../lib/renderer/Singleton"; import { getRenderer } from "../../../../lib/renderer/Singleton";
export const Bar = styled.div<{ position: "top" | "bottom"; accent?: boolean }>` export const Bar = styled.div<{ position: "top" | "bottom"; accent?: boolean }>`
z-index: 10; z-index: 1;
position: relative; position: relative;
${(props) => ${(props) =>

View file

@ -14,6 +14,7 @@ import { useApplicationState } from "../../../../mobx/State";
import { SECTION_MENTION } from "../../../../mobx/stores/Layout"; import { SECTION_MENTION } from "../../../../mobx/stores/Layout";
import { Reply } from "../../../../mobx/stores/MessageQueue"; import { Reply } from "../../../../mobx/stores/MessageQueue";
import Tooltip from "../../../common/Tooltip";
import IconButton from "../../../ui/IconButton"; import IconButton from "../../../ui/IconButton";
import Markdown from "../../../markdown/Markdown"; import Markdown from "../../../markdown/Markdown";
@ -28,12 +29,30 @@ interface Props {
} }
const Base = styled.div` const Base = styled.div`
@keyframes bounce-from-bottom {
0% {
transform: translateY(33px);
}
100% {
transform: translateY(0px);
}
}
display: flex; display: flex;
height: 30px; height: 30px;
padding: 0 12px; padding: 0 20px;
user-select: none; user-select: none;
align-items: center; align-items: center;
background: var(--message-box); /*background: var(--message-box);*/
background: var(--secondary-background);
/*animation: fadeIn 5s;*/
animation-name: bounce-from-bottom;
animation-duration: 340ms;
animation-delay: 0ms;
animation-timing-function: cubic-bezier(0.2, 0.9, 0.5, 1.16);
animation-fill-mode: forwards;
> div { > div {
flex-grow: 1; flex-grow: 1;
@ -49,11 +68,20 @@ const Base = styled.div`
display: flex; display: flex;
font-size: 12px; font-size: 12px;
align-items: center; align-items: center;
font-weight: 600; font-weight: 800;
text-transform: uppercase; text-transform: uppercase;
min-width: 6ch; min-width: 6ch;
} }
.replyto {
align-self: center;
font-weight: 500;
}
.content {
display: flex;
pointer-events: none;
.username { .username {
display: flex; display: flex;
align-items: center; align-items: center;
@ -64,6 +92,8 @@ const Base = styled.div`
.message { .message {
display: flex; display: flex;
max-height: 26px; max-height: 26px;
gap: 4px;
}
} }
.actions { .actions {
@ -129,7 +159,10 @@ export default observer(({ channel, replies, setReplies }: Props) => {
return ( return (
<Base key={reply.id}> <Base key={reply.id}>
<ReplyBase preview> <ReplyBase preview>
<ReplyIcon size={22} /> <div class="replyto">
<Text id="app.main.channel.replying" />
</div>
<div class="content">
<div class="username"> <div class="username">
<UserShort <UserShort
size={16} size={16}
@ -143,7 +176,8 @@ export default observer(({ channel, replies, setReplies }: Props) => {
<> <>
<File size={16} /> <File size={16} />
<em> <em>
{message.attachments.length > 1 ? ( {message.attachments.length >
1 ? (
<Text id="app.main.channel.misc.sent_multiple_files" /> <Text id="app.main.channel.misc.sent_multiple_files" />
) : ( ) : (
<Text id="app.main.channel.misc.sent_file" /> <Text id="app.main.channel.misc.sent_file" />
@ -153,7 +187,10 @@ export default observer(({ channel, replies, setReplies }: Props) => {
)} )}
{message.author_id === {message.author_id ===
"00000000000000000000000000" ? ( "00000000000000000000000000" ? (
<SystemMessage message={message} hideInfo /> <SystemMessage
message={message}
hideInfo
/>
) : ( ) : (
<Markdown <Markdown
disallowBigEmoji disallowBigEmoji
@ -163,6 +200,7 @@ export default observer(({ channel, replies, setReplies }: Props) => {
/> />
)} )}
</div> </div>
</div>
</ReplyBase> </ReplyBase>
<span class="actions"> <span class="actions">
{message.author_id !== client.user!._id && ( {message.author_id !== client.user!._id && (
@ -189,6 +227,7 @@ export default observer(({ channel, replies, setReplies }: Props) => {
false, false,
); );
}}> }}>
<Tooltip content="Toggle author ping">
<span class="toggle"> <span class="toggle">
<At size={15} /> <At size={15} />
<Text <Text
@ -199,6 +238,7 @@ export default observer(({ channel, replies, setReplies }: Props) => {
} }
/> />
</span> </span>
</Tooltip>
</IconButton> </IconButton>
)} )}
<IconButton <IconButton