@hutusi/amytis 1.5.6 → 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.
Files changed (65) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/CLAUDE.md +3 -2
  3. package/GEMINI.md +13 -6
  4. package/README.md +1 -1
  5. package/TODO.md +21 -76
  6. package/bun.lock +18 -3
  7. package/content/about.mdx +1 -0
  8. package/content/about.zh.mdx +21 -0
  9. package/content/flows/2026/02/20.md +16 -0
  10. package/content/links.mdx +42 -0
  11. package/content/links.zh.mdx +41 -0
  12. package/content/posts/2026-02-20-i18n-routing-considerations.mdx +150 -0
  13. package/content/posts/multimedia-showcase/index.mdx +261 -0
  14. package/content/privacy.mdx +32 -0
  15. package/content/privacy.zh.mdx +32 -0
  16. package/docs/ARCHITECTURE.md +11 -2
  17. package/docs/CONTRIBUTING.md +4 -2
  18. package/docs/deployment.md +9 -1
  19. package/eslint.config.mjs +2 -0
  20. package/package.json +5 -4
  21. package/public/next-image-export-optimizer-hashes.json +0 -3
  22. package/scripts/copy-assets.ts +1 -1
  23. package/site.config.ts +126 -44
  24. package/src/app/[slug]/page.tsx +0 -10
  25. package/src/app/archive/page.tsx +38 -10
  26. package/src/app/books/[slug]/page.tsx +18 -0
  27. package/src/app/flows/[year]/[month]/[day]/page.tsx +21 -4
  28. package/src/app/layout.tsx +48 -21
  29. package/src/app/page.tsx +135 -72
  30. package/src/app/posts/[slug]/page.tsx +6 -12
  31. package/src/app/search.json/route.ts +4 -0
  32. package/src/app/series/[slug]/page.tsx +18 -0
  33. package/src/app/subscribe/page.tsx +17 -0
  34. package/src/app/tags/[tag]/page.tsx +9 -26
  35. package/src/app/tags/page.tsx +3 -8
  36. package/src/components/AuthorCard.tsx +43 -0
  37. package/src/components/Comments.tsx +20 -4
  38. package/src/components/ExternalLinks.tsx +6 -2
  39. package/src/components/Footer.tsx +35 -26
  40. package/src/components/LanguageProvider.tsx +0 -5
  41. package/src/components/LanguageSwitch.tsx +117 -6
  42. package/src/components/LocaleSwitch.tsx +33 -0
  43. package/src/components/Navbar.tsx +31 -8
  44. package/src/components/PostNavigation.tsx +55 -0
  45. package/src/components/PostSidebar.tsx +172 -126
  46. package/src/components/ReadingProgressBar.tsx +6 -21
  47. package/src/components/RelatedPosts.tsx +1 -1
  48. package/src/components/Search.tsx +420 -70
  49. package/src/components/SelectedBooksSection.tsx +12 -6
  50. package/src/components/ShareBar.tsx +115 -0
  51. package/src/components/SimpleLayoutHeader.tsx +5 -14
  52. package/src/components/SubscribePage.tsx +298 -0
  53. package/src/components/TagContentTabs.tsx +103 -0
  54. package/src/components/TagPageHeader.tsx +7 -13
  55. package/src/components/TagSidebar.tsx +142 -0
  56. package/src/components/TagsIndexClient.tsx +156 -0
  57. package/src/hooks/useScrollY.ts +41 -0
  58. package/src/i18n/translations.ts +110 -2
  59. package/src/layouts/PostLayout.tsx +34 -7
  60. package/src/layouts/SimpleLayout.tsx +53 -15
  61. package/src/lib/markdown.ts +71 -15
  62. package/src/lib/search-utils.test.ts +163 -0
  63. package/src/lib/search-utils.ts +39 -0
  64. package/src/types/pagefind.d.ts +42 -0
  65. package/src/components/TableOfContents.tsx +0 -158
