From f17d856f98fa111a52614e657acd807207f93601 Mon Sep 17 00:00:00 2001 From: thzxx <1440196015@qq.com> Date: Sun, 23 Aug 2026 12:33:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=B2=E4=B9=A6=E4=B8=8E=E5=85=88?= =?UTF-8?q?=E4=BA=BA=E7=B0=BF=E5=8E=BB=E5=AE=9A=E5=AE=BD=EF=BC=88=E5=8F=B3?= =?UTF-8?q?=E7=A9=BA=E7=99=BD=E6=A0=B9=E6=B2=BB=EF=BC=89+=20=E5=8F=B2?= =?UTF-8?q?=E4=B9=A6=E6=8C=89=E5=B9=B4=E5=88=86=E7=BB=84=E7=9C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - chronicle-list max-width:760 废除 → 100% 全宽;战报匣/战事行 720 定宽移除 - 史书增强结构:按年分组眉(X年 · N条 · 生/殇/突破统计),月列升级 ch-month, 全宽下阅读秩序保留;最早年份倒序 - GenealogyPanel 先人簿 set-row 760 定宽移除 - 全局扫描同类定宽:设置(上轮已修)/史书/谱系全部补齐,左右不再留白 - 937 测试全绿、typecheck/build 通过 --- src/renderer/ui/panels/ChroniclePanel.tsx | 55 ++++++++++++++++++----- src/renderer/ui/panels/GenealogyPanel.tsx | 2 +- src/renderer/ui/styles.css | 18 +++++++- 3 files changed, 63 insertions(+), 12 deletions(-) diff --git a/src/renderer/ui/panels/ChroniclePanel.tsx b/src/renderer/ui/panels/ChroniclePanel.tsx index 911a213..265b2e7 100644 --- a/src/renderer/ui/panels/ChroniclePanel.tsx +++ b/src/renderer/ui/panels/ChroniclePanel.tsx @@ -16,6 +16,36 @@ const CAT_NAME: Record = { misc: '家常' } +interface ChEntry { + id: string + year: number + month: number + category: string + important: boolean + text: string +} + +function grouped(entries: ChEntry[]): { year: number; items: ChEntry[] }[] { + const map = new Map() + for (const e of entries) { + const g = map.get(e.year) ?? [] + g.push(e) + map.set(e.year, g) + } + return [...map.entries()].sort((a, b) => b[0] - a[0]).map(([year, items]) => ({ year, items })) +} + +function statOf(g: { items: { category: string }[] }): string { + const births = g.items.filter((i) => i.category === 'birth').length + const deaths = g.items.filter((i) => i.category === 'death').length + const bt = g.items.filter((i) => i.category === 'breakthrough').length + const parts: string[] = [] + if (births) parts.push(`生${births}`) + if (deaths) parts.push(`殇${deaths}`) + if (bt) parts.push(`突破${bt}`) + return parts.join(' · ') +} + export default function ChroniclePanel() { const world = useGameStore((s) => s.world) const revision = useGameStore((s) => s.revision) @@ -46,13 +76,18 @@ export default function ChroniclePanel() { ))}
- {entries.map((e) => ( -
- {e.year}年{e.month}月 - - {CAT_NAME[e.category] ?? e.category} - {e.text} - + {grouped(entries).map((g) => ( +
+
{g.year}年 {g.items.length}条 · {statOf(g)}
+ {g.items.map((e) => ( +
+ {e.month}月 + + {CAT_NAME[e.category] ?? e.category} + {e.text} + +
+ ))}
))} {entries.length === 0 &&
暂无记载。
} @@ -60,7 +95,7 @@ export default function ChroniclePanel() {
战报匣(全文留存)
{battle ? ( -
+
{battle.title} @@ -85,9 +120,9 @@ export default function ChroniclePanel() { ) : battles.length === 0 ? (
尚无战事可录。
) : ( -
+
{battles.map((b) => ( -
+
{b.year}年{b.month}月 {b.title} diff --git a/src/renderer/ui/panels/GenealogyPanel.tsx b/src/renderer/ui/panels/GenealogyPanel.tsx index 96bdb37..9b77ca1 100644 --- a/src/renderer/ui/panels/GenealogyPanel.tsx +++ b/src/renderer/ui/panels/GenealogyPanel.tsx @@ -77,7 +77,7 @@ export default function GenealogyPanel() { {deceasedTab && deceased.map((c) => ( -
+
殁于{c.deathYear}年 {c.name} · {c.gender === 'male' ? '男' : '女'} · 第{c.generation}代 diff --git a/src/renderer/ui/styles.css b/src/renderer/ui/styles.css index 95ba226..ffd7cb4 100644 --- a/src/renderer/ui/styles.css +++ b/src/renderer/ui/styles.css @@ -1029,7 +1029,7 @@ body { 史书 ============================================================ */ .chronicle-list { - max-width: 760px; + max-width: 100%; background: linear-gradient(180deg, #f4ecd9, #e9dabc); color: var(--ink); border: 1px solid #b9a77e; @@ -1049,6 +1049,22 @@ body { .ch-item:last-child { border-bottom: none; } +.ch-yearbar { + display: flex; + align-items: baseline; + gap: 10px; + padding: 12px 4px 4px; + border-bottom: 1px solid rgba(140, 110, 60, 0.45); + color: #a04b33; + font-size: 1.04rem; + letter-spacing: 3px; + font-weight: 700; +} +.ch-month { + color: #8a7c5e; + min-width: 40px; + white-space: nowrap; +} .ch-year { color: #a04b33; white-space: nowrap;