@hutusi/amytis 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GEMINI.md +6 -2
- package/TODO.md +11 -15
- package/bun.lock +3 -0
- package/content/about.mdx +1 -0
- package/content/about.zh.mdx +21 -0
- package/content/flows/2026/02/20.md +16 -0
- package/content/links.mdx +42 -0
- package/content/links.zh.mdx +41 -0
- package/content/posts/2026-02-20-i18n-routing-considerations.mdx +150 -0
- package/content/posts/multimedia-showcase/index.mdx +261 -0
- package/content/privacy.mdx +32 -0
- package/content/privacy.zh.mdx +32 -0
- package/docs/ARCHITECTURE.md +8 -0
- package/package.json +2 -1
- package/scripts/copy-assets.ts +1 -1
- package/site.config.ts +126 -44
- package/src/app/[slug]/page.tsx +0 -10
- package/src/app/archive/page.tsx +38 -10
- package/src/app/books/[slug]/page.tsx +18 -0
- package/src/app/flows/[year]/[month]/[day]/page.tsx +20 -3
- package/src/app/layout.tsx +47 -21
- package/src/app/page.tsx +135 -72
- package/src/app/posts/[slug]/page.tsx +6 -12
- package/src/app/series/[slug]/page.tsx +18 -0
- package/src/app/subscribe/page.tsx +17 -0
- package/src/app/tags/[tag]/page.tsx +9 -26
- package/src/app/tags/page.tsx +3 -8
- package/src/components/AuthorCard.tsx +43 -0
- package/src/components/Comments.tsx +20 -4
- package/src/components/ExternalLinks.tsx +6 -2
- package/src/components/Footer.tsx +35 -26
- package/src/components/LanguageProvider.tsx +0 -5
- package/src/components/LanguageSwitch.tsx +117 -6
- package/src/components/LocaleSwitch.tsx +33 -0
- package/src/components/Navbar.tsx +31 -8
- package/src/components/PostNavigation.tsx +55 -0
- package/src/components/PostSidebar.tsx +172 -126
- package/src/components/ReadingProgressBar.tsx +6 -21
- package/src/components/RelatedPosts.tsx +1 -1
- package/src/components/Search.tsx +24 -4
- package/src/components/SelectedBooksSection.tsx +12 -6
- package/src/components/ShareBar.tsx +115 -0
- package/src/components/SimpleLayoutHeader.tsx +5 -14
- package/src/components/SubscribePage.tsx +298 -0
- package/src/components/TagContentTabs.tsx +103 -0
- package/src/components/TagPageHeader.tsx +7 -13
- package/src/components/TagSidebar.tsx +142 -0
- package/src/components/TagsIndexClient.tsx +156 -0
- package/src/hooks/useScrollY.ts +41 -0
- package/src/i18n/translations.ts +84 -0
- package/src/layouts/PostLayout.tsx +33 -6
- package/src/layouts/SimpleLayout.tsx +53 -15
- package/src/lib/markdown.ts +71 -15
- package/src/components/TableOfContents.tsx +0 -158
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import { useLanguage } from './LanguageProvider';
|
|
7
|
+
import { siteConfig } from '../../site.config';
|
|
8
|
+
import { LuCheck, LuCopy, LuExternalLink, LuGithub, LuMail } from 'react-icons/lu';
|
|
9
|
+
|
|
10
|
+
// ─── Platform SVG icons ────────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
function RssIcon() {
|
|
13
|
+
return (
|
|
14
|
+
<svg viewBox="0 0 24 24" className="w-5 h-5" fill="currentColor" aria-hidden="true">
|
|
15
|
+
<path d="M6.18 15.64a2.18 2.18 0 0 1 2.18 2.18C8.36 19.01 7.38 20 6.18 20 4.98 20 4 19.01 4 17.82a2.18 2.18 0 0 1 2.18-2.18M4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27V4.44m0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93V10.1z" />
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function TelegramIcon() {
|
|
21
|
+
return (
|
|
22
|
+
<svg viewBox="0 0 24 24" className="w-5 h-5" fill="currentColor" aria-hidden="true">
|
|
23
|
+
<path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z" />
|
|
24
|
+
</svg>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function WechatIcon() {
|
|
29
|
+
return (
|
|
30
|
+
<svg viewBox="0 0 24 24" className="w-5 h-5" fill="currentColor" aria-hidden="true">
|
|
31
|
+
<path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-7.062-6.122zm-3.518 3.507c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z" />
|
|
32
|
+
</svg>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function SubstackIcon() {
|
|
37
|
+
return (
|
|
38
|
+
<svg viewBox="0 0 24 24" className="w-5 h-5" fill="currentColor" aria-hidden="true">
|
|
39
|
+
<path d="M22.539 8.242H1.46V5.406h21.08v2.836zM1.46 10.812V24L12 18.11 22.54 24V10.812H1.46zM22.54 0H1.46v2.836h21.08V0z" />
|
|
40
|
+
</svg>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function XIcon() {
|
|
45
|
+
return (
|
|
46
|
+
<svg viewBox="0 0 24 24" className="w-5 h-5" fill="currentColor" aria-hidden="true">
|
|
47
|
+
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.742l7.775-8.906L2.003 2.25H8.08l4.261 5.628 5.903-5.628zm-1.161 17.52h1.833L7.084 4.126H5.117z" />
|
|
48
|
+
</svg>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ─── Shared card wrapper ───────────────────────────────────────────────────────
|
|
53
|
+
|
|
54
|
+
interface CardProps {
|
|
55
|
+
icon: React.ReactNode;
|
|
56
|
+
title: string;
|
|
57
|
+
description: string;
|
|
58
|
+
children: React.ReactNode;
|
|
59
|
+
wide?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function SubscribeCard({ icon, title, description, children, wide }: CardProps) {
|
|
63
|
+
return (
|
|
64
|
+
<div className={`rounded-2xl border border-muted/20 bg-muted/5 p-6 space-y-4${wide ? ' md:col-span-2' : ''}`}>
|
|
65
|
+
<div className="flex items-center gap-3">
|
|
66
|
+
<div className="w-9 h-9 rounded-lg bg-accent/10 flex items-center justify-center text-accent flex-shrink-0">
|
|
67
|
+
{icon}
|
|
68
|
+
</div>
|
|
69
|
+
<h2 className="font-serif font-bold text-xl text-heading">{title}</h2>
|
|
70
|
+
</div>
|
|
71
|
+
<p className="text-sm text-muted/70 leading-relaxed">{description}</p>
|
|
72
|
+
{children}
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ─── Main component ────────────────────────────────────────────────────────────
|
|
78
|
+
|
|
79
|
+
export default function SubscribePage() {
|
|
80
|
+
const { t } = useLanguage();
|
|
81
|
+
const [copied, setCopied] = useState(false);
|
|
82
|
+
|
|
83
|
+
const { baseUrl, social, subscribe } = siteConfig;
|
|
84
|
+
const feedUrl = `${baseUrl}/feed.xml`;
|
|
85
|
+
const enc = encodeURIComponent(feedUrl);
|
|
86
|
+
|
|
87
|
+
const rssReaders = [
|
|
88
|
+
{ name: 'Follow', url: `https://app.follow.is/add?url=${enc}` },
|
|
89
|
+
{ name: 'Feedly', url: `https://feedly.com/i/subscription/feed/${enc}` },
|
|
90
|
+
{ name: 'Inoreader', url: `https://www.inoreader.com/?add_feed=${enc}` },
|
|
91
|
+
{ name: 'NewsBlur', url: `https://newsblur.com/?url=${enc}` },
|
|
92
|
+
{ name: 'The Old Reader', url: `https://theoldreader.com/feeds/subscribe?url=${enc}` },
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
const hasSubstack = !!subscribe?.substack;
|
|
96
|
+
const hasEmail = !!subscribe?.email;
|
|
97
|
+
const hasTelegram = !!subscribe?.telegram;
|
|
98
|
+
const hasWechat = !!subscribe?.wechat?.qrCode;
|
|
99
|
+
const hasNewsletter = hasSubstack || hasEmail;
|
|
100
|
+
|
|
101
|
+
const handleCopy = async () => {
|
|
102
|
+
try {
|
|
103
|
+
await navigator.clipboard.writeText(feedUrl);
|
|
104
|
+
setCopied(true);
|
|
105
|
+
setTimeout(() => setCopied(false), 2000);
|
|
106
|
+
} catch {
|
|
107
|
+
// fallback: select text — clipboard API may not be available in all contexts
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<div className="max-w-3xl">
|
|
113
|
+
{/* Page header */}
|
|
114
|
+
<header className="page-header">
|
|
115
|
+
<h1 className="page-title">{t('subscribe')}</h1>
|
|
116
|
+
<p className="page-subtitle">{t('subscribe_subtitle')}</p>
|
|
117
|
+
</header>
|
|
118
|
+
|
|
119
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-5">
|
|
120
|
+
|
|
121
|
+
{/* ── RSS Feed ── always visible */}
|
|
122
|
+
<SubscribeCard
|
|
123
|
+
wide
|
|
124
|
+
icon={<RssIcon />}
|
|
125
|
+
title={t('rss_readers')}
|
|
126
|
+
description={t('rss_description')}
|
|
127
|
+
>
|
|
128
|
+
{/* Reader quick-subscribe links */}
|
|
129
|
+
<div className="flex flex-wrap gap-2">
|
|
130
|
+
{rssReaders.map(({ name, url }) => (
|
|
131
|
+
<a
|
|
132
|
+
key={name}
|
|
133
|
+
href={url}
|
|
134
|
+
target="_blank"
|
|
135
|
+
rel="noopener noreferrer"
|
|
136
|
+
className="inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-muted/20 bg-background hover:border-accent hover:text-accent transition-colors no-underline"
|
|
137
|
+
>
|
|
138
|
+
{name}
|
|
139
|
+
<LuExternalLink className="w-3 h-3 opacity-50" />
|
|
140
|
+
</a>
|
|
141
|
+
))}
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
{/* Feed URL with copy button */}
|
|
145
|
+
<div className="flex items-center gap-2 mt-1 px-3 py-2.5 rounded-lg bg-muted/5 border border-muted/15">
|
|
146
|
+
<code className="text-xs font-mono text-muted/60 flex-1 truncate">{feedUrl}</code>
|
|
147
|
+
<button
|
|
148
|
+
onClick={handleCopy}
|
|
149
|
+
className="flex-shrink-0 flex items-center gap-1.5 text-xs text-muted/60 hover:text-accent transition-colors"
|
|
150
|
+
aria-label={t('copy_feed_url')}
|
|
151
|
+
>
|
|
152
|
+
{copied
|
|
153
|
+
? <><LuCheck className="w-3.5 h-3.5 text-accent" /><span className="text-accent">{t('feed_url_copied')}</span></>
|
|
154
|
+
: <><LuCopy className="w-3.5 h-3.5" /><span>{t('copy_feed_url')}</span></>
|
|
155
|
+
}
|
|
156
|
+
</button>
|
|
157
|
+
</div>
|
|
158
|
+
</SubscribeCard>
|
|
159
|
+
|
|
160
|
+
{/* ── Email / Substack ── conditional */}
|
|
161
|
+
{hasNewsletter && (
|
|
162
|
+
<SubscribeCard
|
|
163
|
+
icon={hasSubstack ? <SubstackIcon /> : <LuMail className="w-5 h-5" />}
|
|
164
|
+
title={t('email_newsletter')}
|
|
165
|
+
description={t('email_newsletter_description')}
|
|
166
|
+
>
|
|
167
|
+
{hasSubstack && (
|
|
168
|
+
<a
|
|
169
|
+
href={subscribe!.substack}
|
|
170
|
+
target="_blank"
|
|
171
|
+
rel="noopener noreferrer"
|
|
172
|
+
className="inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-accent/10 text-accent hover:bg-accent/20 transition-colors no-underline"
|
|
173
|
+
>
|
|
174
|
+
<SubstackIcon />
|
|
175
|
+
{t('subscribe_on_substack')}
|
|
176
|
+
<LuExternalLink className="w-3.5 h-3.5 opacity-60" />
|
|
177
|
+
</a>
|
|
178
|
+
)}
|
|
179
|
+
{!hasSubstack && hasEmail && (
|
|
180
|
+
<a
|
|
181
|
+
href={subscribe!.email}
|
|
182
|
+
target="_blank"
|
|
183
|
+
rel="noopener noreferrer"
|
|
184
|
+
className="inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-accent/10 text-accent hover:bg-accent/20 transition-colors no-underline"
|
|
185
|
+
>
|
|
186
|
+
<LuMail className="w-4 h-4" />
|
|
187
|
+
{t('subscribe_via_email')}
|
|
188
|
+
<LuExternalLink className="w-3.5 h-3.5 opacity-60" />
|
|
189
|
+
</a>
|
|
190
|
+
)}
|
|
191
|
+
</SubscribeCard>
|
|
192
|
+
)}
|
|
193
|
+
|
|
194
|
+
{/* ── Telegram ── conditional */}
|
|
195
|
+
{hasTelegram && (
|
|
196
|
+
<SubscribeCard
|
|
197
|
+
icon={<TelegramIcon />}
|
|
198
|
+
title={t('telegram_channel')}
|
|
199
|
+
description={t('telegram_channel_description')}
|
|
200
|
+
>
|
|
201
|
+
<a
|
|
202
|
+
href={subscribe!.telegram}
|
|
203
|
+
target="_blank"
|
|
204
|
+
rel="noopener noreferrer"
|
|
205
|
+
className="inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg bg-accent/10 text-accent hover:bg-accent/20 transition-colors no-underline"
|
|
206
|
+
>
|
|
207
|
+
<TelegramIcon />
|
|
208
|
+
{t('join_channel')}
|
|
209
|
+
<LuExternalLink className="w-3.5 h-3.5 opacity-60" />
|
|
210
|
+
</a>
|
|
211
|
+
</SubscribeCard>
|
|
212
|
+
)}
|
|
213
|
+
|
|
214
|
+
{/* ── WeChat Official Account ── conditional */}
|
|
215
|
+
{hasWechat && (
|
|
216
|
+
<SubscribeCard
|
|
217
|
+
icon={<WechatIcon />}
|
|
218
|
+
title={t('wechat_official')}
|
|
219
|
+
description={t('wechat_description')}
|
|
220
|
+
>
|
|
221
|
+
<div className="flex flex-col items-start gap-3">
|
|
222
|
+
<div className="w-36 h-36 rounded-xl border border-muted/20 overflow-hidden bg-white flex items-center justify-center">
|
|
223
|
+
<Image
|
|
224
|
+
src={subscribe!.wechat!.qrCode}
|
|
225
|
+
alt={subscribe?.wechat?.account || 'WeChat QR Code'}
|
|
226
|
+
width={144}
|
|
227
|
+
height={144}
|
|
228
|
+
className="object-contain"
|
|
229
|
+
/>
|
|
230
|
+
</div>
|
|
231
|
+
{subscribe?.wechat?.account && (
|
|
232
|
+
<p className="text-sm font-mono text-muted/60">{subscribe.wechat.account}</p>
|
|
233
|
+
)}
|
|
234
|
+
<p className="text-xs text-muted/50 italic">{t('scan_qr_code')}</p>
|
|
235
|
+
</div>
|
|
236
|
+
</SubscribeCard>
|
|
237
|
+
)}
|
|
238
|
+
|
|
239
|
+
{/* ── Social connections ── always visible if social links exist */}
|
|
240
|
+
{(social?.twitter || social?.github || social?.email) && (
|
|
241
|
+
<SubscribeCard
|
|
242
|
+
wide={!hasNewsletter && !hasTelegram && !hasWechat}
|
|
243
|
+
icon={
|
|
244
|
+
<svg viewBox="0 0 24 24" className="w-5 h-5" fill="currentColor" aria-hidden="true">
|
|
245
|
+
<path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 1 0 0 12.324 6.162 6.162 0 0 0 0-12.324zM12 16a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm6.406-11.845a1.44 1.44 0 1 0 0 2.881 1.44 1.44 0 0 0 0-2.881z" />
|
|
246
|
+
</svg>
|
|
247
|
+
}
|
|
248
|
+
title={t('social_connections')}
|
|
249
|
+
description="Follow along on social platforms for updates, discussions, and more."
|
|
250
|
+
>
|
|
251
|
+
<div className="flex flex-wrap gap-2">
|
|
252
|
+
{social?.twitter && (
|
|
253
|
+
<a
|
|
254
|
+
href={social.twitter}
|
|
255
|
+
target="_blank"
|
|
256
|
+
rel="noopener noreferrer"
|
|
257
|
+
className="inline-flex items-center gap-2 px-3 py-1.5 text-sm rounded-lg border border-muted/20 bg-background hover:border-accent hover:text-accent transition-colors no-underline"
|
|
258
|
+
>
|
|
259
|
+
<XIcon />
|
|
260
|
+
Twitter / X
|
|
261
|
+
</a>
|
|
262
|
+
)}
|
|
263
|
+
{social?.github && (
|
|
264
|
+
<a
|
|
265
|
+
href={social.github}
|
|
266
|
+
target="_blank"
|
|
267
|
+
rel="noopener noreferrer"
|
|
268
|
+
className="inline-flex items-center gap-2 px-3 py-1.5 text-sm rounded-lg border border-muted/20 bg-background hover:border-accent hover:text-accent transition-colors no-underline"
|
|
269
|
+
>
|
|
270
|
+
<LuGithub className="w-4 h-4" />
|
|
271
|
+
GitHub
|
|
272
|
+
</a>
|
|
273
|
+
)}
|
|
274
|
+
{social?.email && (
|
|
275
|
+
<a
|
|
276
|
+
href={social.email}
|
|
277
|
+
className="inline-flex items-center gap-2 px-3 py-1.5 text-sm rounded-lg border border-muted/20 bg-background hover:border-accent hover:text-accent transition-colors no-underline"
|
|
278
|
+
>
|
|
279
|
+
<LuMail className="w-4 h-4" />
|
|
280
|
+
Email
|
|
281
|
+
</a>
|
|
282
|
+
)}
|
|
283
|
+
</div>
|
|
284
|
+
</SubscribeCard>
|
|
285
|
+
)}
|
|
286
|
+
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
{/* Tip note about RSS */}
|
|
290
|
+
<p className="mt-10 text-xs text-muted/50 text-center">
|
|
291
|
+
RSS is an open standard — no account required. Copy the feed URL into any reader app.{' '}
|
|
292
|
+
<Link href="/feed.xml" className="hover:text-accent transition-colors" target="_blank">
|
|
293
|
+
View raw feed →
|
|
294
|
+
</Link>
|
|
295
|
+
</p>
|
|
296
|
+
</div>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useLanguage } from './LanguageProvider';
|
|
5
|
+
import PostList from './PostList';
|
|
6
|
+
import FlowTimelineEntry from './FlowTimelineEntry';
|
|
7
|
+
import type { PostData } from '@/lib/markdown';
|
|
8
|
+
|
|
9
|
+
type Tab = 'all' | 'posts' | 'flows';
|
|
10
|
+
|
|
11
|
+
interface FlowEntry {
|
|
12
|
+
slug: string;
|
|
13
|
+
date: string;
|
|
14
|
+
title: string;
|
|
15
|
+
excerpt: string;
|
|
16
|
+
tags: string[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface TagContentTabsProps {
|
|
20
|
+
posts: PostData[];
|
|
21
|
+
flows: FlowEntry[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default function TagContentTabs({ posts, flows }: TagContentTabsProps) {
|
|
25
|
+
const { t } = useLanguage();
|
|
26
|
+
const hasBoth = posts.length > 0 && flows.length > 0;
|
|
27
|
+
const [activeTab, setActiveTab] = useState<Tab>('all');
|
|
28
|
+
|
|
29
|
+
const showPosts = activeTab === 'all' || activeTab === 'posts';
|
|
30
|
+
const showFlows = activeTab === 'all' || activeTab === 'flows';
|
|
31
|
+
|
|
32
|
+
const tabs: { key: Tab; label: string; count: number }[] = [
|
|
33
|
+
{ key: 'all', label: t('tab_all'), count: posts.length + flows.length },
|
|
34
|
+
{ key: 'posts', label: t('posts'), count: posts.length },
|
|
35
|
+
{ key: 'flows', label: t('flow_notes'), count: flows.length },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div>
|
|
40
|
+
{/* Type tabs — only shown when both content types exist */}
|
|
41
|
+
{hasBoth && (
|
|
42
|
+
<div role="tablist" className="flex mb-8 border-b border-muted/20">
|
|
43
|
+
{tabs.map(({ key, label, count }) => (
|
|
44
|
+
<button
|
|
45
|
+
key={key}
|
|
46
|
+
type="button"
|
|
47
|
+
role="tab"
|
|
48
|
+
aria-selected={activeTab === key}
|
|
49
|
+
onClick={() => setActiveTab(key)}
|
|
50
|
+
className={`px-4 py-2.5 text-sm font-medium transition-colors border-b-2 -mb-px ${
|
|
51
|
+
activeTab === key
|
|
52
|
+
? 'text-accent border-accent'
|
|
53
|
+
: 'text-muted border-transparent hover:text-foreground'
|
|
54
|
+
}`}
|
|
55
|
+
>
|
|
56
|
+
{label}
|
|
57
|
+
<span className={`ml-1.5 text-xs font-mono ${activeTab === key ? 'text-accent/60' : 'text-muted/50'}`}>
|
|
58
|
+
{count}
|
|
59
|
+
</span>
|
|
60
|
+
</button>
|
|
61
|
+
))}
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
|
|
65
|
+
{/* Posts section */}
|
|
66
|
+
{showPosts && posts.length > 0 && (
|
|
67
|
+
<div>
|
|
68
|
+
<h2 className="text-[10px] font-sans font-bold uppercase tracking-widest text-muted mb-6">
|
|
69
|
+
{t('posts')}
|
|
70
|
+
<span className="ml-1.5 font-mono font-normal normal-case tracking-normal text-muted/50">
|
|
71
|
+
{posts.length}
|
|
72
|
+
</span>
|
|
73
|
+
</h2>
|
|
74
|
+
<PostList posts={posts} />
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
77
|
+
|
|
78
|
+
{/* Flows section */}
|
|
79
|
+
{showFlows && flows.length > 0 && (
|
|
80
|
+
<div className={showPosts && posts.length > 0 ? 'mt-12' : ''}>
|
|
81
|
+
<h2 className="text-[10px] font-sans font-bold uppercase tracking-widest text-muted mb-4">
|
|
82
|
+
{t('flow_notes')}
|
|
83
|
+
<span className="ml-1.5 font-mono font-normal normal-case tracking-normal text-muted/50">
|
|
84
|
+
{flows.length}
|
|
85
|
+
</span>
|
|
86
|
+
</h2>
|
|
87
|
+
<div>
|
|
88
|
+
{flows.map(flow => (
|
|
89
|
+
<FlowTimelineEntry
|
|
90
|
+
key={flow.slug}
|
|
91
|
+
date={flow.date}
|
|
92
|
+
title={flow.title}
|
|
93
|
+
excerpt={flow.excerpt}
|
|
94
|
+
tags={flow.tags}
|
|
95
|
+
slug={flow.slug}
|
|
96
|
+
/>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
@@ -5,18 +5,15 @@ import { useLanguage } from './LanguageProvider';
|
|
|
5
5
|
|
|
6
6
|
interface TagPageHeaderProps {
|
|
7
7
|
tag: string;
|
|
8
|
-
postCount: number;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
export default function TagPageHeader({ tag
|
|
12
|
-
const { t
|
|
13
|
-
|
|
14
|
-
const subtitleKey = postCount === 1 ? 'tag_posts_found_one' : 'tag_posts_found';
|
|
15
|
-
const subtitle = tWith(subtitleKey, { count: postCount });
|
|
10
|
+
export default function TagPageHeader({ tag }: TagPageHeaderProps) {
|
|
11
|
+
const { t } = useLanguage();
|
|
16
12
|
|
|
17
13
|
return (
|
|
18
14
|
<>
|
|
19
|
-
|
|
15
|
+
{/* Back link: visible only on mobile (desktop has sidebar) */}
|
|
16
|
+
<nav className="mb-8 flex lg:hidden">
|
|
20
17
|
<Link
|
|
21
18
|
href="/tags"
|
|
22
19
|
className="text-xs font-bold uppercase tracking-widest text-muted hover:text-accent transition-colors no-underline"
|
|
@@ -25,13 +22,10 @@ export default function TagPageHeader({ tag, postCount }: TagPageHeaderProps) {
|
|
|
25
22
|
</Link>
|
|
26
23
|
</nav>
|
|
27
24
|
|
|
28
|
-
<header className="mb-
|
|
29
|
-
<h1 className="text-
|
|
30
|
-
<span className="text-accent/50 mr-
|
|
25
|
+
<header className="mb-10">
|
|
26
|
+
<h1 className="text-3xl md:text-4xl font-serif font-bold text-heading">
|
|
27
|
+
<span className="text-accent/50 mr-1">#</span>{tag}
|
|
31
28
|
</h1>
|
|
32
|
-
<p className="text-lg text-muted font-serif italic">
|
|
33
|
-
{subtitle}
|
|
34
|
-
</p>
|
|
35
29
|
</header>
|
|
36
30
|
</>
|
|
37
31
|
);
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import Link from 'next/link';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { t, tWith } from '@/lib/i18n';
|
|
6
|
+
import { LuTag, LuX, LuSearch } from 'react-icons/lu';
|
|
7
|
+
|
|
8
|
+
const INITIAL_SHOW = 12;
|
|
9
|
+
|
|
10
|
+
interface TagSidebarProps {
|
|
11
|
+
tags: Record<string, number>;
|
|
12
|
+
activeTag: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function TagSidebar({ tags, activeTag }: TagSidebarProps) {
|
|
16
|
+
const [filter, setFilter] = useState('');
|
|
17
|
+
const [expanded, setExpanded] = useState(false);
|
|
18
|
+
|
|
19
|
+
const totalCount = Object.keys(tags).length;
|
|
20
|
+
|
|
21
|
+
const sortedTags = Object.entries(tags)
|
|
22
|
+
.sort((a, b) => b[1] - a[1])
|
|
23
|
+
.filter(([tag]) => !filter || tag.toLowerCase().includes(filter.toLowerCase()));
|
|
24
|
+
|
|
25
|
+
const activeIndex = sortedTags.findIndex(([tag]) => tag === activeTag);
|
|
26
|
+
|
|
27
|
+
// Compute visible tags:
|
|
28
|
+
// - Filtering or expanded: show all
|
|
29
|
+
// - Default: show first INITIAL_SHOW, then append active tag (with a separator)
|
|
30
|
+
// if it falls beyond the initial slice — keeps sidebar compact while
|
|
31
|
+
// always making the selected tag visible
|
|
32
|
+
const getVisibleTags = (): { entries: [string, number][]; appendedAt: number | null } => {
|
|
33
|
+
if (filter || expanded) return { entries: sortedTags, appendedAt: null };
|
|
34
|
+
const initial = sortedTags.slice(0, INITIAL_SHOW);
|
|
35
|
+
if (activeIndex >= INITIAL_SHOW) {
|
|
36
|
+
return { entries: [...initial, sortedTags[activeIndex]], appendedAt: INITIAL_SHOW };
|
|
37
|
+
}
|
|
38
|
+
return { entries: initial, appendedAt: null };
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const { entries: visibleTags, appendedAt } = getVisibleTags();
|
|
42
|
+
const remainingCount = sortedTags.length - visibleTags.length;
|
|
43
|
+
const showExpandButton = !filter && !expanded && remainingCount > 0;
|
|
44
|
+
// Only allow collapsing if it won't hide the active tag
|
|
45
|
+
const showCollapseButton = expanded && !filter && (activeIndex === -1 || activeIndex < INITIAL_SHOW);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<aside className="hidden lg:block flex-shrink-0">
|
|
49
|
+
<div className="sticky top-24">
|
|
50
|
+
|
|
51
|
+
{/* Section heading → links to all tags, shows total count */}
|
|
52
|
+
<Link
|
|
53
|
+
href="/tags"
|
|
54
|
+
className="flex items-center gap-1.5 text-[10px] font-sans font-bold uppercase tracking-widest text-muted hover:text-accent transition-colors no-underline mb-3"
|
|
55
|
+
>
|
|
56
|
+
<LuTag className="w-3 h-3" />
|
|
57
|
+
<span>{t('tags')}</span>
|
|
58
|
+
<span className="ml-auto font-mono font-normal normal-case tracking-normal text-muted/50">
|
|
59
|
+
{totalCount}
|
|
60
|
+
</span>
|
|
61
|
+
</Link>
|
|
62
|
+
|
|
63
|
+
{/* Filter input with clear button */}
|
|
64
|
+
<div className="relative mb-3">
|
|
65
|
+
<LuSearch className="absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted/40 pointer-events-none" />
|
|
66
|
+
<input
|
|
67
|
+
type="text"
|
|
68
|
+
value={filter}
|
|
69
|
+
onChange={(e) => setFilter(e.target.value)}
|
|
70
|
+
placeholder="Filter…"
|
|
71
|
+
aria-label={t('filter_tags')}
|
|
72
|
+
className="w-full pl-8 pr-7 py-1.5 text-xs bg-muted/5 border border-muted/15 rounded-lg outline-none focus:border-accent/40 text-foreground placeholder:text-muted/40 transition-colors"
|
|
73
|
+
/>
|
|
74
|
+
{filter && (
|
|
75
|
+
<button
|
|
76
|
+
onClick={() => setFilter('')}
|
|
77
|
+
className="absolute right-2 top-1/2 -translate-y-1/2 text-muted/40 hover:text-muted transition-colors p-0.5 rounded"
|
|
78
|
+
aria-label="Clear filter"
|
|
79
|
+
>
|
|
80
|
+
<LuX className="w-3 h-3" />
|
|
81
|
+
</button>
|
|
82
|
+
)}
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
{/* Tag list — no overflow, no scrollbar */}
|
|
86
|
+
<nav className="space-y-0.5">
|
|
87
|
+
{visibleTags.map(([tag, count], index) => {
|
|
88
|
+
const isActive = tag === activeTag;
|
|
89
|
+
// Thin separator before the appended active tag
|
|
90
|
+
const showSeparator = appendedAt !== null && index === appendedAt;
|
|
91
|
+
return (
|
|
92
|
+
<div key={tag}>
|
|
93
|
+
{showSeparator && <div className="my-1.5 h-px bg-muted/10" />}
|
|
94
|
+
<Link
|
|
95
|
+
href={`/tags/${encodeURIComponent(tag)}`}
|
|
96
|
+
className={`flex items-center justify-between px-2.5 py-1.5 rounded-lg text-sm no-underline transition-colors ${
|
|
97
|
+
isActive
|
|
98
|
+
? 'bg-accent/10 text-accent font-medium'
|
|
99
|
+
: 'text-foreground/70 hover:text-foreground hover:bg-muted/10'
|
|
100
|
+
}`}
|
|
101
|
+
>
|
|
102
|
+
<span className="truncate">{tag}</span>
|
|
103
|
+
<span className={`ml-2 text-xs font-mono flex-shrink-0 ${isActive ? 'text-accent/70' : 'text-muted/50'}`}>
|
|
104
|
+
{count}
|
|
105
|
+
</span>
|
|
106
|
+
</Link>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
})}
|
|
110
|
+
|
|
111
|
+
{/* Expand button */}
|
|
112
|
+
{showExpandButton && (
|
|
113
|
+
<button
|
|
114
|
+
onClick={() => setExpanded(true)}
|
|
115
|
+
aria-expanded={false}
|
|
116
|
+
className="w-full text-left px-2.5 py-1.5 text-xs text-muted/50 hover:text-accent transition-colors"
|
|
117
|
+
>
|
|
118
|
+
{tWith('more_tags', { count: remainingCount })}
|
|
119
|
+
</button>
|
|
120
|
+
)}
|
|
121
|
+
|
|
122
|
+
{/* Collapse button */}
|
|
123
|
+
{showCollapseButton && (
|
|
124
|
+
<button
|
|
125
|
+
onClick={() => setExpanded(false)}
|
|
126
|
+
aria-expanded={true}
|
|
127
|
+
className="w-full text-left px-2.5 py-1.5 text-xs text-muted/50 hover:text-accent transition-colors"
|
|
128
|
+
>
|
|
129
|
+
{t('collapse_tags')}
|
|
130
|
+
</button>
|
|
131
|
+
)}
|
|
132
|
+
|
|
133
|
+
{/* Empty state */}
|
|
134
|
+
{visibleTags.length === 0 && (
|
|
135
|
+
<p className="text-xs text-muted/60 italic px-2.5 py-2">{t('no_tags_found')}</p>
|
|
136
|
+
)}
|
|
137
|
+
</nav>
|
|
138
|
+
|
|
139
|
+
</div>
|
|
140
|
+
</aside>
|
|
141
|
+
);
|
|
142
|
+
}
|