v0.1 - макет интерфейса, аутентификация через логин, аккаунт админа, создание партии в 2 этапа, базовые настройки профиля и группы, переключение между группами, статистика

This commit is contained in:
2026-06-16 17:41:06 +03:00
parent 6ab74f01aa
commit 56b5d09a4d
123 changed files with 13572 additions and 21 deletions
+30
View File
@@ -0,0 +1,30 @@
import { createContext, useCallback, useContext, useRef, useState } from "react";
import type { PropsWithChildren } from "react";
interface ToastCtx {
show: (message: string) => void;
}
const Ctx = createContext<ToastCtx>({ show: () => {} });
export function ToastProvider({ children }: PropsWithChildren) {
const [message, setMessage] = useState<string | null>(null);
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
const show = useCallback((msg: string) => {
setMessage(msg);
if (timer.current) clearTimeout(timer.current);
timer.current = setTimeout(() => setMessage(null), 2800);
}, []);
return (
<Ctx.Provider value={{ show }}>
{children}
{message && <div className="toast">{message}</div>}
</Ctx.Provider>
);
}
export function useToast(): ToastCtx {
return useContext(Ctx);
}