feat : remove latest lunaris version showing in admin dashboard
This commit is contained in:
+3
-7
@@ -4,10 +4,7 @@ import { connection } from "next/server";
|
|||||||
import { StructuredDashboard } from "@/components/admin/structured-dashboard";
|
import { StructuredDashboard } from "@/components/admin/structured-dashboard";
|
||||||
import { AdminHeader } from "@/components/admin/admin-header";
|
import { AdminHeader } from "@/components/admin/admin-header";
|
||||||
import { getAdminSession } from "@/lib/auth/server";
|
import { getAdminSession } from "@/lib/auth/server";
|
||||||
import {
|
import { getCurrentCatalogVersion } from "@/lib/catalog/sync";
|
||||||
getCurrentCatalogVersion,
|
|
||||||
getLatestLunarisVersion,
|
|
||||||
} from "@/lib/catalog/sync";
|
|
||||||
import { listGuideCards } from "@/lib/guides/queries";
|
import { listGuideCards } from "@/lib/guides/queries";
|
||||||
|
|
||||||
export const instant = false;
|
export const instant = false;
|
||||||
@@ -15,11 +12,10 @@ export const instant = false;
|
|||||||
export default async function AdminPage() {
|
export default async function AdminPage() {
|
||||||
await connection();
|
await connection();
|
||||||
if (!(await getAdminSession())) redirect("/admin/login");
|
if (!(await getAdminSession())) redirect("/admin/login");
|
||||||
const [guides, trash, catalogVersion, latestCatalogVersion] = await Promise.all([
|
const [guides, trash, catalogVersion] = await Promise.all([
|
||||||
listGuideCards(),
|
listGuideCards(),
|
||||||
listGuideCards(true),
|
listGuideCards(true),
|
||||||
getCurrentCatalogVersion(),
|
getCurrentCatalogVersion(),
|
||||||
getLatestLunarisVersion(AbortSignal.timeout(3_000)).catch(() => null),
|
|
||||||
]);
|
]);
|
||||||
return (
|
return (
|
||||||
<div className="min-h-svh">
|
<div className="min-h-svh">
|
||||||
@@ -30,7 +26,7 @@ export default async function AdminPage() {
|
|||||||
<h1 className="font-heading text-3xl font-semibold">Guide Dashboard</h1>
|
<h1 className="font-heading text-3xl font-semibold">Guide Dashboard</h1>
|
||||||
<p className="mt-2 text-muted-foreground">จัดการ Guide แบบภาพ-first และบันทึกขึ้นเว็บไซต์ทันที</p>
|
<p className="mt-2 text-muted-foreground">จัดการ Guide แบบภาพ-first และบันทึกขึ้นเว็บไซต์ทันที</p>
|
||||||
</header>
|
</header>
|
||||||
<StructuredDashboard guides={guides} trash={trash} catalogVersion={catalogVersion} latestCatalogVersion={latestCatalogVersion} />
|
<StructuredDashboard guides={guides} trash={trash} catalogVersion={catalogVersion} />
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -70,12 +70,10 @@ export function StructuredDashboard({
|
|||||||
guides,
|
guides,
|
||||||
trash,
|
trash,
|
||||||
catalogVersion,
|
catalogVersion,
|
||||||
latestCatalogVersion,
|
|
||||||
}: {
|
}: {
|
||||||
guides: GuideCard[];
|
guides: GuideCard[];
|
||||||
trash: GuideCard[];
|
trash: GuideCard[];
|
||||||
catalogVersion: string | null;
|
catalogVersion: string | null;
|
||||||
latestCatalogVersion: string | null;
|
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [pending, startTransition] = useTransition();
|
const [pending, startTransition] = useTransition();
|
||||||
@@ -83,11 +81,6 @@ export function StructuredDashboard({
|
|||||||
const [syncJob, setSyncJob] = useState<CatalogSyncJob | null>(null);
|
const [syncJob, setSyncJob] = useState<CatalogSyncJob | null>(null);
|
||||||
const presence = useAdminPresence(null);
|
const presence = useAdminPresence(null);
|
||||||
const catalogReady = Boolean(catalogVersion);
|
const catalogReady = Boolean(catalogVersion);
|
||||||
const updateAvailable = Boolean(
|
|
||||||
catalogVersion &&
|
|
||||||
latestCatalogVersion &&
|
|
||||||
catalogVersion !== latestCatalogVersion,
|
|
||||||
);
|
|
||||||
const syncJobId = syncJob?.id;
|
const syncJobId = syncJob?.id;
|
||||||
const syncJobStatus = syncJob?.status;
|
const syncJobStatus = syncJob?.status;
|
||||||
const search = searchItems(guides, query,
|
const search = searchItems(guides, query,
|
||||||
@@ -148,13 +141,6 @@ export function StructuredDashboard({
|
|||||||
Lunaris ที่ Sync:{" "}
|
Lunaris ที่ Sync:{" "}
|
||||||
{catalogVersion ? `v${catalogVersion}` : "ยังไม่ Sync"}
|
{catalogVersion ? `v${catalogVersion}` : "ยังไม่ Sync"}
|
||||||
</Badge>
|
</Badge>
|
||||||
<Badge variant={updateAvailable ? "default" : "secondary"}>
|
|
||||||
{latestCatalogVersion
|
|
||||||
? updateAvailable
|
|
||||||
? `มีอัปเดต: v${latestCatalogVersion}`
|
|
||||||
: `ล่าสุด: v${latestCatalogVersion}`
|
|
||||||
: "ตรวจสอบเวอร์ชันล่าสุดไม่ได้"}
|
|
||||||
</Badge>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user