fix(offline indicator): change last online check from 30 to 60 minutes for a better estimate

This commit is contained in:
Tom (plebeius.eth)
2024-06-22 18:26:28 +02:00
parent a82f6f3e00
commit dbb91bf16c
3 changed files with 3 additions and 3 deletions

View File

@@ -135,7 +135,7 @@ const Sidebar = ({ comment, isSubCreatedButNotYetPublished, settings, subplebbit
const { cid, downvoteCount, timestamp, upvoteCount } = comment || {};
const { allActiveUserCount, hourActiveUserCount } = useSubplebbitStats({ subplebbitAddress: address });
const isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 30;
const isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 60;
const onlineNotice = t('users_online', { count: hourActiveUserCount });
const offlineNotice = updatedAt && t('posts_last_synced', { dateAgo: getFormattedTimeAgo(updatedAt) });
const onlineStatus = isOnline ? onlineNotice : offlineNotice;

View File

@@ -42,7 +42,7 @@ const Subplebbit = () => {
</>
);
let isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 30;
let isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 60;
const isSubCreatedButNotYetPublished = typeof createdAt === 'number' && !updatedAt;
const { blocked } = useBlock({ address: subplebbitAddress });

View File

@@ -130,7 +130,7 @@ const Subplebbit = ({ subplebbit }: SubplebbitProps) => {
const postScore = upvoteCount === 0 && downvoteCount === 0 ? '•' : upvoteCount - downvoteCount || '•';
const { allActiveUserCount } = useSubplebbitStats({ subplebbitAddress: address });
const isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 30;
const isOnline = updatedAt && updatedAt > Date.now() / 1000 - 60 * 60;
return (
<div className={styles.subplebbit}>