wip mission 2
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import { useGameStore } from "@/stores/gameStore";
|
||||
|
||||
export function useActivityCity(): boolean {
|
||||
return useGameStore((state) => state.activityCity);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { useState } from "react";
|
||||
|
||||
interface DialogState {
|
||||
message: string;
|
||||
visible: boolean;
|
||||
}
|
||||
|
||||
export function useDialog(): {
|
||||
dialog: DialogState;
|
||||
showDialog: (message: string) => void;
|
||||
hideDialog: () => void;
|
||||
} {
|
||||
const [dialog, setDialog] = useState<DialogState>({
|
||||
message: "",
|
||||
visible: false,
|
||||
});
|
||||
|
||||
const showDialog = (message: string): void => {
|
||||
setDialog({ message, visible: true });
|
||||
};
|
||||
|
||||
const hideDialog = (): void => {
|
||||
setDialog((prev) => ({ ...prev, visible: false }));
|
||||
};
|
||||
|
||||
return { dialog, showDialog, hideDialog };
|
||||
}
|
||||
Reference in New Issue
Block a user