friends connection status system

This commit is contained in:
2026-08-26 21:44:53 +08:00
parent 74a5268420
commit 5916de9a91
15 changed files with 722 additions and 56 deletions
+14 -1
View File
@@ -2,6 +2,7 @@
import { onMount } from "svelte";
import Popover from "$lib/components/popover.svelte";
import { friends } from "$lib/listeners/friends";
import { onlineFriendIds } from "$lib/listeners/friend-statuses";
import { incomingInteraction } from "$lib/listeners/interactions";
import { liveMetadata } from "$lib/listeners/live-metadata";
import { profile } from "$lib/listeners/profile";
@@ -28,6 +29,18 @@
return () => window.clearTimeout(timer);
});
$effect(() => {
if (
selectedUserId &&
selectedUserId !== $liveMetadata.localId &&
!$onlineFriendIds.has(selectedUserId)
) {
selectedUserId = null;
selectedUserX = null;
lockedPopoverUserId = null;
}
});
function displayName(userId: string) {
return $profile?.id === userId
? $profile.displayName
@@ -65,7 +78,7 @@
{@const popoverId = `scene-user-${index}`}
{@const interaction =
$incomingInteraction?.friendId === userId ? $incomingInteraction : null}
{#if cursor}
{#if cursor && (userId === $liveMetadata.localId || $onlineFriendIds.has(userId))}
{@const renderedX =
selectedUserId === userId ? selectedUserX : cursor.mapped.x}
<div