Fix: Set head = true as we tick over midnight.

Re-design blocked messages.
This commit is contained in:
Paul 2021-07-03 23:51:15 +01:00
parent a628b0acd1
commit 841320aab7
2 changed files with 17 additions and 4 deletions

2
external/lang vendored

@ -1 +1 @@
Subproject commit 9bb62d1185f7e6f7a3821751797e30cb41e74bf8
Subproject commit 24766f8f5c2147ba866af922e3f5f42ad3ea44e4

View file

@ -1,8 +1,10 @@
import { decodeTime } from "ulid";
import { memo } from "preact/compat";
import { defer } from "../../../lib/defer";
import styled from "styled-components";
import MessageEditor from "./MessageEditor";
import { Children } from "../../../types/Preact";
import { Users } from "revolt.js/dist/api/objects";
import { X } from "@styled-icons/boxicons-regular";
import ConversationStart from "./ConversationStart";
import { connectState } from "../../../redux/connector";
import Preloader from "../../../components/ui/Preloader";
@ -16,7 +18,6 @@ import { AppContext } from "../../../context/revoltjs/RevoltClient";
import RequiresOnline from "../../../context/revoltjs/RequiresOnline";
import { internalSubscribe, internalEmit } from "../../../lib/eventEmitter";
import { SystemMessage } from "../../../components/common/messaging/SystemMessage";
import { Users } from "revolt.js/dist/api/objects";
interface Props {
id: string;
@ -24,6 +25,17 @@ interface Props {
queue: QueuedMessage[];
}
const BlockedMessage = styled.div`
font-size: 0.8em;
margin-top: 6px;
padding: 4px 64px;
color: var(--tertiary-foreground);
&:hover {
background: var(--hover);
}
`;
function MessageRenderer({ id, state, queue }: Props) {
if (state.type !== 'RENDER') return null;
@ -86,6 +98,7 @@ function MessageRenderer({ id, state, queue }: Props) {
adate.getDate() !== bdate.getDate()
) {
render.push(<DateDivider date={adate} />);
head = true;
}
head = curAuthor !== prevAuthor || Math.abs(btime - atime) >= 420000;
@ -93,7 +106,7 @@ function MessageRenderer({ id, state, queue }: Props) {
let blocked = 0;
function pushBlocked() {
render.push(<span>{ blocked } blocked messages</span>);
render.push(<BlockedMessage><X size={16} /> { blocked } blocked messages</BlockedMessage>);
blocked = 0;
}