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