Files
HKSingleParty/99_references/beacon-main/src/components/global-message.tsx
2025-05-28 09:55:51 +08:00

30 lines
626 B
TypeScript

/**
* @file Global message component
*/
import {IonAlert} from "@ionic/react";
import {FC} from "react";
import {useEphemeralStore} from "~/lib/stores/ephemeral";
/**
* Global message component
* @returns JSX
*/
export const GlobalMessage: FC = () => {
// Hooks
const message = useEphemeralStore(state => state.message);
const setMessage = useEphemeralStore(state => state.setMessage);
// JSX
return (
<IonAlert
isOpen={message !== undefined}
header={message?.name}
subHeader={message?.description}
buttons={["OK"]}
onIonAlertDidDismiss={() => setMessage()}
/>
);
};