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
+36
View File
@@ -0,0 +1,36 @@
"use client";
import { useState } from "react";
import { useRouter } from "next/navigation";
import { Icon } from "./Icon";
import { useToast } from "./Toast";
export function RefreshInsightsButton({ pageId, variant = "on-band" }: { pageId: string | null; variant?: "on-band" | "primary" }) {
const router = useRouter();
const toast = useToast();
const [busy, setBusy] = useState(false);
async function refresh() {
setBusy(true);
const res = await fetch("/api/insights/refresh", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ pageId }),
});
const body = await res.json().catch(() => ({}));
setBusy(false);
if (!res.ok || !body.ok) {
toast.show(body.error ?? body.errors?.join(" · ") ?? "ดึงข้อมูลไม่สำเร็จ", "error");
return;
}
toast.show(body.errors?.length ? `ดึงได้ ${body.refreshed} เพจ · ${body.errors.join(" · ")}` : "อัปเดตข้อมูลล่าสุดแล้ว", body.errors?.length ? "warn" : "ok");
router.refresh();
}
return (
<button type="button" className={`btn ${variant === "primary" ? "btn-primary" : "btn-on-band"}`} disabled={busy} onClick={refresh}>
<Icon name="refresh" size={16} className={busy ? "animate-spin" : undefined} />
{busy ? "กำลังดึงข้อมูล…" : "ดึงข้อมูลตอนนี้"}
</button>
);
}