chore: checkpoint ai search comments and i18n foundation
This commit is contained in:
@@ -4,10 +4,14 @@ import TerminalWindow from '../../components/ui/TerminalWindow.astro';
|
||||
import CommandPrompt from '../../components/ui/CommandPrompt.astro';
|
||||
import FilterPill from '../../components/ui/FilterPill.astro';
|
||||
import { api, DEFAULT_SITE_SETTINGS } from '../../lib/api/client';
|
||||
import { getI18n, formatReadTime } from '../../lib/i18n';
|
||||
import type { Post } from '../../lib/types';
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
let siteSettings = DEFAULT_SITE_SETTINGS;
|
||||
let posts: Post[] = [];
|
||||
const { locale, t } = getI18n(Astro);
|
||||
|
||||
try {
|
||||
[siteSettings, posts] = await Promise.all([
|
||||
@@ -29,7 +33,7 @@ const years = Object.keys(groupedByYear).sort((a, b) => Number(b) - Number(a));
|
||||
const latestYear = years[0] || 'all';
|
||||
---
|
||||
|
||||
<Layout title={`时间轴 | ${siteSettings.siteShortName}`} description={`记录 ${siteSettings.ownerName} 的技术成长与生活点滴`}>
|
||||
<Layout title={`${t('timeline.pageTitle')} | ${siteSettings.siteShortName}`} description={t('timeline.pageDescription', { ownerName: siteSettings.ownerName })}>
|
||||
<div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||
<TerminalWindow title="~/timeline" class="w-full">
|
||||
<div class="px-4 py-4 space-y-6">
|
||||
@@ -39,12 +43,12 @@ const latestYear = years[0] || 'all';
|
||||
<div class="terminal-kicker">activity trace</div>
|
||||
<div class="terminal-section-title mt-4">
|
||||
<span class="terminal-section-icon">
|
||||
<i class="fas fa-stream"></i>
|
||||
</span>
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-[var(--title-color)]">时间轴</h1>
|
||||
<i class="fas fa-stream"></i>
|
||||
</span>
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-[var(--title-color)]">{t('timeline.title')}</h1>
|
||||
<p class="mt-2 text-sm leading-6 text-[var(--text-secondary)]">
|
||||
共 {posts.length} 篇内容 · 记录 {siteSettings.ownerName} 的技术成长与生活点滴
|
||||
{t('timeline.subtitle', { count: posts.length, ownerName: siteSettings.ownerName })}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,7 +64,7 @@ const latestYear = years[0] || 'all';
|
||||
data-year="all"
|
||||
active={false}
|
||||
>
|
||||
全部
|
||||
{t('timeline.allYears')}
|
||||
</FilterPill>
|
||||
{years.map(year => (
|
||||
<FilterPill
|
||||
@@ -102,7 +106,7 @@ const latestYear = years[0] || 'all';
|
||||
>
|
||||
<div class="terminal-panel-muted shrink-0 min-w-[72px] text-center py-3">
|
||||
<div class="text-[11px] uppercase tracking-[0.2em] text-[var(--text-tertiary)]">
|
||||
{new Date(post.date).toLocaleDateString('zh-CN', { month: 'short' })}
|
||||
{new Date(post.date).toLocaleDateString(locale, { month: 'short' })}
|
||||
</div>
|
||||
<div class="mt-1 text-2xl font-bold text-[var(--primary)]">
|
||||
{new Date(post.date).getDate()}
|
||||
@@ -125,7 +129,7 @@ const latestYear = years[0] || 'all';
|
||||
{post.category}
|
||||
</span>
|
||||
<span class="terminal-chip text-xs py-1 px-2.5">
|
||||
{post.readTime}
|
||||
{formatReadTime(locale, post.readTime, t)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user