add spool count in locations with a setting to enable / disable the display

This commit is contained in:
JakobGue
2025-06-21 19:26:39 +02:00
parent 8af6013331
commit d3181382ae
8 changed files with 50 additions and 2 deletions

View File

@@ -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 (
<div
@@ -169,8 +174,11 @@ export function Location({
setEditTitle(true);
}}
style={titleStyle}
>
>
{displayTitle}
{showSpoolCount && (
<span style={spoolCountStyle}>{" "}({spools.length})</span>
)}
</span>
)}
{showDelete && <Button icon={<DeleteOutlined />} size="small" type="text" onClick={onDelete} />}