Adjust copy in loading screen

This commit is contained in:
Fedor Indutny 2023-03-29 09:47:06 -07:00 committed by GitHub
parent 7dc4a53600
commit 18a6da310f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 19 deletions

View file

@ -55,16 +55,18 @@ const Template: Story<PropsType & { daysAgo?: number }> = ({
...args
}) => {
const now = useMemo(() => Date.now(), []);
const [offset, setOffset] = useState(0);
const [dayOffset, setDayOffset] = useState(0);
useEffect(() => {
if (daysAgo === undefined) {
setOffset(0);
setDayOffset(0);
return noop;
}
const interval = setInterval(() => {
setOffset(prevValue => (prevValue + 1 / 4) % daysAgo);
// Increment day offset by 1 / 24 of a day (an hour), and wrap it when it
// reaches `daysAgo` value.
setDayOffset(prevValue => (prevValue + 1 / 24) % daysAgo);
}, SECOND / 10);
return () => clearInterval(interval);
@ -75,7 +77,7 @@ const Template: Story<PropsType & { daysAgo?: number }> = ({
const envelopeTimestamp =
firstEnvelopeTimestamp === undefined
? undefined
: firstEnvelopeTimestamp + offset * DAY;
: firstEnvelopeTimestamp + dayOffset * DAY;
return (
<Inbox