see your own pet
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
import { listen } from "@tauri-apps/api/event";
|
import { listen } from "@tauri-apps/api/event";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import type { AppMetadata } from "../../types/bindings/AppMetadata";
|
import type { AppMetadata } from "../../types/bindings/AppMetadata";
|
||||||
|
import type { DollDto } from "../../types/bindings/DollDto";
|
||||||
|
|
||||||
let innerWidth = $state(0);
|
let innerWidth = $state(0);
|
||||||
let innerHeight = $state(0);
|
let innerHeight = $state(0);
|
||||||
@@ -36,6 +37,12 @@
|
|||||||
return $friendsUserStatuses[userId];
|
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);
|
let appMetadata: AppMetadata | null = $state(null);
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
@@ -145,5 +152,21 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/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>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -170,7 +170,9 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<button
|
<button
|
||||||
|
disabled={!isInteractive}
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
|
if (!isInteractive) return;
|
||||||
isPetMenuOpen = !isPetMenuOpen;
|
isPetMenuOpen = !isPetMenuOpen;
|
||||||
if (!isPetMenuOpen) {
|
if (!isPetMenuOpen) {
|
||||||
// Clear message when closing menu manually
|
// Clear message when closing menu manually
|
||||||
|
|||||||
Reference in New Issue
Block a user