From 72896f4631b29f6b12ba1cddca48d60a55e25571 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 20 Oct 2025 17:03:27 -0600 Subject: [PATCH] Clean up design of classification card --- .../locales/en/views/classificationModel.json | 4 +- .../components/card/ClassificationCard.tsx | 91 +++++++++---------- .../overlay/ClassificationSelectionDialog.tsx | 20 ++-- .../overlay/dialog/TrainFilterDialog.tsx | 4 +- .../classification/ModelTrainingView.tsx | 18 +--- 5 files changed, 60 insertions(+), 77 deletions(-) diff --git a/web/public/locales/en/views/classificationModel.json b/web/public/locales/en/views/classificationModel.json index 47b2b13bf..f28cb3753 100644 --- a/web/public/locales/en/views/classificationModel.json +++ b/web/public/locales/en/views/classificationModel.json @@ -41,8 +41,8 @@ "invalidName": "Invalid name. Names can only include letters, numbers, spaces, apostrophes, underscores, and hyphens." }, "train": { - "title": "Train", - "aria": "Select Train" + "title": "Recent Classifications", + "aria": "Select Recent Classifications" }, "categories": "Classes", "createCategory": { diff --git a/web/src/components/card/ClassificationCard.tsx b/web/src/components/card/ClassificationCard.tsx index 5153b6d71..ca4f430d2 100644 --- a/web/src/components/card/ClassificationCard.tsx +++ b/web/src/components/card/ClassificationCard.tsx @@ -72,59 +72,58 @@ export function ClassificationCard({ }, [showArea, imageLoaded]); return ( - <> -
+ -
- setImageLoaded(true)} - className={cn("size-44", imgClassName, isMobile && "w-full")} - src={`${baseUrl}${data.filepath}`} - onClick={(e) => { - e.stopPropagation(); - onClick(data, e.metaKey || e.ctrlKey); - }} - /> - {imageArea != undefined && ( -
- {t("information.pixels", { ns: "common", area: imageArea })} -
- )} + onLoad={() => setImageLoaded(true)} + src={`${baseUrl}${data.filepath}`} + onClick={(e) => { + e.stopPropagation(); + onClick(data, e.metaKey || e.ctrlKey); + }} + /> + {false && imageArea != undefined && ( +
+ {t("information.pixels", { ns: "common", area: imageArea })}
-
-
-
-
- {data.name == "unknown" ? t("details.unknown") : data.name} + )} +
+
+
+
+ {data.name == "unknown" ? t("details.unknown") : data.name} +
+ {data.score && ( +
+ {Math.round(data.score * 100)}%
- {data.score && ( -
- {Math.round(data.score * 100)}% -
- )} -
-
- {children} -
+ )} +
+
+ {children}
- +
); } diff --git a/web/src/components/overlay/ClassificationSelectionDialog.tsx b/web/src/components/overlay/ClassificationSelectionDialog.tsx index f86ced19a..ca5057ee5 100644 --- a/web/src/components/overlay/ClassificationSelectionDialog.tsx +++ b/web/src/components/overlay/ClassificationSelectionDialog.tsx @@ -20,15 +20,14 @@ import { TooltipTrigger, } from "@/components/ui/tooltip"; import { isDesktop, isMobile } from "react-device-detect"; -import { LuPlus } from "react-icons/lu"; import { useTranslation } from "react-i18next"; import { cn } from "@/lib/utils"; import React, { ReactNode, useCallback, useMemo, useState } from "react"; import TextEntryDialog from "./dialog/TextEntryDialog"; import { Button } from "../ui/button"; -import { MdCategory } from "react-icons/md"; import axios from "axios"; import { toast } from "sonner"; +import { Separator } from "../ui/separator"; type ClassificationSelectionDialogProps = { className?: string; @@ -97,7 +96,7 @@ export default function ClassificationSelectionDialog({ ); return ( -
+
{newClass && ( - setNewClass(true)} - > - - {t("createCategory.new")} - {classes.sort().map((category) => ( onCategorizeImage(category)} > - {category.replaceAll("_", " ")} ))} + + setNewClass(true)} + > + {t("createCategory.new")} +
diff --git a/web/src/components/overlay/dialog/TrainFilterDialog.tsx b/web/src/components/overlay/dialog/TrainFilterDialog.tsx index f4ccf41e1..982523ae9 100644 --- a/web/src/components/overlay/dialog/TrainFilterDialog.tsx +++ b/web/src/components/overlay/dialog/TrainFilterDialog.tsx @@ -60,7 +60,7 @@ export default function TrainFilterDialog({ moreFiltersSelected ? "text-white" : "text-secondary-foreground", )} /> - {isDesktop && t("more")} + {isDesktop && t("filter")} ); const content = ( @@ -122,7 +122,7 @@ export default function TrainFilterDialog({ return ( { e.stopPropagation(); onDelete([image]); @@ -817,22 +817,8 @@ function StateTrainGrid({ image={data.filename} onRefresh={onRefresh} > - + - - - { - e.stopPropagation(); - onDelete([data.filename]); - }} - /> - - - {t("button.deleteClassificationAttempts")} - - ))}