chore: checkpoint admin editor and perf work

This commit is contained in:
2026-03-31 00:12:02 +08:00
parent 92a85eef20
commit 99b308e800
45 changed files with 7265 additions and 833 deletions

View File

@@ -37,8 +37,20 @@ let apiError: string | null = null;
const { locale, t } = getI18n(Astro);
try {
siteSettings = await api.getSiteSettings();
allPosts = await api.getPosts();
const [settings, posts, rawTags, rawFriendLinks, nextCategories] = await Promise.all([
api.getSiteSettings(),
api.getPosts(),
api.getTags(),
api.getFriendLinks(),
api.getCategories(),
]);
siteSettings = settings;
allPosts = posts;
tags = rawTags.map(tag => tag.name);
friendLinks = rawFriendLinks.filter(friend => friend.status === 'approved');
categories = nextCategories;
const filteredPosts = allPosts.filter(post => {
const normalizedCategory = post.category?.trim().toLowerCase() || '';
if (selectedType !== 'all' && post.type !== selectedType) return false;
@@ -50,9 +62,6 @@ try {
recentPosts = filteredPosts.slice(0, previewLimit);
filteredPostsCount = filteredPosts.length;
pinnedPost = allPosts.find(post => post.pinned) || null;
tags = (await api.getTags()).map(tag => tag.name);
friendLinks = (await api.getFriendLinks()).filter(friend => friend.status === 'approved');
categories = await api.getCategories();
} catch (error) {
apiError = error instanceof Error ? error.message : t('common.apiUnavailable');
console.error('API Error:', error);
@@ -146,7 +155,7 @@ const navLinks = [
];
---
<BaseLayout title={siteSettings.siteTitle} description={siteSettings.siteDescription}>
<BaseLayout title={siteSettings.siteTitle} description={siteSettings.siteDescription} siteSettings={siteSettings}>
<div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
<TerminalWindow title={terminalConfig.title} class="w-full">
<div class="mb-5 px-4 overflow-x-auto">