mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-21 22:50:59 -05:00
chore: monkey patch ulid parse error
This commit is contained in:
parent
9b9ec867da
commit
70f5e6fc7e
1 changed files with 10 additions and 1 deletions
|
@ -17,6 +17,7 @@ import { Bar } from "./JumpToBottom";
|
||||||
export default observer(
|
export default observer(
|
||||||
({ channel, last_id }: { channel: Channel; last_id?: string }) => {
|
({ channel, last_id }: { channel: Channel; last_id?: string }) => {
|
||||||
const [hidden, setHidden] = useState(false);
|
const [hidden, setHidden] = useState(false);
|
||||||
|
const [timeAgo, setTimeAgo] = useState("");
|
||||||
const hide = () => setHidden(true);
|
const hide = () => setHidden(true);
|
||||||
|
|
||||||
useEffect(() => setHidden(false), [last_id]);
|
useEffect(() => setHidden(false), [last_id]);
|
||||||
|
@ -29,6 +30,14 @@ export default observer(
|
||||||
return () => document.removeEventListener("keydown", onKeyDown);
|
return () => document.removeEventListener("keydown", onKeyDown);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (last_id) {
|
||||||
|
try {
|
||||||
|
setTimeAgo(dayjs(decodeTime(last_id)).fromNow());
|
||||||
|
} catch (err) {}
|
||||||
|
}
|
||||||
|
}, [last_id]);
|
||||||
|
|
||||||
const renderer = getRenderer(channel);
|
const renderer = getRenderer(channel);
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
if (renderer.state !== "RENDER") return null;
|
if (renderer.state !== "RENDER") return null;
|
||||||
|
@ -52,7 +61,7 @@ export default observer(
|
||||||
<Text
|
<Text
|
||||||
id="app.main.channel.misc.new_messages"
|
id="app.main.channel.misc.new_messages"
|
||||||
fields={{
|
fields={{
|
||||||
time_ago: dayjs(decodeTime(last_id)).fromNow(),
|
time_ago: timeAgo,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue