mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-11 00:02:38 +02:00
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
This commit is contained in:
parent
37c1627d79
commit
3630032d21
1 changed files with 30 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
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 { TrackBlockSchema } from '@x/shared/dist/track-block.js';
|
||||||
import { WorkDir } from '../config/config.js';
|
import { WorkDir } from '../config/config.js';
|
||||||
import z from 'zod';
|
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<string, string>(
|
||||||
|
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<string, unknown>;
|
||||||
|
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 {
|
export function ensureDailyNote(): void {
|
||||||
migrateEmojiHeadings();
|
migrateEmojiHeadings();
|
||||||
|
migrateTrackIcons();
|
||||||
if (fs.existsSync(DAILY_NOTE_PATH)) return;
|
if (fs.existsSync(DAILY_NOTE_PATH)) return;
|
||||||
fs.writeFileSync(DAILY_NOTE_PATH, buildDailyNoteContent(), 'utf-8');
|
fs.writeFileSync(DAILY_NOTE_PATH, buildDailyNoteContent(), 'utf-8');
|
||||||
console.log('[DailyNote] Created today.md');
|
console.log('[DailyNote] Created today.md');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue