Merge pull request #93 from cheeaun/main

Update from main
This commit is contained in:
Chee Aun 2023-04-03 09:28:40 +08:00 committed by GitHub
commit 4e50f227d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1030,19 +1030,18 @@ function Status({
onClick={replyStatus} onClick={replyStatus}
/> />
</div> </div>
{canBoost && ( <div class="action has-count">
<div class="action has-count"> <StatusButton
<StatusButton checked={reblogged}
checked={reblogged} title={['Boost', 'Unboost']}
title={['Boost', 'Unboost']} alt={['Boost', 'Boosted']}
alt={['Boost', 'Boosted']} class="reblog-button"
class="reblog-button" icon="rocket"
icon="rocket" count={reblogsCount}
count={reblogsCount} onClick={boostStatus}
onClick={boostStatus} disabled={!canBoost}
/> />
</div> </div>
)}
<div class="action has-count"> <div class="action has-count">
<StatusButton <StatusButton
checked={favourited} checked={favourited}
@ -1280,24 +1279,26 @@ function Poll({
const expiresAtDate = !!expiresAt && new Date(expiresAt); const expiresAtDate = !!expiresAt && new Date(expiresAt);
// Update poll at point of expiry // Update poll at point of expiry
useEffect(() => { // NOTE: Disable this because setTimeout runs immediately if delay is too large
let timeout; // https://stackoverflow.com/a/56718027/20838
if (!expired && expiresAtDate) { // useEffect(() => {
const ms = expiresAtDate.getTime() - Date.now() + 1; // +1 to give it a little buffer // let timeout;
if (ms > 0) { // if (!expired && expiresAtDate) {
timeout = setTimeout(() => { // const ms = expiresAtDate.getTime() - Date.now() + 1; // +1 to give it a little buffer
setUIState('loading'); // if (ms > 0) {
(async () => { // timeout = setTimeout(() => {
await refresh(); // setUIState('loading');
setUIState('default'); // (async () => {
})(); // // await refresh();
}, ms); // setUIState('default');
} // })();
} // }, ms);
return () => { // }
clearTimeout(timeout); // }
}; // return () => {
}, [expired, expiresAtDate]); // clearTimeout(timeout);
// };
// }, [expired, expiresAtDate]);
const pollVotesCount = votersCount || votesCount; const pollVotesCount = votersCount || votesCount;
let roundPrecision = 0; let roundPrecision = 0;