From 7fe146f97ddd3f5a8d0c1a996a73cb296c28b9cc Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Mon, 7 Jul 2025 01:07:34 -0700 Subject: implement score deletion --- .../components/displays/GenericScoreDisplay.tsx | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'frontend/src/components/displays/GenericScoreDisplay.tsx') diff --git a/frontend/src/components/displays/GenericScoreDisplay.tsx b/frontend/src/components/displays/GenericScoreDisplay.tsx index c30e475..45bf1ca 100644 --- a/frontend/src/components/displays/GenericScoreDisplay.tsx +++ b/frontend/src/components/displays/GenericScoreDisplay.tsx @@ -13,6 +13,7 @@ interface ScoreDisplayProps { sortField: string; sortDirection: "asc" | "desc"; onSort: (field: string) => void; + onDelete?: (scoreId: number) => void; } const ScoreDisplay: React.FC = ({ @@ -21,6 +22,7 @@ const ScoreDisplay: React.FC = ({ sortField, sortDirection, onSort, + onDelete, }) => { // Key mappings for better display names. Hit or miss const keyDisplayNames: Record = { @@ -238,6 +240,9 @@ const ScoreDisplay: React.FC = ({ "timestamp", ].filter((key) => allKeys.includes(key)); + // Add actions column if delete function is provided + const showActions = onDelete && viewMode === "table"; + if (scores.length === 0) { return (
@@ -369,13 +374,18 @@ const ScoreDisplay: React.FC = ({ )} ))} + {showActions && ( + + Actions + + )} {sortedScores.map((score, index) => ( {tableKeys.map((key) => ( @@ -406,6 +416,19 @@ const ScoreDisplay: React.FC = ({ )} ))} + {showActions && ( + + + + )} ))} -- cgit v1.2.3