import NavigationShell from "@/components/navigation-shell";
import StudioClient from "@/components/studio-client";
import { requireCurrentUser, toPublicUser } from "@/lib/auth";
import { getQuotaSnapshotForUser } from "@/lib/quota";

export default async function StudioPage() {
  const user = await requireCurrentUser();
  const publicUser = toPublicUser(user);
  const quota = getQuotaSnapshotForUser(user);

  if (!publicUser) {
    throw new Error("Unable to resolve current user.");
  }

  return (
    <NavigationShell
      currentUser={publicUser}
      activePath="/studio"
      title="图片生成中心"
      description="在保持苹果风格观感的同时，减少滚动卡顿与无效重渲染。"
    >
      <StudioClient currentUser={publicUser} initialQuota={quota} />
    </NavigationShell>
  );
}
