fix: ts lint

This commit is contained in:
KazooTTT
2024-11-23 16:01:46 +08:00
parent 9c265e77f5
commit 590580363f

View File

@ -31,18 +31,18 @@ const directProjects = [
url: 'https://greasyfork.org/zh-CN/users/904256-kazoottt-wang', url: 'https://greasyfork.org/zh-CN/users/904256-kazoottt-wang',
imagePath: '/src/assets/greasyFork.png', imagePath: '/src/assets/greasyFork.png',
altText: 'greasyFork' altText: 'greasyFork'
}, }
] ]
// Get projects from markdown // Get projects from markdown
const mdProjects = allPosts const mdProjects = allPosts
.filter(post => post.data.category === '项目-已结项') .filter((post) => post.data.category === '项目-已结项')
.sort((a, b) => { .sort((a, b) => {
if (a.data.pinned && !b.data.pinned) return -1 if (a.data.pinned && !b.data.pinned) return -1
if (!a.data.pinned && b.data.pinned) return 1 if (!a.data.pinned && b.data.pinned) return 1
return new Date(b.data.date).getTime() - new Date(a.data.date).getTime() return new Date(b.data.date).getTime() - new Date(a.data.date).getTime()
}) })
.map(post => ({ .map((post) => ({
title: post.data.title, title: post.data.title,
description: post.data.description || '', description: post.data.description || '',
url: post.data.projectUrl ? post.data.projectUrl : `/posts/${post.slug}`, url: post.data.projectUrl ? post.data.projectUrl : `/posts/${post.slug}`,
@ -53,7 +53,6 @@ const mdProjects = allPosts
// Combine both types of projects // Combine both types of projects
const projects = [...directProjects, ...mdProjects].slice(0, MAX_PROJECTS) const projects = [...directProjects, ...mdProjects].slice(0, MAX_PROJECTS)
--- ---
<PageLayout meta={{ title: 'Home' }}> <PageLayout meta={{ title: 'Home' }}>
@ -178,25 +177,27 @@ const projects = [...directProjects, ...mdProjects].slice(0, MAX_PROJECTS)
</Section> </Section>
<Section title='Projects' subtitle='(open source)'> <Section title='Projects' subtitle='(open source)'>
<div class='grid grid-cols-1 sm:grid-cols-2 gap-3'> <div class='grid grid-cols-1 gap-3 sm:grid-cols-2'>
{projects.map((project) => ( {
<ProjectCard projects.map((project) => (
href={project.url} <ProjectCard
heading={project.title} href={project.url}
subheading={project.description} heading={project.title}
imagePath={project.imagePath} subheading={project.description}
altText={project.altText} imagePath={project.imagePath}
target={project.isExternal ? '_blank' : undefined} altText={project.altText}
/> target={'_blank'}
))} />
))
}
</div> </div>
<div class="flex justify-end mt-4"> <div class='mt-4 flex justify-end'>
<a <a
href={`/categories/${encodeURIComponent('项目-已结项')}`} href={`/categories/${encodeURIComponent('项目-已结项')}`}
class="text-sm text-muted-foreground hover:text-foreground transition-colors flex items-center gap-x-1" class='flex items-center gap-x-1 text-sm text-muted-foreground transition-colors hover:text-foreground'
> >
查看更多项目 查看更多项目
<Icon name="link" class="w-4 h-4" /> <Icon name='link' class='h-4 w-4' />
</a> </a>
</div> </div>
</Section> </Section>