see your own pet
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { onMount } from "svelte";
|
||||
import type { AppMetadata } from "../../types/bindings/AppMetadata";
|
||||
import type { DollDto } from "../../types/bindings/DollDto";
|
||||
|
||||
let innerWidth = $state(0);
|
||||
let innerHeight = $state(0);
|
||||
@@ -36,6 +37,12 @@
|
||||
return $friendsUserStatuses[userId];
|
||||
}
|
||||
|
||||
function getUserDoll(): DollDto | undefined {
|
||||
const user = $appData?.user;
|
||||
if (!user || !user.activeDollId) return undefined;
|
||||
return $appData?.dolls?.find((d) => d.id === user.activeDollId);
|
||||
}
|
||||
|
||||
let appMetadata: AppMetadata | null = $state(null);
|
||||
|
||||
onMount(() => {
|
||||
@@ -145,5 +152,21 @@
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
{#if $appData?.user && getUserDoll()}
|
||||
<DesktopPet
|
||||
id={$appData.user.id}
|
||||
targetX={$cursorPositionOnScreen.mapped.x * innerWidth}
|
||||
targetY={$cursorPositionOnScreen.mapped.y * innerHeight}
|
||||
user={{
|
||||
id: $appData.user.id,
|
||||
name: $appData.user.name,
|
||||
username: $appData.user.username,
|
||||
activeDoll: getUserDoll() ?? null,
|
||||
}}
|
||||
userStatus={undefined}
|
||||
doll={getUserDoll()}
|
||||
isInteractive={false}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -170,7 +170,9 @@
|
||||
</div>
|
||||
{/if}
|
||||
<button
|
||||
disabled={!isInteractive}
|
||||
onclick={() => {
|
||||
if (!isInteractive) return;
|
||||
isPetMenuOpen = !isPetMenuOpen;
|
||||
if (!isPetMenuOpen) {
|
||||
// Clear message when closing menu manually
|
||||
|
||||
Reference in New Issue
Block a user