From d3181382ae847aae765af8afcdbe8f26b7d2e08e Mon Sep 17 00:00:00 2001 From: JakobGue Date: Sat, 21 Jun 2025 19:26:39 +0200 Subject: [PATCH] add spool count in locations with a setting to enable / disable the display --- client/public/locales/cs/common.json | 4 ++++ client/public/locales/de/common.json | 4 ++++ client/public/locales/en/common.json | 4 ++++ client/public/locales/es/common.json | 4 ++++ client/public/locales/nl/common.json | 5 +++++ .../pages/locations/components/location.tsx | 10 +++++++++- client/src/pages/settings/generalSettings.tsx | 20 ++++++++++++++++++- spoolman/settings.py | 1 + 8 files changed, 50 insertions(+), 2 deletions(-) diff --git a/client/public/locales/cs/common.json b/client/public/locales/cs/common.json index 88e6117..cf0e829 100644 --- a/client/public/locales/cs/common.json +++ b/client/public/locales/cs/common.json @@ -399,6 +399,10 @@ "round_prices": { "label": "Zaokrouhlené ceny", "tooltip": "Zaokrouhlete ceny na nejbližší celé číslo." + }, + "show_spool_count": { + "label": "Zobrazit počet cívek", + "tooltip": "Zobrazit počet cívek pro každé umístění." } }, "settings": "Nastavení" diff --git a/client/public/locales/de/common.json b/client/public/locales/de/common.json index cefea02..d032d3a 100644 --- a/client/public/locales/de/common.json +++ b/client/public/locales/de/common.json @@ -365,6 +365,10 @@ "round_prices": { "label": "Gerundeter Preis", "tooltip": "Rundet die Preise auf die nächsthöhere ganze Zahl." + }, + "show_spool_count": { + "label": "Spulenanzahl anzeigen", + "tooltip": "Zeigt die Anzahl der Spulen am jeweiligen Ort an." } }, "extra_fields": { diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json index e7eb1b6..b308bf4 100644 --- a/client/public/locales/en/common.json +++ b/client/public/locales/en/common.json @@ -322,6 +322,10 @@ "round_prices": { "label": "Round prices", "tooltip": "Round prices to the nearest whole number." + }, + "show_spool_count": { + "label": "Show Spool Count", + "tooltip": "Show the number of spools for each location." } }, "extra_fields": { diff --git a/client/public/locales/es/common.json b/client/public/locales/es/common.json index d21f3cb..b2f69a9 100644 --- a/client/public/locales/es/common.json +++ b/client/public/locales/es/common.json @@ -362,6 +362,10 @@ "base_url": { "label": "URL base", "tooltip": "La URL base que se utilizará al generar funciones como códigos QR." + }, + "show_spool_count": { + "label": "Mostrar cantidad de bobinas", + "tooltip": "Mostrar el número de bobinas para cada ubicación." } }, "extra_fields": { diff --git a/client/public/locales/nl/common.json b/client/public/locales/nl/common.json index caac356..20be315 100644 --- a/client/public/locales/nl/common.json +++ b/client/public/locales/nl/common.json @@ -365,7 +365,12 @@ "round_prices": { "label": "Afgeronde prijzen", "tooltip": "Rond prijzen af op het dichtstbijzijnde gehele getal." + }, + "show_spool_count": { + "label": "Spoelaantal weergeven", + "tooltip": "Toon het aantal spoelen per locatie." } + }, "extra_fields": { "tab": "Extra velden", diff --git a/client/src/pages/locations/components/location.tsx b/client/src/pages/locations/components/location.tsx index a8b04ba..73248bd 100644 --- a/client/src/pages/locations/components/location.tsx +++ b/client/src/pages/locations/components/location.tsx @@ -9,6 +9,7 @@ import { ISpool } from "../../spools/model"; import { DragItem, ItemTypes, SpoolDragItem } from "../dnd"; import { EMPTYLOC } from "../functions"; import { SpoolList } from "./spoolList"; +import { useGetSetting } from "../../../utils/querySettings"; const { useToken } = theme; @@ -139,6 +140,10 @@ export function Location({ const titleStyle = { color: canEditTitle ? undefined : token.colorTextTertiary, }; + const showSpoolCount = JSON.parse(useGetSetting("show_spool_count").data?.value ?? "false"); + const spoolCountStyle = { + color: token.colorTextQuaternary, + }; return (
+ > {displayTitle} + {showSpoolCount && ( + {" "}({spools.length}) + )} )} {showDelete &&