From 518b1fe178fa71432dcfc096f8b780b6cb3f6e6f Mon Sep 17 00:00:00 2001 From: Andres Date: Tue, 20 May 2025 06:58:42 +0200 Subject: [PATCH] add img support --- src/app/(home)/log-parser/page.tsx | 41 ++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/app/(home)/log-parser/page.tsx b/src/app/(home)/log-parser/page.tsx index 1e16c8e..37c83fd 100644 --- a/src/app/(home)/log-parser/page.tsx +++ b/src/app/(home)/log-parser/page.tsx @@ -42,6 +42,7 @@ type LogEvent = { timestamp: Date text: string type: 'event' | 'status' | 'system' | 'shop' | 'action' | 'error' | 'info' + img?: string } // Define the structure for game options parsed from lobbyOptions @@ -454,8 +455,10 @@ export default function LogParser() { const cardRaw = cardMatch?.[1]?.trim() ?? 'Unknown Card' const cardClean = cardRaw.replace(/^(c_mp_|j_mp_)/, '') const cost = costMatch?.[1] ? Number.parseInt(costMatch[1], 10) : 0 + console.log(cardRaw) currentGame.events.push({ timestamp, + img: jokers[cardRaw]?.file, text: `Bought ${cardClean}${cost > 0 ? ` for $${cost}` : ''}`, type: 'shop', }) @@ -713,20 +716,30 @@ export default function LogParser() {
- {game.events.map((event, index) => ( -
- - {formatter.dateTime(event.timestamp, { - timeStyle: 'medium', - })} - - {event.text} -
- ))} + {game.events.map((event, index) => { + console.log(event.img) + return ( + <> +
+ + {formatter.dateTime(event.timestamp, { + timeStyle: 'medium', + })} + + {event.text} +
+ {event.img && ( +
+ +
+ )} + + ) + })}