Initial commit: page-manager Next.js app with Coolify deploy support

Replace Vercel-specific infra (Cron, Blob) with self-hosted equivalents
for deployment to Coolify: in-container cron scheduler
(scripts/cron-runner.mjs) and disk-based upload storage served via
/api/uploads/[...path]. Add Dockerfile, .dockerignore, and /api/health
for container health checks.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
chaloemphong
2026-11-22 11:52:17 +07:00
commit 9d32552457
155 changed files with 22174 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
"use client";
import { createContext, useCallback, useContext, useRef, useState } from "react";
import { Icon } from "./Icon";
type Tone = "ok" | "warn" | "error";
interface ToastItem {
id: number;
message: string;
tone: Tone;
}
const ToastContext = createContext<{ show: (message: string, tone?: Tone) => void }>({ show: () => {} });
export function useToast() {
return useContext(ToastContext);
}
/** Bottom toasts: above the mobile tab bar, bottom-right on desktop. */
export function ToastProvider({ children }: { children: React.ReactNode }) {
const [items, setItems] = useState<ToastItem[]>([]);
const seq = useRef(0);
const show = useCallback((message: string, tone: Tone = "ok") => {
const id = ++seq.current;
setItems((cur) => [...cur.slice(-2), { id, message, tone }]);
setTimeout(() => setItems((cur) => cur.filter((t) => t.id !== id)), tone === "error" ? 7000 : 3500);
}, []);
return (
<ToastContext.Provider value={{ show }}>
{children}
<div className="toast-stack" role="status" aria-live="polite">
{items.map((t) => (
<div key={t.id} className={`toast toast-${t.tone}`}>
<span className="toast-icon">
<Icon name={t.tone === "ok" ? "check" : "alert"} size={15} />
</span>
<span className="flex-1">{t.message}</span>
<button type="button" className="toast-close" aria-label="ปิด" onClick={() => setItems((cur) => cur.filter((x) => x.id !== t.id))}>
<Icon name="x" size={14} />
</button>
</div>
))}
</div>
</ToastContext.Provider>
);
}