tied new pet menu to rust local backend
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
createPetActions,
|
createPetActions,
|
||||||
} from "./events";
|
} from "./events";
|
||||||
import { sceneInteractive } from "../../../../events/scene-interactive";
|
import { sceneInteractive } from "../../../../events/scene-interactive";
|
||||||
import type { UserBasicDto } from "$lib/bindings";
|
import { commands, type UserBasicDto } from "$lib/bindings";
|
||||||
|
|
||||||
export interface PetMenuAction {
|
export interface PetMenuAction {
|
||||||
icon: string;
|
icon: string;
|
||||||
@@ -28,16 +28,21 @@
|
|||||||
let isOpen = $state(false);
|
let isOpen = $state(false);
|
||||||
|
|
||||||
function closeMenu() {
|
function closeMenu() {
|
||||||
|
if (!user) return;
|
||||||
isOpen = false;
|
isOpen = false;
|
||||||
|
commands.setPetMenuState(user.id, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleMenu() {
|
function toggleMenu() {
|
||||||
|
if (!user) return;
|
||||||
if (!$sceneInteractive || actions.length === 0) {
|
if (!$sceneInteractive || actions.length === 0) {
|
||||||
|
commands.setPetMenuState(user.id, false);
|
||||||
closeMenu();
|
closeMenu();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
isOpen = !isOpen;
|
isOpen = !isOpen;
|
||||||
|
commands.setPetMenuState(user.id, isOpen);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleActionClick(action: PetMenuAction) {
|
function handleActionClick(action: PetMenuAction) {
|
||||||
|
|||||||
Reference in New Issue
Block a user