@@ -0,0 +1,115 @@
1
+ 'use client'
2
+
3
+ import { useState } from 'react';
4
+ import { IconType } from 'react-icons';
5
+ import { FaXTwitter, FaFacebook, FaLinkedin, FaWeibo, FaRedditAlien, FaTelegram, FaMastodon, FaHackerNews } from 'react-icons/fa6';
6
+ import { SiBluesky, SiDouban, SiZhihu } from 'react-icons/si';
7
+ import { LuLink, LuCheck } from 'react-icons/lu';
8
+ import { siteConfig } from '../../site.config';
9
+ import { useLanguage } from './LanguageProvider';
10
+
11
+ interface ShareBarProps {
12
+ url: string;
13
+ title: string;
14
+ className?: string;
15
+ }
16
+
17
+ type Platform =
18
+ | 'twitter' | 'facebook' | 'linkedin' | 'weibo'
19
+ | 'reddit' | 'hackernews' | 'telegram' | 'bluesky' | 'mastodon'
20
+ | 'douban' | 'zhihu'
21
+ | 'copy';
22
+
23
+ const PLATFORM_META: Record<Platform, { label: string; Icon: IconType }> = {
24
+ twitter: { label: 'X / Twitter', Icon: FaXTwitter },
25
+ facebook: { label: 'Facebook', Icon: FaFacebook },
26
+ linkedin: { label: 'LinkedIn', Icon: FaLinkedin },
27
+ weibo: { label: '微博', Icon: FaWeibo },
28
+ reddit: { label: 'Reddit', Icon: FaRedditAlien },
29
+ hackernews: { label: 'Hacker News', Icon: FaHackerNews },
30
+ telegram: { label: 'Telegram', Icon: FaTelegram },
31
+ bluesky: { label: 'Bluesky', Icon: SiBluesky },
32
+ mastodon: { label: 'Mastodon', Icon: FaMastodon },
33
+ douban: { label: '豆瓣', Icon: SiDouban },
34
+ zhihu: { label: '知乎', Icon: SiZhihu },
35
+ copy: { label: 'Copy link', Icon: LuLink },
36
+ };
37
+
38
+ function getShareUrl(platform: Platform, url: string, title: string): string {
39
+ const eu = encodeURIComponent(url);
40
+ const et = encodeURIComponent(title);
41
+ const combined = encodeURIComponent(`${title} ${url}`);
42
+ switch (platform) {
43
+ case 'twitter': return `https://twitter.com/intent/tweet?text=${et}&url=${eu}`;
44
+ case 'facebook': return `https://www.facebook.com/sharer/sharer.php?u=${eu}`;
45
+ case 'linkedin': return `https://www.linkedin.com/sharing/share-offsite/?url=${eu}`;
46
+ case 'weibo': return `https://service.weibo.com/share/share.php?url=${eu}&title=${et}`;
47
+ case 'reddit': return `https://www.reddit.com/submit?url=${eu}&title=${et}`;
48
+ case 'hackernews': return `https://news.ycombinator.com/submitlink?u=${eu}&t=${et}`;
49
+ case 'telegram': return `https://t.me/share/url?url=${eu}&text=${et}`;
50
+ case 'bluesky': return `https://bsky.app/intent/compose?text=${combined}`;
51
+ case 'mastodon': return `https://mastodon.social/share?text=${combined}`;
52
+ case 'douban': return `https://www.douban.com/share/service?href=${eu}&name=${et}`;
53
+ case 'zhihu': return `https://www.zhihu.com/share?href=${eu}&type=text&title=${et}`;
54
+ case 'copy': return '';
55
+ }
56
+ }
57
+
58
+ export default function ShareBar({ url, title, className = '' }: ShareBarProps) {
59
+ const { t } = useLanguage();
60
+ const [copied, setCopied] = useState(false);
61
+
62
+ if (!siteConfig.share?.enabled) return null;
63
+ const configured = siteConfig.share?.platforms ?? [];
64
+ const platforms = configured.filter((p): p is Platform => p in PLATFORM_META);
65
+ if (platforms.length === 0) return null;
66
+
67
+ const handleCopy = async () => {
68
+ try {
69
+ await navigator.clipboard.writeText(url);
70
+ setCopied(true);
71
+ setTimeout(() => setCopied(false), 2000);
72
+ } catch {
73
+ // clipboard not available
74
+ }
75
+ };
76
+
77
+ const btnClass = 'inline-flex items-center justify-center w-8 h-8 rounded text-muted hover:text-accent hover:bg-muted/10 transition-colors';
78
+
79
+ return (
80
+ <div className={`flex flex-row flex-wrap gap-1 ${className}`}>
81
+ {platforms.map((platform) => {
82
+ const { label, Icon } = PLATFORM_META[platform];
83
+
84
+ if (platform === 'copy') {
85
+ const copyLabel = copied ? t('link_copied') : t('copy_link');
86
+ return (
87
+ <button
88
+ key={platform}
89
+ onClick={handleCopy}
90
+ title={copyLabel}
91
+ aria-label={copyLabel}
92
+ className={`${btnClass} ${copied ? 'text-accent' : ''}`}
93
+ >
94
+ {copied ? <LuCheck size={16} /> : <Icon size={16} />}
95
+ </button>
96
+ );
97
+ }
98
+
99
+ return (
100
+ <a
101
+ key={platform}
102
+ href={getShareUrl(platform, url, title)}
103
+ target="_blank"
104
+ rel="noopener noreferrer"
105
+ title={label}
106
+ aria-label={`Share on ${label}`}
107
+ className={`${btnClass} no-underline`}
108
+ >
109
+ <Icon size={16} />
110
+ </a>
111
+ );
112
+ })}
113
+ </div>
114
+ );
115
+ }
@@ -2,30 +2,21 @@
2
2
 
