乌龟服官服
This commit is contained in:
@@ -3,11 +3,13 @@ import { prisma } from "@/lib/db";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Plus } from "lucide-react";
|
||||
import { ReleasesTable } from "@/components/admin/ReleasesTable";
|
||||
import { DEFAULT_WOW_VERSION } from "@/lib/wow-versions";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function AdminReleasesPage() {
|
||||
const releases = await prisma.release.findMany({
|
||||
where: { wowVersion: DEFAULT_WOW_VERSION },
|
||||
include: { addon: { select: { name: true, slug: true } } },
|
||||
orderBy: { createdAt: "desc" },
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { prisma } from "@/lib/db";
|
||||
import { SoftwareEditForm } from "@/components/admin/SoftwareEditForm";
|
||||
import { DEFAULT_WOW_VERSION } from "@/lib/wow-versions";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -12,7 +13,12 @@ export default async function EditSoftwarePage({
|
||||
const { id } = await params;
|
||||
const software = await prisma.software.findUnique({
|
||||
where: { id },
|
||||
include: { versions: { orderBy: { versionCode: "desc" } } },
|
||||
include: {
|
||||
versions: {
|
||||
where: { wowVersion: DEFAULT_WOW_VERSION },
|
||||
orderBy: { versionCode: "desc" },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!software) notFound();
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
} from "@/components/ui/card";
|
||||
import { Plus } from "lucide-react";
|
||||
import { SoftwareVersionTable } from "@/components/admin/SoftwareVersionTable";
|
||||
import { DEFAULT_WOW_VERSION } from "@/lib/wow-versions";
|
||||
|
||||
const SOFTWARE_DEFS = [
|
||||
{
|
||||
@@ -41,7 +42,7 @@ export default async function AdminSoftwarePage() {
|
||||
SOFTWARE_DEFS.map(async (def) => {
|
||||
const sw = await ensureSoftware(def.slug, def.name, def.description);
|
||||
const versions = await prisma.softwareVersion.findMany({
|
||||
where: { softwareId: sw.id },
|
||||
where: { softwareId: sw.id, wowVersion: DEFAULT_WOW_VERSION },
|
||||
orderBy: { versionCode: "desc" },
|
||||
});
|
||||
const totalDownloads = versions.reduce((s, v) => s + v.downloadCount, 0);
|
||||
@@ -87,34 +88,21 @@ export default async function AdminSoftwarePage() {
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{(["1.18", "1.17"] as const).map((wv) => {
|
||||
const latest = item.versions.find(
|
||||
(v) => v.isLatest && v.wowVersion === wv
|
||||
);
|
||||
const total = item.versions.filter(
|
||||
(v) => v.wowVersion === wv
|
||||
).length;
|
||||
const downloads = item.versions
|
||||
.filter((v) => v.wowVersion === wv)
|
||||
.reduce((s, v) => s + v.downloadCount, 0);
|
||||
return (
|
||||
<Card key={wv} className="border-amber-500/20">
|
||||
<CardHeader className="pb-2">
|
||||
<CardDescription className="flex items-center gap-2">
|
||||
<span>WoW {wv}</span>
|
||||
<span className="text-xs text-muted-foreground/70">
|
||||
({total} 个版本 · {downloads} 次下载)
|
||||
</span>
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-2xl font-bold">
|
||||
{latest ? `v${latest.version}` : "未发布"}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
})}
|
||||
<Card className="border-amber-500/20">
|
||||
<CardHeader className="pb-2">
|
||||
<CardDescription className="flex items-center gap-2">
|
||||
<span>WoW {DEFAULT_WOW_VERSION}</span>
|
||||
<span className="text-xs text-muted-foreground/70">
|
||||
({item.versions.length} 个版本 · {item.totalDownloads} 次下载)
|
||||
</span>
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-2xl font-bold">
|
||||
{item.latestVersion ? `v${item.latestVersion.version}` : "未发布"}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<Card>
|
||||
|
||||
Reference in New Issue
Block a user