33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import HistoryGallery from "@/components/history-gallery";
|
|
import NavigationShell from "@/components/navigation-shell";
|
|
import { requireCurrentUser, toPublicUser } from "@/lib/auth";
|
|
import { listImageHistoryForViewer } from "@/lib/db";
|
|
|
|
export default async function HistoryPage() {
|
|
const user = await requireCurrentUser();
|
|
const publicUser = toPublicUser(user);
|
|
const items = listImageHistoryForViewer({
|
|
viewerId: user.id,
|
|
viewerRole: user.role,
|
|
});
|
|
|
|
if (!publicUser) {
|
|
throw new Error("Unable to resolve current user.");
|
|
}
|
|
|
|
return (
|
|
<NavigationShell
|
|
currentUser={publicUser}
|
|
activePath="/history"
|
|
title="图片历史"
|
|
description={
|
|
publicUser.role === "admin"
|
|
? "查看所有用户生成过的图片、提示词和关键参数,保持按账号隔离的访问能力。"
|
|
: "回看自己生成过的图片、提示词和关键参数,所有历史记录都会保存在服务器。"
|
|
}
|
|
>
|
|
<HistoryGallery currentUser={publicUser} items={items} />
|
|
</NavigationShell>
|
|
);
|
|
}
|