The webserver serves the repo checkout directly as static files, so index.html at the repo root must be the production build (pointing at hashed /assets/*.js) rather than the dev template (/src/main.tsx), which was being served with an unrecognized application/octet-stream MIME type and blocked by the browser. - Move src/, public/, scripts/, server/, package.json, vite.config.ts, tsconfig.json, .env(.example), and the dev index.html into app/. - Add app/scripts/deploy.mjs: copies app/dist/* into the repo root after every `vite build`, cleaning up stale hashed filenames. - Wire it into `npm run build` (app/package.json). - Update run.sh to operate from app/, and .gitignore for the new layout. - Commit the current build output (index.html, assets/, manifest, sw.js, workbox-*.js, favicon.svg, icons/, LICENSE) to the repo root. - Update README with the new project layout and deployment model.
21 lines
483 B
TypeScript
21 lines
483 B
TypeScript
import { useEffect } from "react";
|
|
import { useStore } from "../state/store";
|
|
|
|
export function Toast() {
|
|
const toast = useStore((s) => s.toast);
|
|
const setToast = useStore((s) => s.setToast);
|
|
|
|
useEffect(() => {
|
|
if (!toast) return;
|
|
const t = setTimeout(() => setToast(null), 5000);
|
|
return () => clearTimeout(t);
|
|
}, [toast, setToast]);
|
|
|
|
if (!toast) return null;
|
|
return (
|
|
<div className="toast" onClick={() => setToast(null)}>
|
|
{toast}
|
|
</div>
|
|
);
|
|
}
|