From 3630032d212dd38f745ea1e734f1013552398797 Mon Sep 17 00:00:00 2001 From: gagan Date: Wed, 6 May 2026 19:41:28 +0530 Subject: [PATCH] feat/today-minimal-polish (#532) * feat: remove emoji headings and polish track block chip styling - Strip emojis from Today.md section headings (new + existing files via migration) - Track chip: full-width card style matching email blocks, colored icons per track type - Larger, taller chip with muted gray background for light/dark mode * feat: increase track chip icon and text size * feat: make track block icons configurable via yaml * fix: migrate missing icon fields in existing Today.md on startup --- .../core/src/knowledge/ensure_daily_note.ts | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/apps/x/packages/core/src/knowledge/ensure_daily_note.ts b/apps/x/packages/core/src/knowledge/ensure_daily_note.ts index a4da6977..3172993a 100644 --- a/apps/x/packages/core/src/knowledge/ensure_daily_note.ts +++ b/apps/x/packages/core/src/knowledge/ensure_daily_note.ts @@ -1,6 +1,6 @@ import path from 'path'; import fs from 'fs'; -import { stringify as stringifyYaml } from 'yaml'; +import { stringify as stringifyYaml, parse as parseYaml } from 'yaml'; import { TrackBlockSchema } from '@x/shared/dist/track-block.js'; import { WorkDir } from '../config/config.js'; import z from 'zod'; @@ -179,8 +179,37 @@ function migrateEmojiHeadings(): void { } } +function migrateTrackIcons(): void { + if (!fs.existsSync(DAILY_NOTE_PATH)) return; + let content = fs.readFileSync(DAILY_NOTE_PATH, 'utf-8'); + const original = content; + + const iconMap = new Map( + SECTIONS.flatMap(({ track }) => track.icon ? [[track.trackId, track.icon]] : []) + ); + + content = content.replace(/```track\n([\s\S]*?)\n```/g, (match, yaml) => { + try { + const parsed = parseYaml(yaml) as Record; + if (!parsed.trackId || parsed.icon) return match; + const icon = iconMap.get(parsed.trackId as string); + if (!icon) return match; + const updated = yaml.replace(/^(trackId: .+)$/m, `$1\nicon: ${icon}`); + return '```track\n' + updated + '\n```'; + } catch { + return match; + } + }); + + if (content !== original) { + fs.writeFileSync(DAILY_NOTE_PATH, content, 'utf-8'); + console.log('[DailyNote] Migrated track icons'); + } +} + export function ensureDailyNote(): void { migrateEmojiHeadings(); + migrateTrackIcons(); if (fs.existsSync(DAILY_NOTE_PATH)) return; fs.writeFileSync(DAILY_NOTE_PATH, buildDailyNoteContent(), 'utf-8'); console.log('[DailyNote] Created today.md');