3
3
  import { useLanguage } from './LanguageProvider';
4
4
  import { TranslationKey } from '@/i18n/translations';
5
- import { resolveLocaleValue } from '@/lib/i18n';
6
5
 
7
6
  interface SimpleLayoutHeaderProps {
8
7
  title: string;
9
8
  excerpt?: string;
10
9
  titleKey?: TranslationKey;
11
10
  subtitleKey?: TranslationKey;
12
- titleOverride?: string | Record<string, string>;
13
- subtitleOverride?: string | Record<string, string>;
11
+ contentLocales?: Record<string, { content: string; title?: string; excerpt?: string }>;
14
12
  }
15
13
 
16
- export default function SimpleLayoutHeader({ title, excerpt, titleKey, subtitleKey, titleOverride, subtitleOverride }: SimpleLayoutHeaderProps) {
14
+ export default function SimpleLayoutHeader({ title, excerpt, titleKey, subtitleKey, contentLocales }: SimpleLayoutHeaderProps) {
17
15
  const { t, language } = useLanguage();
18
16
 
19
- const displayTitle = titleOverride
20
- ? resolveLocaleValue(titleOverride, language)
21
- : titleKey
22
- ? t(titleKey)
23
- : title;
24
- const displaySubtitle = subtitleOverride
25
- ? resolveLocaleValue(subtitleOverride, language)
26
- : subtitleKey
27
- ? t(subtitleKey)
28
- : excerpt;
17
+ const localeData = contentLocales?.[language];
18
+ const displayTitle = localeData?.title ?? (titleKey ? t(titleKey) : title);
19
+ const displaySubtitle = localeData?.excerpt ?? (subtitleKey ? t(subtitleKey) : excerpt);
29
20
 
30
21
  return (
31
22
  <header className="page-header">
@@ -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, postCount }: TagPageHeaderProps) {
12
- const { t, tWith } = useLanguage();
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
- <nav className="mb-12 flex justify-center">
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-20 text-center">
29
- <h1 className="text-4xl md:text-6xl font-serif font-bold text-heading mb-6 capitalize">
30
- <span className="text-accent/50 mr-2">#</span>{tag}
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
  );