userWorks.ts 898 Bytes
import type { GalleryPhoto } from "./gallery";
import { mockPhotos } from "./gallery";

/** 我的作品(审核状态为前端演示数据) */
export type MyWorkAuditStatus = "approved" | "pending" | "rejected";

export interface MyWorkItem {
  id: number;
  imageUrl: string;
  title: string;
  likes: number;
  status: MyWorkAuditStatus;
  /** 仅 status=rejected 时有值 */
  rejectReason?: string;
  publishedAt: string;
}

function withStatus(photo: GalleryPhoto, index: number): MyWorkItem {
  return {
    id: photo.id,
    imageUrl: photo.imageUrl,
    title: photo.title,
    likes: photo.likes,
    status: index % 6 === 2 ? "pending" : "approved",
    publishedAt: "2026-03-18",
  };
}

/** 当前登录用户「山行者」的作品列表(演示:取相册前 12 条) */
export const myWorksList: MyWorkItem[] = mockPhotos
  .slice(0, 12)
  .map((p, i) => withStatus(p, i));