Merge pull request #715 from JakobGue/spool_count
Add Spoolcount in Locations Page
This commit is contained in:
@@ -9,6 +9,7 @@ import { ISpool } from "../../spools/model";
|
|||||||
import { DragItem, ItemTypes, SpoolDragItem } from "../dnd";
|
import { DragItem, ItemTypes, SpoolDragItem } from "../dnd";
|
||||||
import { EMPTYLOC } from "../functions";
|
import { EMPTYLOC } from "../functions";
|
||||||
import { SpoolList } from "./spoolList";
|
import { SpoolList } from "./spoolList";
|
||||||
|
import { useGetSetting } from "../../../utils/querySettings";
|
||||||
|
|
||||||
const { useToken } = theme;
|
const { useToken } = theme;
|
||||||
|
|
||||||
@@ -139,6 +140,9 @@ export function Location({
|
|||||||
const titleStyle = {
|
const titleStyle = {
|
||||||
color: canEditTitle ? undefined : token.colorTextTertiary,
|
color: canEditTitle ? undefined : token.colorTextTertiary,
|
||||||
};
|
};
|
||||||
|
const spoolCountStyle = {
|
||||||
|
color: token.colorTextQuaternary,
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -171,6 +175,7 @@ export function Location({
|
|||||||
style={titleStyle}
|
style={titleStyle}
|
||||||
>
|
>
|
||||||
{displayTitle}
|
{displayTitle}
|
||||||
|
{<span style={spoolCountStyle}> ({spools.length})</span>}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{showDelete && <Button icon={<DeleteOutlined />} size="small" type="text" onClick={onDelete} />}
|
{showDelete && <Button icon={<DeleteOutlined />} size="small" type="text" onClick={onDelete} />}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export function GeneralSettings() {
|
|||||||
}, [setCurrency.isSuccess, messageApi, t]);
|
}, [setCurrency.isSuccess, messageApi, t]);
|
||||||
|
|
||||||
// Handle form submit
|
// Handle form submit
|
||||||
const onFinish = (values: { currency: string; base_url: string, round_prices: boolean }) => {
|
const onFinish = (values: { currency: string; base_url: string; round_prices: boolean }) => {
|
||||||
// Check if the currency has changed
|
// Check if the currency has changed
|
||||||
if (settings.data?.currency.value !== JSON.stringify(values.currency)) {
|
if (settings.data?.currency.value !== JSON.stringify(values.currency)) {
|
||||||
setCurrency.mutate(values.currency);
|
setCurrency.mutate(values.currency);
|
||||||
@@ -47,7 +47,8 @@ export function GeneralSettings() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (<>
|
return (
|
||||||
|
<>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
labelCol={{ span: 8 }}
|
labelCol={{ span: 8 }}
|
||||||
@@ -55,6 +56,7 @@ export function GeneralSettings() {
|
|||||||
initialValues={{
|
initialValues={{
|
||||||
currency: settings.data?.currency.value,
|
currency: settings.data?.currency.value,
|
||||||
round_prices: settings.data?.round_prices.value,
|
round_prices: settings.data?.round_prices.value,
|
||||||
|
base_url: settings.data?.base_url.value,
|
||||||
}}
|
}}
|
||||||
onFinish={onFinish}
|
onFinish={onFinish}
|
||||||
style={{
|
style={{
|
||||||
@@ -109,5 +111,6 @@ export function GeneralSettings() {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
{contextHolder}
|
{contextHolder}
|
||||||
</>);
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user