remove show spool count option from settings

This commit is contained in:
JakobGue
2026-01-04 00:54:19 +01:00
parent 572a5eea27
commit 185c8b07e0
8 changed files with 66 additions and 106 deletions

View File

@@ -399,10 +399,6 @@
"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í"

View File

@@ -367,10 +367,6 @@
"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": {

View File

@@ -322,10 +322,6 @@
"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": {
@@ -400,4 +396,4 @@
"no_location": "No Location",
"no_locations_help": "This page lets you organize your spools in locations, add some spools to get started!"
}
}
}

View File

@@ -365,10 +365,6 @@
"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."
},
"round_prices": {
"label": "Redondear precios",
"tooltip": "Redondear precios al número entero más cercano."

View File

@@ -365,12 +365,7 @@
"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",

View File

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

View File

@@ -8,7 +8,6 @@ export function GeneralSettings() {
const setBaseUrl = useSetSetting("base_url");
const setCurrency = useSetSetting("currency");
const setRoundPrices = useSetSetting("round_prices");
const setShowSpoolCount = useSetSetting("show_spool_count");
const [form] = Form.useForm();
const [messageApi, contextHolder] = message.useMessage();
const t = useTranslate();
@@ -20,7 +19,6 @@ export function GeneralSettings() {
currency: JSON.parse(settings.data.currency.value),
base_url: JSON.parse(settings.data.base_url.value),
round_prices: JSON.parse(settings.data.round_prices.value),
show_spool_count: JSON.parse(settings.data.show_spool_count.value),
});
}
}, [settings.data, form]);
@@ -33,7 +31,7 @@ export function GeneralSettings() {
}, [setCurrency.isSuccess, messageApi, t]);
// Handle form submit
const onFinish = (values: { currency: string; base_url: string, round_prices: boolean, show_spool_count: boolean }) => {
const onFinish = (values: { currency: string; base_url: string; round_prices: boolean }) => {
// Check if the currency has changed
if (settings.data?.currency.value !== JSON.stringify(values.currency)) {
setCurrency.mutate(values.currency);
@@ -47,85 +45,72 @@ export function GeneralSettings() {
if (settings.data?.round_prices.value !== JSON.stringify(values.round_prices)) {
setRoundPrices.mutate(values.round_prices);
}
// Check if the setting to show spool count has changed
if (settings.data?.show_spool_count.value !== JSON.stringify(values.show_spool_count)) {
setShowSpoolCount.mutate(values.show_spool_count);
}
};
return (<>
<Form
form={form}
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}
initialValues={{
currency: settings.data?.currency.value,
round_prices: settings.data?.round_prices.value,
base_url: settings.data?.base_url.value,
show_spool_count: settings.data?.show_spool_count.value,
}}
onFinish={onFinish}
style={{
maxWidth: "600px",
margin: "0 auto",
}}
>
<Form.Item
label={t("settings.general.currency.label")}
name="currency"
rules={[
{
required: true,
},
{
pattern: /^[A-Z]{3}$/,
},
]}
return (
<>
<Form
form={form}
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}
initialValues={{
currency: settings.data?.currency.value,
round_prices: settings.data?.round_prices.value,
base_url: settings.data?.base_url.value,
}}
onFinish={onFinish}
style={{
maxWidth: "600px",
margin: "0 auto",
}}
>
<Input />
</Form.Item>
<Form.Item
label={t("settings.general.currency.label")}
name="currency"
rules={[
{
required: true,
},
{
pattern: /^[A-Z]{3}$/,
},
]}
>
<Input />
</Form.Item>
<Form.Item
label={t("settings.general.base_url.label")}
tooltip={t("settings.general.base_url.tooltip")}
name="base_url"
rules={[
{
required: false,
},
{
pattern: /^https?:\/\/.+(?<!\/)$/,
},
]}
>
<Input placeholder="https://example.com:8000" />
</Form.Item>
<Form.Item
label={t("settings.general.base_url.label")}
tooltip={t("settings.general.base_url.tooltip")}
name="base_url"
rules={[
{
required: false,
},
{
pattern: /^https?:\/\/.+(?<!\/)$/,
},
]}
>
<Input placeholder="https://example.com:8000" />
</Form.Item>
<Form.Item
label={t("settings.general.round_prices.label")}
tooltip={t("settings.general.round_prices.tooltip")}
name="round_prices"
valuePropName="checked"
>
<Checkbox />
</Form.Item>
<Form.Item
label={t("settings.general.round_prices.label")}
tooltip={t("settings.general.round_prices.tooltip")}
name="round_prices"
valuePropName="checked"
>
<Checkbox />
</Form.Item>
<Form.Item
label={t("settings.general.show_spool_count.label")}
tooltip={t("settings.general.show_spool_count.tooltip")}
name="show_spool_count"
valuePropName="checked"
>
<Checkbox />
</Form.Item>
<Form.Item wrapperCol={{ offset: 8, span: 16 }}>
<Button type="primary" htmlType="submit" loading={settings.isFetching || setCurrency.isLoading}>
{t("buttons.save")}
</Button>
</Form.Item>
</Form>
{contextHolder}
</>);
<Form.Item wrapperCol={{ offset: 8, span: 16 }}>
<Button type="primary" htmlType="submit" loading={settings.isFetching || setCurrency.isLoading}>
{t("buttons.save")}
</Button>
</Form.Item>
</Form>
{contextHolder}
</>
);
}