Skip to content

Commit

Permalink
chore: Update avatar stack time status
Browse files Browse the repository at this point in the history
  • Loading branch information
Arti M authored and artismarti committed Jul 18, 2023
1 parent 342ca39 commit 54f4a3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions demo/app/components/avatar-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import type { SpaceMember } from '../../../src/Space';

dayjs.extend(relativeTime);

const updateStatusTime = (statusEl: Element, timestamp: number) =>
(statusEl.innerHTML = `Left ${dayjs().to(timestamp)}`);
const updateStatusTime = (statusEl, timestamp) => {
const diffInSeconds = dayjs().diff(timestamp, 'second');
statusEl.innerHTML = `Last seen ${diffInSeconds} second${diffInSeconds === 1 ? '' : 's'} ago`;
};

const changeStatusIndicator = (fragment, isConnected, lastEvent) => {
const statusIndicatorEl = queryDataId(fragment, 'avatar-status-indicator');
Expand Down

0 comments on commit 54f4a3b

Please sign in to comment.