chore: add mobile app

This commit is contained in:
2026-02-07 22:33:02 +01:00
parent db34640acc
commit e89384ad4e
29327 changed files with 3886944 additions and 12 deletions
+57
View File
@@ -0,0 +1,57 @@
import { useState, useCallback } from "react";
interface AlertState {
visible: boolean;
type: "success" | "error" | "confirm";
title: string;
message: string;
onConfirm?: () => void;
confirmText?: string;
cancelText?: string;
}
const INITIAL: AlertState = {
visible: false,
type: "error",
title: "",
message: "",
};
export function useAlert() {
const [alert, setAlert] = useState<AlertState>(INITIAL);
const showError = useCallback((title: string, message: string) => {
setAlert({ visible: true, type: "error", title, message });
}, []);
const showSuccess = useCallback((title: string, message: string) => {
setAlert({ visible: true, type: "success", title, message });
}, []);
const showConfirm = useCallback(
(
title: string,
message: string,
onConfirm: () => void,
confirmText?: string,
cancelText?: string,
) => {
setAlert({
visible: true,
type: "confirm",
title,
message,
onConfirm,
confirmText,
cancelText,
});
},
[],
);
const hideAlert = useCallback(() => {
setAlert(INITIAL);
}, []);
return { alert, showError, showSuccess, showConfirm, hideAlert };
}