From 26cfc526d1f06265d8d666aba18004ae7893cb3f Mon Sep 17 00:00:00 2001 From: Riccardo Senica <46839416+RiccardoSenica@users.noreply.github.com> Date: Mon, 20 Jan 2025 05:52:50 +0000 Subject: [PATCH] style: tweak report layout --- utils/commands/report.ts | 41 +++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/utils/commands/report.ts b/utils/commands/report.ts index 5bcfb94..7abab64 100644 --- a/utils/commands/report.ts +++ b/utils/commands/report.ts @@ -137,6 +137,27 @@ export class ExpenseReporter { th { background-color: #f5f5f5; } .summary { margin: 20px 0; padding: 20px; background: #f9f9f9; border-radius: 5px; } .category-summary { margin-top: 10px; } + .rating { + --star-size: 20px; + --star-background: #ffd700; + --star-color: #ddd; + --percent: calc(var(--rating) * 20%); + display: inline-block; + font-size: var(--star-size); + font-family: Times; /* Ensures better star symbol rendering */ + line-height: 1; + background: linear-gradient(90deg, + var(--star-background) var(--percent), + var(--star-color) var(--percent) + ); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; + } + .rating::before { + content: '★★★★★'; + letter-spacing: 3px; + } @@ -208,17 +229,15 @@ export class ExpenseReporter { (dl): dl is typeof dl & { comments: any[] } => dl.comments !== null && Array.isArray(dl.comments) ) - .flatMap(dl => - dl.comments.map( - comment => ` - - ${dl.id} - ${formatDate(dl.createdAt)} - ${'✪'.repeat(comment.stars)} - ${comment.text} - - ` - ) + .map( + dl => ` + + ${dl.id} + ${formatDate(dl.createdAt)} +
+ ${dl.comments.map(c => `- ${c.text}`).join('
')} + + ` ) .join('')}