mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-12 18:29:57 -05:00
Fix: Set head = true as we tick over midnight.
Re-design blocked messages.
This commit is contained in:
parent
a628b0acd1
commit
841320aab7
2 changed files with 17 additions and 4 deletions
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 9bb62d1185f7e6f7a3821751797e30cb41e74bf8
|
Subproject commit 24766f8f5c2147ba866af922e3f5f42ad3ea44e4
|
|
@ -1,8 +1,10 @@
|
||||||
import { decodeTime } from "ulid";
|
import { decodeTime } from "ulid";
|
||||||
import { memo } from "preact/compat";
|
import { memo } from "preact/compat";
|
||||||
import { defer } from "../../../lib/defer";
|
import styled from "styled-components";
|
||||||
import MessageEditor from "./MessageEditor";
|
import MessageEditor from "./MessageEditor";
|
||||||
import { Children } from "../../../types/Preact";
|
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 ConversationStart from "./ConversationStart";
|
||||||
import { connectState } from "../../../redux/connector";
|
import { connectState } from "../../../redux/connector";
|
||||||
import Preloader from "../../../components/ui/Preloader";
|
import Preloader from "../../../components/ui/Preloader";
|
||||||
|
@ -16,7 +18,6 @@ import { AppContext } from "../../../context/revoltjs/RevoltClient";
|
||||||
import RequiresOnline from "../../../context/revoltjs/RequiresOnline";
|
import RequiresOnline from "../../../context/revoltjs/RequiresOnline";
|
||||||
import { internalSubscribe, internalEmit } from "../../../lib/eventEmitter";
|
import { internalSubscribe, internalEmit } from "../../../lib/eventEmitter";
|
||||||
import { SystemMessage } from "../../../components/common/messaging/SystemMessage";
|
import { SystemMessage } from "../../../components/common/messaging/SystemMessage";
|
||||||
import { Users } from "revolt.js/dist/api/objects";
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -24,6 +25,17 @@ interface Props {
|
||||||
queue: QueuedMessage[];
|
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) {
|
function MessageRenderer({ id, state, queue }: Props) {
|
||||||
if (state.type !== 'RENDER') return null;
|
if (state.type !== 'RENDER') return null;
|
||||||
|
|
||||||
|
@ -86,6 +98,7 @@ function MessageRenderer({ id, state, queue }: Props) {
|
||||||
adate.getDate() !== bdate.getDate()
|
adate.getDate() !== bdate.getDate()
|
||||||
) {
|
) {
|
||||||
render.push(<DateDivider date={adate} />);
|
render.push(<DateDivider date={adate} />);
|
||||||
|
head = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
head = curAuthor !== prevAuthor || Math.abs(btime - atime) >= 420000;
|
head = curAuthor !== prevAuthor || Math.abs(btime - atime) >= 420000;
|
||||||
|
@ -93,7 +106,7 @@ function MessageRenderer({ id, state, queue }: Props) {
|
||||||
|
|
||||||
let blocked = 0;
|
let blocked = 0;
|
||||||
function pushBlocked() {
|
function pushBlocked() {
|
||||||
render.push(<span>{ blocked } blocked messages</span>);
|
render.push(<BlockedMessage><X size={16} /> { blocked } blocked messages</BlockedMessage>);
|
||||||
blocked = 0;
|
blocked = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue