File size: 2,504 Bytes
96dd062
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import type {
	AdConfig,
	AnnouncementConfig,
	BackgroundWallpaperConfig,
	CommentConfig,
	CoverImageConfig,
	FriendsPageConfig,
	LicenseConfig,
	Live2DModelConfig,
	MusicPlayerConfig,
	ProfileConfig,
	SidebarLayoutConfig,
	SiteConfig,
	SpineModelConfig,
	SponsorConfig,
	NavBarLink,
	FriendLink,
	FooterConfig,
} from "./config";

export type AdminNavPreset =
	| "home"
	| "archive"
	| "about"
	| "friends"
	| "sponsor"
	| "guestbook"
	| "bangumi";

export type AdminNavItem =
	| {
			preset: AdminNavPreset;
	  }
	| (Omit<NavBarLink, "children"> & {
			children?: AdminNavItem[];
	  });

export type AdminNavbarConfig = {
	links: AdminNavItem[];
};

export type AdminFriendsConfig = {
	page: FriendsPageConfig;
	items: FriendLink[];
};

export type AdminPioConfig = {
	spine: SpineModelConfig;
	live2d: Live2DModelConfig;
};

export type AdminAdConfig = {
	ad1: AdConfig;
	ad2: AdConfig;
};

export type AdminConfigData = {
	site: SiteConfig;
	navbar: AdminNavbarConfig;
	sidebar: SidebarLayoutConfig;
	profile: ProfileConfig;
	wallpaper: BackgroundWallpaperConfig;
	announcement: AnnouncementConfig;
	footer: FooterConfig;
	comment: CommentConfig;
	friends: AdminFriendsConfig;
	sponsor: SponsorConfig;
	music: MusicPlayerConfig;
	pio: AdminPioConfig;
	ad: AdminAdConfig;
	license: LicenseConfig;
	coverImage: CoverImageConfig;
};

export type AdminBuildStatus =
	| "idle"
	| "running"
	| "success"
	| "error";

export type AdminDashboardData = {
	stats: {
		postCount: number;
		draftCount: number;
		pageCount: number;
		mediaCount: number;
		tagCount: number;
		categoryCount: number;
	};
	build: {
		status: AdminBuildStatus;
		reason: string;
		startedAt: string | null;
		finishedAt: string | null;
		lastDurationMs: number | null;
		logTail: string[];
	};
};

export type AdminPostSummary = {
	file: string;
	slug: string;
	title: string;
	description: string;
	published: string;
	updated: string;
	tags: string[];
	category: string;
	draft: boolean;
	pinned: boolean;
	image: string;
	wordCount: number;
};

export type AdminPostDocument = {
	file: string;
	slug: string;
	frontmatter: Record<string, unknown>;
	body: string;
};

export type AdminSpecPageId = "about" | "friends" | "guestbook";

export type AdminSpecPageDocument = {
	id: AdminSpecPageId;
	frontmatter: Record<string, unknown>;
	body: string;
};

export type AdminMediaItem = {
	name: string;
	relativePath: string;
	root: "uploads" | "content";
	publicUrl: string;
	previewUrl: string;
	size: number;
	updatedAt: string;
};