From 938e387356119ee8dc281bef4917c695cbec52fd Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sun, 9 Jul 2023 09:43:10 -0500 Subject: [PATCH] show sublabel score --- web/src/icons/Score.jsx | 20 ++++++++++++++++++++ web/src/routes/Events.jsx | 19 +++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 web/src/icons/Score.jsx diff --git a/web/src/icons/Score.jsx b/web/src/icons/Score.jsx new file mode 100644 index 000000000..2abed4b9e --- /dev/null +++ b/web/src/icons/Score.jsx @@ -0,0 +1,20 @@ +import { h } from 'preact'; +import { memo } from 'preact/compat'; + +export function Score({ className = 'h-6 w-6', stroke = 'currentColor', fill = 'currentColor', onClick = () => {} }) { + return ( + + percent + + + ); +} + +export default memo(Score); diff --git a/web/src/routes/Events.jsx b/web/src/routes/Events.jsx index 9d503cb8b..7d04d3bc4 100644 --- a/web/src/routes/Events.jsx +++ b/web/src/routes/Events.jsx @@ -30,6 +30,7 @@ import TimeAgo from '../components/TimeAgo'; import Timepicker from '../components/TimePicker'; import TimelineSummary from '../components/TimelineSummary'; import TimelineEventOverlay from '../components/TimelineEventOverlay'; +import { Score } from '../icons/Score'; const API_LIMIT = 25; @@ -602,13 +603,10 @@ export default function Events({ path, ...props }) {
- {event.sub_label - ? `${event.label.replaceAll('_', ' ')}: ${event.sub_label.replaceAll('_', ' ')}` - : event.label.replaceAll('_', ' ')} - {(event?.data?.top_score || event.top_score || 0) == 0 - ? null - : ` (${((event?.data?.top_score || event.top_score) * 100).toFixed(0)}%)`} + {event.label.replaceAll('_', ' ')} + {event.sub_label ? `: ${event.sub_label.replaceAll('_', ' ')}` : null}
+
{formatUnixTimestampToDateTime(event.start_time, { ...config.ui })} @@ -628,6 +626,15 @@ export default function Events({ path, ...props }) { {event.zones.join(', ').replaceAll('_', ' ')}
+
+ + {(event?.data?.top_score || event.top_score || 0) == 0 + ? null + : `Label: ${((event?.data?.top_score || event.top_score) * 100).toFixed(0)}%`} + {(event?.data?.sub_label_score || 0) == 0 + ? null + : `, Sub Label: ${(event?.data?.sub_label_score * 100).toFixed(0)}%`} +