fix some check error
This commit is contained in:
@ -51,6 +51,7 @@ let links: NavBarLink[] = navBarConfig.links.map(
|
|||||||
<Icon name="material-symbols:palette-outline" class="text-[1.25rem]"></Icon>
|
<Icon name="material-symbols:palette-outline" class="text-[1.25rem]"></Icon>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
{/* @ts-expect-error – client:only 是 Astro 指令,非组件 Prop */}
|
||||||
<LightDarkSwitch client:only="svelte"></LightDarkSwitch>
|
<LightDarkSwitch client:only="svelte"></LightDarkSwitch>
|
||||||
<button aria-label="Menu" name="Nav Menu" class="btn-plain scale-animation rounded-lg w-11 h-11 active:scale-90 md:!hidden" id="nav-menu-switch">
|
<button aria-label="Menu" name="Nav Menu" class="btn-plain scale-animation rounded-lg w-11 h-11 active:scale-90 md:!hidden" id="nav-menu-switch">
|
||||||
<Icon name="material-symbols:menu-rounded" class="text-[1.25rem]"></Icon>
|
<Icon name="material-symbols:menu-rounded" class="text-[1.25rem]"></Icon>
|
||||||
|
|||||||
@ -6,9 +6,40 @@ import MainGridLayout from "@layouts/MainGridLayout.astro";
|
|||||||
import { getSortedPostsList } from "../utils/content-utils";
|
import { getSortedPostsList } from "../utils/content-utils";
|
||||||
|
|
||||||
const sortedPostsList = await getSortedPostsList();
|
const sortedPostsList = await getSortedPostsList();
|
||||||
|
const convertedPosts = sortedPostsList.map((post) => ({
|
||||||
|
...post,
|
||||||
|
data: {
|
||||||
|
...post.data,
|
||||||
|
category: post.data.category ?? undefined,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
const allTags = new Set<string>();
|
||||||
|
for (const post of convertedPosts) {
|
||||||
|
if (post.data.tags) {
|
||||||
|
for (const tag of post.data.tags) {
|
||||||
|
allTags.add(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const tags = Array.from(allTags);
|
||||||
|
|
||||||
|
const allCategories = new Set<string>();
|
||||||
|
convertedPosts.forEach((post) => {
|
||||||
|
if (post.data.category) {
|
||||||
|
allCategories.add(post.data.category);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const categories = Array.from(allCategories);
|
||||||
---
|
---
|
||||||
|
|
||||||
<MainGridLayout title={i18n(I18nKey.archive)}>
|
<MainGridLayout title={i18n(I18nKey.archive)}>
|
||||||
<ArchivePanel sortedPosts={sortedPostsList} client:only="svelte"></ArchivePanel>
|
{}
|
||||||
</MainGridLayout>
|
<ArchivePanel
|
||||||
|
tags={tags}
|
||||||
|
categories={categories}
|
||||||
|
sortedPosts={convertedPosts}
|
||||||
|
client:only="svelte"
|
||||||
|
/>
|
||||||
|
</MainGridLayout>
|
||||||
Reference in New Issue
Block a user