feat(web): sprint1 ui core with global toasts and improved chat layout
Some checks failed
CI / test (push) Failing after 19s

This commit is contained in:
2026-03-08 10:35:21 +03:00
parent 1119cc65b8
commit a77516cfea
6 changed files with 81 additions and 32 deletions

View File

@@ -0,0 +1,30 @@
import { useEffect } from "react";
import { createPortal } from "react-dom";
import { useUiStore } from "../store/uiStore";
export function ToastViewport() {
const message = useUiStore((s) => s.toastMessage);
const clearToast = useUiStore((s) => s.clearToast);
useEffect(() => {
if (!message) {
return;
}
const timer = window.setTimeout(() => clearToast(), 2200);
return () => window.clearTimeout(timer);
}, [message, clearToast]);
if (!message) {
return null;
}
return createPortal(
<div className="pointer-events-none fixed bottom-3 left-0 right-0 z-[300] flex justify-center px-3">
<div className="rounded-lg border border-slate-700/80 bg-slate-900/95 px-3 py-2 text-xs text-slate-100 shadow-xl">
{message}
</div>
</div>,
document.body
);
}