From 3378ad07b198d2332ce51241c3a1f2253fb269d4 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Tue, 7 Oct 2025 06:55:41 -0600 Subject: [PATCH] Update classification data card to use classification card --- web/public/locales/en/common.json | 5 +- .../components/card/ClassificationCard.tsx | 6 +- .../classification/ModelTrainingView.tsx | 72 +++++++------------ 3 files changed, 35 insertions(+), 48 deletions(-) diff --git a/web/public/locales/en/common.json b/web/public/locales/en/common.json index c22a9227d..501f2d4bc 100644 --- a/web/public/locales/en/common.json +++ b/web/public/locales/en/common.json @@ -263,5 +263,8 @@ "desc": "Page not found" }, "selectItem": "Select {{item}}", - "readTheDocumentation": "Read the documentation" + "readTheDocumentation": "Read the documentation", + "information": { + "pixels": "{{area}}px" + } } diff --git a/web/src/components/card/ClassificationCard.tsx b/web/src/components/card/ClassificationCard.tsx index 7e694c595..235224db6 100644 --- a/web/src/components/card/ClassificationCard.tsx +++ b/web/src/components/card/ClassificationCard.tsx @@ -11,6 +11,7 @@ import { useTranslation } from "react-i18next"; type ClassificationCardProps = { className?: string; + imgClassName?: string; data: ClassificationItemData; threshold?: ClassificationThreshold; selected: boolean; @@ -20,6 +21,7 @@ type ClassificationCardProps = { }; export function ClassificationCard({ className, + imgClassName, data, threshold, selected, @@ -75,7 +77,7 @@ export function ClassificationCard({ setImageLoaded(true)} - className={cn("size-44", isMobile && "w-full")} + className={cn("size-44", imgClassName, isMobile && "w-full")} src={`${baseUrl}${data.filepath}`} onClick={(e) => { e.stopPropagation(); @@ -84,7 +86,7 @@ export function ClassificationCard({ /> {imageArea != undefined && (
- {t("pixels", { area: imageArea })} + {t("information.pixels", { ns: "common", area: imageArea })}
)} diff --git a/web/src/views/classification/ModelTrainingView.tsx b/web/src/views/classification/ModelTrainingView.tsx index 7fe241496..68a2bfbbc 100644 --- a/web/src/views/classification/ModelTrainingView.tsx +++ b/web/src/views/classification/ModelTrainingView.tsx @@ -61,6 +61,7 @@ import { MdAutoFixHigh } from "react-icons/md"; import TrainFilterDialog from "@/components/overlay/dialog/TrainFilterDialog"; import useApiFilter from "@/hooks/use-api-filter"; import { TrainFilter } from "@/types/classification"; +import { ClassificationCard } from "@/components/card/ClassificationCard"; type ModelTrainingViewProps = { model: CustomClassificationModelConfig; @@ -626,53 +627,34 @@ function DatasetGrid({ className="scrollbar-container flex flex-wrap gap-2 overflow-y-auto p-2" > {classData.map((image) => ( -
{ - e.stopPropagation(); - - if (e.ctrlKey || e.metaKey) { - onClickImages([image], true); - } + onClickImages([data.filename], true)} > -
- -
-
-
-
- - - { - e.stopPropagation(); - onDelete([image]); - }} - /> - - - {t("button.deleteClassificationAttempts")} - - -
-
-
-
+ + + { + e.stopPropagation(); + onDelete([image]); + }} + /> + + + {t("button.deleteClassificationAttempts")} + + + ))} );