exposed user to pet-menu
This commit is contained in:
@@ -49,10 +49,7 @@
|
|||||||
initialX={position.raw.x}
|
initialX={position.raw.x}
|
||||||
initialY={position.raw.y}
|
initialY={position.raw.y}
|
||||||
>
|
>
|
||||||
<PetMenu
|
<PetMenu user={friend!} ariaLabel={`Open ${friend?.name} actions`} />
|
||||||
actions={createPetActions(friend!)}
|
|
||||||
ariaLabel={`Open ${friend?.name} actions`}
|
|
||||||
/>
|
|
||||||
</Neko>
|
</Neko>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onDestroy } from "svelte";
|
import { onDestroy } from "svelte";
|
||||||
import { getButtonPosition } from "./position";
|
import { getButtonPosition } from "./position";
|
||||||
import { createDocumentPointerHandler, createKeyDownHandler } from "./events";
|
import {
|
||||||
|
createDocumentPointerHandler,
|
||||||
|
createKeyDownHandler,
|
||||||
|
createPetActions,
|
||||||
|
} from "./events";
|
||||||
import { sceneInteractive } from "../../../../events/scene-interactive";
|
import { sceneInteractive } from "../../../../events/scene-interactive";
|
||||||
|
import type { UserBasicDto } from "$lib/bindings";
|
||||||
|
|
||||||
export interface PetMenuAction {
|
export interface PetMenuAction {
|
||||||
icon: string;
|
icon: string;
|
||||||
@@ -11,11 +16,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
actions?: PetMenuAction[];
|
user?: UserBasicDto;
|
||||||
ariaLabel?: string;
|
ariaLabel?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { actions = [], ariaLabel = "Toggle pet actions" }: Props = $props();
|
let { user, ariaLabel = "Toggle pet actions" }: Props = $props();
|
||||||
|
|
||||||
|
const actions = $derived(user ? createPetActions(user) : []);
|
||||||
|
|
||||||
let rootEl = $state<HTMLDivElement | null>(null);
|
let rootEl = $state<HTMLDivElement | null>(null);
|
||||||
let isOpen = $state(false);
|
let isOpen = $state(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user