From abc359de31435feeb55aefe4d391c87c05548a18 Mon Sep 17 00:00:00 2001 From: Loma Bot Ops Date: Fri, 27 Nov 2026 09:00:52 +0700 Subject: [PATCH] Show content automation action for all page views --- src/app/(console)/page.tsx | 2 +- src/components/ContentAutoLauncher.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/(console)/page.tsx b/src/app/(console)/page.tsx index c2d33fb..526bee1 100644 --- a/src/app/(console)/page.tsx +++ b/src/app/(console)/page.tsx @@ -40,7 +40,7 @@ export default async function OverviewPage(props: PageProps<"/">) { const openDays = Array.from({ length: 7 }, (_, i) => addDays(week, i)).filter(d => d >= today).length; const planFor = ctx.selected && editable.includes(ctx.selected.id) && openDays > 0 ? ctx.selected : null; return <> - 0 ? <>{planFor && } สร้างโพสต์ : undefined} /> + 0 ? <> editable.includes(page.id)).map(({ id, name }) => ({ id, name }))} initialPageId={ctx.selected?.id} /> สร้างโพสต์ : undefined} />
{posts.length} โพสต์ในสัปดาห์นี้{tray.length}{tray.length === 50 ? "+" : ""} โพสต์ยังไม่วางวัน {pending > 0 && รออนุมัติ {pending}} diff --git a/src/components/ContentAutoLauncher.tsx b/src/components/ContentAutoLauncher.tsx index 8edd7b7..018c217 100644 --- a/src/components/ContentAutoLauncher.tsx +++ b/src/components/ContentAutoLauncher.tsx @@ -4,8 +4,9 @@ import { useEffect, useState } from "react"; import { Icon } from "./Icon"; import { ContentAutoForm } from "./ContentAutoForm"; -export function ContentAutoLauncher({ pageId }: { pageId: string }) { +export function ContentAutoLauncher({ pages, initialPageId }: { pages: { id: string; name: string }[]; initialPageId?: string }) { const [open, setOpen] = useState(false); + const [pageId, setPageId] = useState(initialPageId ?? pages[0]?.id ?? ""); useEffect(() => { if (!open) return; const close = (event: KeyboardEvent) => { if (event.key === "Escape") setOpen(false); }; @@ -18,7 +19,8 @@ export function ContentAutoLauncher({ pageId }: { pageId: string }) { {open &&
{ if (event.target === event.currentTarget) setOpen(false); }}>

ตั้งค่าแผนอัตโนมัติ

- + {pages.length > 1 && } + {pageId && }
} ;