From 517996d7a8e52222d3b9d8d0031b19ab836d5487 Mon Sep 17 00:00:00 2001 From: Connor Cleveland Date: Wed, 25 Oct 2023 00:32:57 -0500 Subject: [PATCH 1/9] #76 spool list, no reload on page change --- client/public/locales/en/common.json | 501 ++++++++++++++------------- client/src/pages/filaments/show.tsx | 23 +- 2 files changed, 270 insertions(+), 254 deletions(-) diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json index 5ca7d7b..15cb28b 100644 --- a/client/public/locales/en/common.json +++ b/client/public/locales/en/common.json @@ -1,263 +1,264 @@ { - "actions": { - "list": "List", - "create": "Create", - "edit": "Edit", - "show": "Show", - "clone": "Clone" + "actions": { + "list": "List", + "create": "Create", + "edit": "Edit", + "show": "Show", + "clone": "Clone" + }, + "buttons": { + "create": "Create", + "save": "Save", + "logout": "Log out", + "delete": "Delete", + "edit": "Edit", + "cancel": "Cancel", + "confirm": "Are you sure?", + "filter": "Filter", + "clear": "Clear", + "refresh": "Refresh", + "show": "Show", + "undo": "Undo", + "import": "Import", + "clone": "Clone", + "archive": "Archive", + "unArchive": "Unarchive", + "hideArchived": "Hide Archived", + "showArchived": "Show Archived", + "notAccessTitle": "You don't have permission to access", + "hideColumns": "Hide Columns", + "clearFilters": "Clear Filters" + }, + "warnWhenUnsavedChanges": "Are you sure you want to leave? You have unsaved changes.", + "notifications": { + "success": "Successful", + "error": "Error (status code: {{statusCode}})", + "undoable": "You have {{seconds}} seconds to undo.", + "createSuccess": "Successfully created {{resource}}", + "createError": "There was an error creating {{resource}} (status code: {{statusCode}})", + "deleteSuccess": "Successfully deleted {{resource}}", + "deleteError": "Error when deleting {{resource}} (status code: {{statusCode}})", + "editSuccess": "Successfully edited {{resource}}", + "editError": "Error when editing {{resource}} (status code: {{statusCode}})", + "importProgress": "Importing: {{processed}}/{{total}}" + }, + "loading": "Loading", + "version": "Version", + "unknown": "Unknown", + "yes": "Yes", + "no": "No", + "tags": { + "clone": "Clone" + }, + "dashboard": { + "title": "Dashboard" + }, + "printing": { + "generic": { + "title": "Printing", + "description": "Tune in the settings below to get the desired print layout. Keep in mind that printers and your OS may apply it's own margins and scaling, so you may need to perform some trial-and-error before it's all correct. Test it on a piece of regular paper before printing on the actual labels.", + "helpMargin": "Margins should be configured to match your label paper and printer, changing these will affect the size of the entire grid.", + "helpPrinterMargin": "Safe-Zone should be set to how close to the paper edge your printer can print, changing these will not affect the entire grid.", + "print": "Print", + "columns": "Columns", + "rows": "Rows", + "paperSize": "Paper Size", + "customSize": "Custom", + "dimensions": "Dimensions", + "showBorder": "Show Border", + "previewScale": "Preview Scale", + "skipItems": "Skip Items", + "contentSettings": "Content Settings", + "layoutSettings": "Layout Settings", + "horizontalSpacing": "Horizontal Spacing", + "verticalSpacing": "Vertical Spacing", + "marginLeft": "Left Margin", + "marginRight": "Right Margin", + "marginTop": "Top Margin", + "marginBottom": "Bottom Margin", + "printerMarginLeft": "Safe-Zone Left", + "printerMarginRight": "Safe-Zone Right", + "printerMarginTop": "Safe-Zone Top", + "printerMarginBottom": "Safe-Zone Bottom", + "borders": { + "none": "None", + "border": "Border", + "grid": "Grid" + } }, - "buttons": { - "create": "Create", - "save": "Save", - "logout": "Log out", - "delete": "Delete", - "edit": "Edit", - "cancel": "Cancel", - "confirm": "Are you sure?", - "filter": "Filter", - "clear": "Clear", - "refresh": "Refresh", - "show": "Show", - "undo": "Undo", - "import": "Import", - "clone": "Clone", - "archive": "Archive", - "unArchive": "Unarchive", - "hideArchived": "Hide Archived", - "showArchived": "Show Archived", - "notAccessTitle": "You don't have permission to access", - "hideColumns": "Hide Columns", - "clearFilters": "Clear Filters" + "qrcode": { + "button": "Print QR Codes", + "title": "QR Code Printing", + "spoolWeight": "Spool Weight: {{weight}}", + "lotNr": "Lot Nr: {{lot}}", + "bedTemp": "BT: {{temp}}", + "extruderTemp": "ET: {{temp}}", + "textSize": "Content Text Size", + "showSpoolmanIcon": "Show Spoolman Icon", + "showVendor": "Vendor", + "showContent": "Print Label", + "showLotNr": "Lot Nr", + "showSpoolWeight": "Spool Weight", + "showTemperatures": "Temperatures", + "showSpoolComment": "Spool Comment", + "showFilamentComment": "Filament Comment", + "showVendorComment": "Vendor Comment" }, - "warnWhenUnsavedChanges": "Are you sure you want to leave? You have unsaved changes.", - "notifications": { - "success": "Successful", - "error": "Error (status code: {{statusCode}})", - "undoable": "You have {{seconds}} seconds to undo.", - "createSuccess": "Successfully created {{resource}}", - "createError": "There was an error creating {{resource}} (status code: {{statusCode}})", - "deleteSuccess": "Successfully deleted {{resource}}", - "deleteError": "Error when deleting {{resource}} (status code: {{statusCode}})", - "editSuccess": "Successfully edited {{resource}}", - "editError": "Error when editing {{resource}} (status code: {{statusCode}})", - "importProgress": "Importing: {{processed}}/{{total}}" + "spoolSelect": { + "title": "Select Spools", + "description": "Select spools to print QR codes for.", + "showArchived": "Show Archived", + "noSpoolsSelected": "You have not selected any spools.", + "selectAll": "Select/Unselect All", + "selectedTotal_one": "{{count}} spool selected", + "selectedTotal_other": "{{count}} spools selected" + } + }, + "scanner": { + "title": "QR Code Scanner", + "description": "Scan a Spoolman QR code to view details about the spool.", + "error": { + "notAllowed": "You have not allowed access to the camera.", + "insecureContext": "The page is not served over HTTPS.", + "streamApiNotSupported": "The browser does not support the MediaStream API.", + "notReadable": "The camera is not readable.", + "notFound": "No camera was found.", + "unknown": "An unknown error occurred. ({{error}})" + } + }, + "spool": { + "spool": "Spools", + "fields": { + "id": "ID", + "filament_name": "Filament", + "filament": "Filament", + "material": "Material", + "weight_to_use": "Weight", + "used_weight": "Used Weight", + "remaining_weight": "Remaining Weight", + "measured_weight": "Measured Weight", + "used_length": "Used Length", + "remaining_length": "Remaining Length", + "location": "Location", + "lot_nr": "Lot Nr", + "first_used": "First Used", + "last_used": "Last Used", + "registered": "Registered", + "comment": "Comment", + "archived": "Archived" }, - "loading": "Loading", - "version": "Version", - "unknown": "Unknown", - "yes": "Yes", - "no": "No", - "tags": { - "clone": "Clone" + "fields_help": { + "weight_to_use": "Select what weight value to enter. Measured weight is only available if the spool weight is set for the selected filament.", + "used_weight": "How much filament has been used from the spool. A new spool should have 0g used.", + "remaining_weight": "How much filament is left on the spool. For a new spool this should match the spool weight.", + "measured_weight": "How much the filament and spool weigh.", + "location": "Where the spool is located if you have multiple locations where you store your spools.", + "lot_nr": "Manufacturer's lot number. Can be used to ensure a print has consistent color if multiple spools are used." }, - "dashboard": { - "title": "Dashboard" + "titles": { + "create": "Create Spool", + "clone": "Clone Spool", + "edit": "Edit Spool", + "list": "Spools", + "show": "Show Spool", + "show_title": "[Spool #{{id}}] {{name}}", + "archive": "Archive Spool" }, - "printing": { - "generic": { - "title": "Printing", - "description": "Tune in the settings below to get the desired print layout. Keep in mind that printers and your OS may apply it's own margins and scaling, so you may need to perform some trial-and-error before it's all correct. Test it on a piece of regular paper before printing on the actual labels.", - "helpMargin": "Margins should be configured to match your label paper and printer, changing these will affect the size of the entire grid.", - "helpPrinterMargin": "Safe-Zone should be set to how close to the paper edge your printer can print, changing these will not affect the entire grid.", - "print": "Print", - "columns": "Columns", - "rows": "Rows", - "paperSize": "Paper Size", - "customSize": "Custom", - "dimensions": "Dimensions", - "showBorder": "Show Border", - "previewScale": "Preview Scale", - "skipItems": "Skip Items", - "contentSettings": "Content Settings", - "layoutSettings": "Layout Settings", - "horizontalSpacing": "Horizontal Spacing", - "verticalSpacing": "Vertical Spacing", - "marginLeft": "Left Margin", - "marginRight": "Right Margin", - "marginTop": "Top Margin", - "marginBottom": "Bottom Margin", - "printerMarginLeft": "Safe-Zone Left", - "printerMarginRight": "Safe-Zone Right", - "printerMarginTop": "Safe-Zone Top", - "printerMarginBottom": "Safe-Zone Bottom", - "borders": { - "none": "None", - "border": "Border", - "grid": "Grid" - } - }, - "qrcode": { - "button": "Print QR Codes", - "title": "QR Code Printing", - "spoolWeight": "Spool Weight: {{weight}}", - "lotNr": "Lot Nr: {{lot}}", - "bedTemp": "BT: {{temp}}", - "extruderTemp": "ET: {{temp}}", - "textSize": "Content Text Size", - "showSpoolmanIcon": "Show Spoolman Icon", - "showVendor": "Vendor", - "showContent": "Print Label", - "showLotNr": "Lot Nr", - "showSpoolWeight": "Spool Weight", - "showTemperatures": "Temperatures", - "showSpoolComment": "Spool Comment", - "showFilamentComment": "Filament Comment", - "showVendorComment": "Vendor Comment" - }, - "spoolSelect": { - "title": "Select Spools", - "description": "Select spools to print QR codes for.", - "showArchived": "Show Archived", - "noSpoolsSelected": "You have not selected any spools.", - "selectAll": "Select/Unselect All", - "selectedTotal_one": "{{count}} spool selected", - "selectedTotal_other": "{{count}} spools selected" - } + "form": { + "new_location_prompt": "Enter a new location", + "spool_updated": "This spool has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" }, - "scanner": { - "title": "QR Code Scanner", - "description": "Scan a Spoolman QR code to view details about the spool.", - "error": { - "notAllowed": "You have not allowed access to the camera.", - "insecureContext": "The page is not served over HTTPS.", - "streamApiNotSupported": "The browser does not support the MediaStream API.", - "notReadable": "The camera is not readable.", - "notFound": "No camera was found.", - "unknown": "An unknown error occurred. ({{error}})" - } + "messages": { + "archive": "Are you sure you want to archive this spool?" + } + }, + "filament": { + "filament": "Filaments", + "fields": { + "id": "ID", + "vendor_name": "Vendor", + "vendor": "Vendor", + "name": "Name", + "material": "Material", + "price": "Price", + "density": "Density", + "diameter": "Diameter", + "weight": "Weight", + "spool_weight": "Spool Weight", + "article_number": "Article Number", + "registered": "Registered", + "comment": "Comment", + "settings_extruder_temp": "Extruder Temp", + "settings_bed_temp": "Bed Temp", + "color_hex": "Color", + "spools": "Spool List" + }, + "fields_help": { + "name": "Filament name, to distinguish this filament type among others from the same vendor. Should contain the color for example.", + "material": "E.g. PLA, ABS, PETG, etc.", + "price": "Price of a full spool in the system configured currency.", + "weight": "The filament weight of a full spool (net weight). This should not include the weight of the spool itself, only the filament. It is what is usually written on the packaging.", + "spool_weight": "The weight of an empty spool. Used to determine measured weight of a spool.", + "article_number": "E.g. EAN, UPC, etc." + }, + "titles": { + "create": "Create Filament", + "clone": "Clone Filament", + "edit": "Edit Filament", + "list": "Filaments", + "show": "Show Filament", + "show_title": "[Filament #{{id}}] {{name}}" + }, + "form": { + "filament_updated": "This filament has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" + } + }, + "vendor": { + "vendor": "Vendors", + "fields": { + "id": "ID", + "name": "Name", + "registered": "Registered", + "comment": "Comment" + }, + "titles": { + "create": "Create Vendor", + "clone": "Clone Vendor", + "edit": "Edit Vendor", + "list": "Vendors", + "show": "Show Vendor", + "show_title": "[Vendor #{{id}}] {{name}}" + }, + "form": { + "vendor_updated": "This vendor has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" + } + }, + "table": { + "actions": "Actions" + }, + "documentTitle": { + "default": "Spoolman", + "suffix": " | Spoolman", + "filament": { + "list": "Filaments | Spoolman", + "show": "#{{id}} Show Filament | Spoolman", + "edit": "#{{id}} Edit Filament | Spoolman", + "create": "Create Filament | Spoolman", + "clone": "#{{id}} Clone Filament | Spoolman" }, "spool": { - "spool": "Spools", - "fields": { - "id": "ID", - "filament_name": "Filament", - "filament": "Filament", - "material": "Material", - "weight_to_use": "Weight", - "used_weight": "Used Weight", - "remaining_weight": "Remaining Weight", - "measured_weight": "Measured Weight", - "used_length": "Used Length", - "remaining_length": "Remaining Length", - "location": "Location", - "lot_nr": "Lot Nr", - "first_used": "First Used", - "last_used": "Last Used", - "registered": "Registered", - "comment": "Comment", - "archived": "Archived" - }, - "fields_help": { - "weight_to_use": "Select what weight value to enter. Measured weight is only available if the spool weight is set for the selected filament.", - "used_weight": "How much filament has been used from the spool. A new spool should have 0g used.", - "remaining_weight": "How much filament is left on the spool. For a new spool this should match the spool weight.", - "measured_weight": "How much the filament and spool weigh.", - "location": "Where the spool is located if you have multiple locations where you store your spools.", - "lot_nr": "Manufacturer's lot number. Can be used to ensure a print has consistent color if multiple spools are used." - }, - "titles": { - "create": "Create Spool", - "clone": "Clone Spool", - "edit": "Edit Spool", - "list": "Spools", - "show": "Show Spool", - "show_title": "[Spool #{{id}}] {{name}}", - "archive": "Archive Spool" - }, - "form": { - "new_location_prompt": "Enter a new location", - "spool_updated": "This spool has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" - }, - "messages": { - "archive": "Are you sure you want to archive this spool?" - } - }, - "filament": { - "filament": "Filaments", - "fields": { - "id": "ID", - "vendor_name": "Vendor", - "vendor": "Vendor", - "name": "Name", - "material": "Material", - "price": "Price", - "density": "Density", - "diameter": "Diameter", - "weight": "Weight", - "spool_weight": "Spool Weight", - "article_number": "Article Number", - "registered": "Registered", - "comment": "Comment", - "settings_extruder_temp": "Extruder Temp", - "settings_bed_temp": "Bed Temp", - "color_hex": "Color" - }, - "fields_help": { - "name": "Filament name, to distinguish this filament type among others from the same vendor. Should contain the color for example.", - "material": "E.g. PLA, ABS, PETG, etc.", - "price": "Price of a full spool in the system configured currency.", - "weight": "The filament weight of a full spool (net weight). This should not include the weight of the spool itself, only the filament. It is what is usually written on the packaging.", - "spool_weight": "The weight of an empty spool. Used to determine measured weight of a spool.", - "article_number": "E.g. EAN, UPC, etc." - }, - "titles": { - "create": "Create Filament", - "clone": "Clone Filament", - "edit": "Edit Filament", - "list": "Filaments", - "show": "Show Filament", - "show_title": "[Filament #{{id}}] {{name}}" - }, - "form": { - "filament_updated": "This filament has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" - } + "list": "Spools | Spoolman", + "show": "#{{id}} Show Spool | Spoolman", + "edit": "#{{id}} Edit Spool | Spoolman", + "create": "Create Spool | Spoolman", + "clone": "#{{id}} Clone Spool | Spoolman" }, "vendor": { - "vendor": "Vendors", - "fields": { - "id": "ID", - "name": "Name", - "registered": "Registered", - "comment": "Comment" - }, - "titles": { - "create": "Create Vendor", - "clone": "Clone Vendor", - "edit": "Edit Vendor", - "list": "Vendors", - "show": "Show Vendor", - "show_title": "[Vendor #{{id}}] {{name}}" - }, - "form": { - "vendor_updated": "This vendor has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" - } - }, - "table": { - "actions": "Actions" - }, - "documentTitle": { - "default": "Spoolman", - "suffix": " | Spoolman", - "filament": { - "list": "Filaments | Spoolman", - "show": "#{{id}} Show Filament | Spoolman", - "edit": "#{{id}} Edit Filament | Spoolman", - "create": "Create Filament | Spoolman", - "clone": "#{{id}} Clone Filament | Spoolman" - }, - "spool": { - "list": "Spools | Spoolman", - "show": "#{{id}} Show Spool | Spoolman", - "edit": "#{{id}} Edit Spool | Spoolman", - "create": "Create Spool | Spoolman", - "clone": "#{{id}} Clone Spool | Spoolman" - }, - "vendor": { - "list": "Vendors | Spoolman", - "show": "#{{id}} Show Vendor | Spoolman", - "edit": "#{{id}} Edit Vendor | Spoolman", - "create": "Create Vendor | Spoolman", - "clone": "#{{id}} Clone Vendor | Spoolman" - } + "list": "Vendors | Spoolman", + "show": "#{{id}} Show Vendor | Spoolman", + "edit": "#{{id}} Edit Vendor | Spoolman", + "create": "Create Vendor | Spoolman", + "clone": "#{{id}} Clone Vendor | Spoolman" } + } } diff --git a/client/src/pages/filaments/show.tsx b/client/src/pages/filaments/show.tsx index eb21cb7..047fe56 100644 --- a/client/src/pages/filaments/show.tsx +++ b/client/src/pages/filaments/show.tsx @@ -8,14 +8,14 @@ import utc from "dayjs/plugin/utc"; import { IFilament } from "./model"; import { enrichText } from "../../utils/parsing"; import { IVendor } from "../vendors/model"; - +import { useNavigate } from "react-router-dom"; dayjs.extend(utc); const { Title } = Typography; export const FilamentShow: React.FC = () => { const t = useTranslate(); - + const navigate = useNavigate(); const { queryResult } = useShow({ liveMode: "auto", }); @@ -35,13 +35,24 @@ export const FilamentShow: React.FC = () => { const URL = `/vendor/show/${item.id}`; return {item.name}; }; + const gotoVendor = (): undefined => { + const URL = `/vendor/show/${record?.vendor?.id}`; + navigate(URL); + } + + const gotoSpools = (): undefined => { + const URL = `/spool#filters=[{"field":"filament.id","operator":"in","value":[${record?.id}]}]` + navigate(URL); + } return ( {t("filament.fields.id")} {t("filament.fields.vendor")} - + {t("filament.fields.registered")} = () => { {t("filament.fields.comment")} - + {t("filament.fields.spools")} + + ); }; From a08e32078c2941fed644697899ef3b38cfa684fe Mon Sep 17 00:00:00 2001 From: Connor Cleveland Date: Wed, 25 Oct 2023 00:52:44 -0500 Subject: [PATCH 2/9] remove now unused formatVendor --- client/src/pages/filaments/show.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/client/src/pages/filaments/show.tsx b/client/src/pages/filaments/show.tsx index 047fe56..73f29fb 100644 --- a/client/src/pages/filaments/show.tsx +++ b/client/src/pages/filaments/show.tsx @@ -31,10 +31,6 @@ export const FilamentShow: React.FC = () => { return t("filament.titles.show_title", { id: item.id, name: vendorPrefix + item.name }); }; - const formatVendor = (item: IVendor) => { - const URL = `/vendor/show/${item.id}`; - return {item.name}; - }; const gotoVendor = (): undefined => { const URL = `/vendor/show/${record?.vendor?.id}`; navigate(URL); From 82eaaccd9b9c65e862709191d3d82ceff91f7f55 Mon Sep 17 00:00:00 2001 From: Connor Cleveland Date: Thu, 26 Oct 2023 03:53:06 -0500 Subject: [PATCH 3/9] add support for multiple spool adds --- client/public/locales/en/common.json | 1 + client/src/pages/spools/create.tsx | 56 ++++++++++++++++++++++++++-- client/src/utils/overrides.css | 7 ++++ 3 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 client/src/utils/overrides.css diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json index 15cb28b..f24f0e7 100644 --- a/client/public/locales/en/common.json +++ b/client/public/locales/en/common.json @@ -9,6 +9,7 @@ "buttons": { "create": "Create", "save": "Save", + "saveAndAdd": "Save and Add", "logout": "Log out", "delete": "Delete", "edit": "Edit", diff --git a/client/src/pages/spools/create.tsx b/client/src/pages/spools/create.tsx index 79e1690..a4db0e9 100644 --- a/client/src/pages/spools/create.tsx +++ b/client/src/pages/spools/create.tsx @@ -1,13 +1,15 @@ import React, { useState } from "react"; import { IResourceComponentsProps, useTranslate } from "@refinedev/core"; import { Create, useForm, useSelect } from "@refinedev/antd"; -import { Form, Input, DatePicker, Select, InputNumber, Radio, Divider } from "antd"; +import { Form, Input, DatePicker, Select, InputNumber, Radio, Divider, Button } from "antd"; import dayjs from "dayjs"; import TextArea from "antd/es/input/TextArea"; import { IFilament } from "../filaments/model"; import { ISpool } from "./model"; import { numberFormatter, numberParser } from "../../utils/parsing"; import { useSpoolmanLocations } from "../../components/otherModels"; +import { MinusOutlined, PlusOutlined } from "@ant-design/icons"; +import '../../utils/overrides.css' interface CreateOrCloneProps { mode: "create" | "clone"; @@ -16,8 +18,9 @@ interface CreateOrCloneProps { export const SpoolCreate: React.FC = (props) => { const t = useTranslate(); - const { form, formProps, saveButtonProps, formLoading } = useForm(); - + const { form, formProps, formLoading, onFinish, redirect } = useForm({ + redirect: false + }); if (props.mode === "clone" && formProps.initialValues) { // Clear out the values that we don't want to clone formProps.initialValues.first_used = null; @@ -28,6 +31,19 @@ export const SpoolCreate: React.FC { + let values = await form.validateFields(); + if (quantity > 1) { + let submit = Array(quantity).fill(values); + // queue multiple creates this way for now Refine doesn't seem to map Arrays to createMany or multiple creates like it says it does + submit.forEach(async r => await onFinish(r)); + redirect(redirectTo, (values as ISpool).id); + } else { + await onFinish(values); + redirect(redirectTo, (values as ISpool).id); + } + } + const { queryResult } = useSelect({ resource: "filament", }); @@ -100,11 +116,43 @@ export const SpoolCreate: React.FC { + setQuantity(quantity + 1); + } + + const decrementQty = () => { + setQuantity(quantity - 1); + } + return ( ( + <> + + + + } + addonAfter={ + + } + > + + + + + )} >
Date: Thu, 26 Oct 2023 03:56:05 -0500 Subject: [PATCH 4/9] formatting css --- client/src/utils/overrides.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/utils/overrides.css b/client/src/utils/overrides.css index 28c9cd1..f0ee2dc 100644 --- a/client/src/utils/overrides.css +++ b/client/src/utils/overrides.css @@ -4,4 +4,4 @@ .ant-input-number-input { text-align: center !important; -} \ No newline at end of file +} From a61c99b93d9b6f005347dc462b4b008bd0f9814f Mon Sep 17 00:00:00 2001 From: Connor Cleveland Date: Thu, 26 Oct 2023 16:14:24 -0500 Subject: [PATCH 5/9] Add SaveAndAdd footer buttons to keep create consistent --- client/src/pages/filaments/create.tsx | 17 ++++++++++++++--- client/src/pages/vendors/create.tsx | 17 ++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/client/src/pages/filaments/create.tsx b/client/src/pages/filaments/create.tsx index 894c4fc..dac6bb0 100644 --- a/client/src/pages/filaments/create.tsx +++ b/client/src/pages/filaments/create.tsx @@ -1,7 +1,7 @@ import React from "react"; import { IResourceComponentsProps, useTranslate } from "@refinedev/core"; import { Create, useForm, useSelect } from "@refinedev/antd"; -import { Form, Input, Select, InputNumber, ColorPicker } from "antd"; +import { Form, Input, Select, InputNumber, ColorPicker, Button } from "antd"; import TextArea from "antd/es/input/TextArea"; import { numberFormatter, numberParser } from "../../utils/parsing"; import { IVendor } from "../vendors/model"; @@ -14,7 +14,7 @@ interface CreateOrCloneProps { export const FilamentCreate: React.FC = (props) => { const t = useTranslate(); - const { formProps, saveButtonProps, formLoading } = useForm(); + const { form, formProps, saveButtonProps, formLoading, onFinish, redirect } = useForm(); if (props.mode === "clone" && formProps.initialValues) { // Fix the vendor_id @@ -23,6 +23,12 @@ export const FilamentCreate: React.FC { + let values = await form.validateFields(); + await onFinish(values); + redirect(redirectTo, (values as IFilament).id); + } + const { selectProps } = useSelect({ resource: "vendor", optionLabel: "name", @@ -32,7 +38,12 @@ export const FilamentCreate: React.FC ( + <> + + + + )} > = (props) => { const t = useTranslate(); - const { formProps, saveButtonProps, formLoading } = useForm(); + const { form, formProps, saveButtonProps, formLoading, onFinish, redirect } = useForm(); + + const handleSubmit = async (redirectTo: "list" | "edit" | "create") => { + let values = await form.validateFields(); + await onFinish(values); + redirect(redirectTo, (values as IVendor).id); + } return ( ( + <> + + + + )} > Date: Fri, 27 Oct 2023 13:29:55 -0500 Subject: [PATCH 6/9] Change qty button to not need invasive CSS --- client/public/locales/en/common.json | 504 +++++++++++++-------------- client/src/pages/spools/create.tsx | 39 +-- client/src/utils/overrides.css | 8 +- 3 files changed, 273 insertions(+), 278 deletions(-) diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json index f24f0e7..99e2245 100644 --- a/client/public/locales/en/common.json +++ b/client/public/locales/en/common.json @@ -1,265 +1,265 @@ { - "actions": { - "list": "List", - "create": "Create", - "edit": "Edit", - "show": "Show", - "clone": "Clone" - }, - "buttons": { - "create": "Create", - "save": "Save", - "saveAndAdd": "Save and Add", - "logout": "Log out", - "delete": "Delete", - "edit": "Edit", - "cancel": "Cancel", - "confirm": "Are you sure?", - "filter": "Filter", - "clear": "Clear", - "refresh": "Refresh", - "show": "Show", - "undo": "Undo", - "import": "Import", - "clone": "Clone", - "archive": "Archive", - "unArchive": "Unarchive", - "hideArchived": "Hide Archived", - "showArchived": "Show Archived", - "notAccessTitle": "You don't have permission to access", - "hideColumns": "Hide Columns", - "clearFilters": "Clear Filters" - }, - "warnWhenUnsavedChanges": "Are you sure you want to leave? You have unsaved changes.", - "notifications": { - "success": "Successful", - "error": "Error (status code: {{statusCode}})", - "undoable": "You have {{seconds}} seconds to undo.", - "createSuccess": "Successfully created {{resource}}", - "createError": "There was an error creating {{resource}} (status code: {{statusCode}})", - "deleteSuccess": "Successfully deleted {{resource}}", - "deleteError": "Error when deleting {{resource}} (status code: {{statusCode}})", - "editSuccess": "Successfully edited {{resource}}", - "editError": "Error when editing {{resource}} (status code: {{statusCode}})", - "importProgress": "Importing: {{processed}}/{{total}}" - }, - "loading": "Loading", - "version": "Version", - "unknown": "Unknown", - "yes": "Yes", - "no": "No", - "tags": { - "clone": "Clone" - }, - "dashboard": { - "title": "Dashboard" - }, - "printing": { - "generic": { - "title": "Printing", - "description": "Tune in the settings below to get the desired print layout. Keep in mind that printers and your OS may apply it's own margins and scaling, so you may need to perform some trial-and-error before it's all correct. Test it on a piece of regular paper before printing on the actual labels.", - "helpMargin": "Margins should be configured to match your label paper and printer, changing these will affect the size of the entire grid.", - "helpPrinterMargin": "Safe-Zone should be set to how close to the paper edge your printer can print, changing these will not affect the entire grid.", - "print": "Print", - "columns": "Columns", - "rows": "Rows", - "paperSize": "Paper Size", - "customSize": "Custom", - "dimensions": "Dimensions", - "showBorder": "Show Border", - "previewScale": "Preview Scale", - "skipItems": "Skip Items", - "contentSettings": "Content Settings", - "layoutSettings": "Layout Settings", - "horizontalSpacing": "Horizontal Spacing", - "verticalSpacing": "Vertical Spacing", - "marginLeft": "Left Margin", - "marginRight": "Right Margin", - "marginTop": "Top Margin", - "marginBottom": "Bottom Margin", - "printerMarginLeft": "Safe-Zone Left", - "printerMarginRight": "Safe-Zone Right", - "printerMarginTop": "Safe-Zone Top", - "printerMarginBottom": "Safe-Zone Bottom", - "borders": { - "none": "None", - "border": "Border", - "grid": "Grid" - } + "actions": { + "list": "List", + "create": "Create", + "edit": "Edit", + "show": "Show", + "clone": "Clone" }, - "qrcode": { - "button": "Print QR Codes", - "title": "QR Code Printing", - "spoolWeight": "Spool Weight: {{weight}}", - "lotNr": "Lot Nr: {{lot}}", - "bedTemp": "BT: {{temp}}", - "extruderTemp": "ET: {{temp}}", - "textSize": "Content Text Size", - "showSpoolmanIcon": "Show Spoolman Icon", - "showVendor": "Vendor", - "showContent": "Print Label", - "showLotNr": "Lot Nr", - "showSpoolWeight": "Spool Weight", - "showTemperatures": "Temperatures", - "showSpoolComment": "Spool Comment", - "showFilamentComment": "Filament Comment", - "showVendorComment": "Vendor Comment" + "buttons": { + "create": "Create", + "save": "Save", + "saveAndAdd": "Save and Add", + "logout": "Log out", + "delete": "Delete", + "edit": "Edit", + "cancel": "Cancel", + "confirm": "Are you sure?", + "filter": "Filter", + "clear": "Clear", + "refresh": "Refresh", + "show": "Show", + "undo": "Undo", + "import": "Import", + "clone": "Clone", + "archive": "Archive", + "unArchive": "Unarchive", + "hideArchived": "Hide Archived", + "showArchived": "Show Archived", + "notAccessTitle": "You don't have permission to access", + "hideColumns": "Hide Columns", + "clearFilters": "Clear Filters" }, - "spoolSelect": { - "title": "Select Spools", - "description": "Select spools to print QR codes for.", - "showArchived": "Show Archived", - "noSpoolsSelected": "You have not selected any spools.", - "selectAll": "Select/Unselect All", - "selectedTotal_one": "{{count}} spool selected", - "selectedTotal_other": "{{count}} spools selected" - } - }, - "scanner": { - "title": "QR Code Scanner", - "description": "Scan a Spoolman QR code to view details about the spool.", - "error": { - "notAllowed": "You have not allowed access to the camera.", - "insecureContext": "The page is not served over HTTPS.", - "streamApiNotSupported": "The browser does not support the MediaStream API.", - "notReadable": "The camera is not readable.", - "notFound": "No camera was found.", - "unknown": "An unknown error occurred. ({{error}})" - } - }, - "spool": { - "spool": "Spools", - "fields": { - "id": "ID", - "filament_name": "Filament", - "filament": "Filament", - "material": "Material", - "weight_to_use": "Weight", - "used_weight": "Used Weight", - "remaining_weight": "Remaining Weight", - "measured_weight": "Measured Weight", - "used_length": "Used Length", - "remaining_length": "Remaining Length", - "location": "Location", - "lot_nr": "Lot Nr", - "first_used": "First Used", - "last_used": "Last Used", - "registered": "Registered", - "comment": "Comment", - "archived": "Archived" + "warnWhenUnsavedChanges": "Are you sure you want to leave? You have unsaved changes.", + "notifications": { + "success": "Successful", + "error": "Error (status code: {{statusCode}})", + "undoable": "You have {{seconds}} seconds to undo.", + "createSuccess": "Successfully created {{resource}}", + "createError": "There was an error creating {{resource}} (status code: {{statusCode}})", + "deleteSuccess": "Successfully deleted {{resource}}", + "deleteError": "Error when deleting {{resource}} (status code: {{statusCode}})", + "editSuccess": "Successfully edited {{resource}}", + "editError": "Error when editing {{resource}} (status code: {{statusCode}})", + "importProgress": "Importing: {{processed}}/{{total}}" }, - "fields_help": { - "weight_to_use": "Select what weight value to enter. Measured weight is only available if the spool weight is set for the selected filament.", - "used_weight": "How much filament has been used from the spool. A new spool should have 0g used.", - "remaining_weight": "How much filament is left on the spool. For a new spool this should match the spool weight.", - "measured_weight": "How much the filament and spool weigh.", - "location": "Where the spool is located if you have multiple locations where you store your spools.", - "lot_nr": "Manufacturer's lot number. Can be used to ensure a print has consistent color if multiple spools are used." + "loading": "Loading", + "version": "Version", + "unknown": "Unknown", + "yes": "Yes", + "no": "No", + "tags": { + "clone": "Clone" }, - "titles": { - "create": "Create Spool", - "clone": "Clone Spool", - "edit": "Edit Spool", - "list": "Spools", - "show": "Show Spool", - "show_title": "[Spool #{{id}}] {{name}}", - "archive": "Archive Spool" + "dashboard": { + "title": "Dashboard" }, - "form": { - "new_location_prompt": "Enter a new location", - "spool_updated": "This spool has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" + "printing": { + "generic": { + "title": "Printing", + "description": "Tune in the settings below to get the desired print layout. Keep in mind that printers and your OS may apply it's own margins and scaling, so you may need to perform some trial-and-error before it's all correct. Test it on a piece of regular paper before printing on the actual labels.", + "helpMargin": "Margins should be configured to match your label paper and printer, changing these will affect the size of the entire grid.", + "helpPrinterMargin": "Safe-Zone should be set to how close to the paper edge your printer can print, changing these will not affect the entire grid.", + "print": "Print", + "columns": "Columns", + "rows": "Rows", + "paperSize": "Paper Size", + "customSize": "Custom", + "dimensions": "Dimensions", + "showBorder": "Show Border", + "previewScale": "Preview Scale", + "skipItems": "Skip Items", + "contentSettings": "Content Settings", + "layoutSettings": "Layout Settings", + "horizontalSpacing": "Horizontal Spacing", + "verticalSpacing": "Vertical Spacing", + "marginLeft": "Left Margin", + "marginRight": "Right Margin", + "marginTop": "Top Margin", + "marginBottom": "Bottom Margin", + "printerMarginLeft": "Safe-Zone Left", + "printerMarginRight": "Safe-Zone Right", + "printerMarginTop": "Safe-Zone Top", + "printerMarginBottom": "Safe-Zone Bottom", + "borders": { + "none": "None", + "border": "Border", + "grid": "Grid" + } + }, + "qrcode": { + "button": "Print QR Codes", + "title": "QR Code Printing", + "spoolWeight": "Spool Weight: {{weight}}", + "lotNr": "Lot Nr: {{lot}}", + "bedTemp": "BT: {{temp}}", + "extruderTemp": "ET: {{temp}}", + "textSize": "Content Text Size", + "showSpoolmanIcon": "Show Spoolman Icon", + "showVendor": "Vendor", + "showContent": "Print Label", + "showLotNr": "Lot Nr", + "showSpoolWeight": "Spool Weight", + "showTemperatures": "Temperatures", + "showSpoolComment": "Spool Comment", + "showFilamentComment": "Filament Comment", + "showVendorComment": "Vendor Comment" + }, + "spoolSelect": { + "title": "Select Spools", + "description": "Select spools to print QR codes for.", + "showArchived": "Show Archived", + "noSpoolsSelected": "You have not selected any spools.", + "selectAll": "Select/Unselect All", + "selectedTotal_one": "{{count}} spool selected", + "selectedTotal_other": "{{count}} spools selected" + } }, - "messages": { - "archive": "Are you sure you want to archive this spool?" - } - }, - "filament": { - "filament": "Filaments", - "fields": { - "id": "ID", - "vendor_name": "Vendor", - "vendor": "Vendor", - "name": "Name", - "material": "Material", - "price": "Price", - "density": "Density", - "diameter": "Diameter", - "weight": "Weight", - "spool_weight": "Spool Weight", - "article_number": "Article Number", - "registered": "Registered", - "comment": "Comment", - "settings_extruder_temp": "Extruder Temp", - "settings_bed_temp": "Bed Temp", - "color_hex": "Color", - "spools": "Spool List" - }, - "fields_help": { - "name": "Filament name, to distinguish this filament type among others from the same vendor. Should contain the color for example.", - "material": "E.g. PLA, ABS, PETG, etc.", - "price": "Price of a full spool in the system configured currency.", - "weight": "The filament weight of a full spool (net weight). This should not include the weight of the spool itself, only the filament. It is what is usually written on the packaging.", - "spool_weight": "The weight of an empty spool. Used to determine measured weight of a spool.", - "article_number": "E.g. EAN, UPC, etc." - }, - "titles": { - "create": "Create Filament", - "clone": "Clone Filament", - "edit": "Edit Filament", - "list": "Filaments", - "show": "Show Filament", - "show_title": "[Filament #{{id}}] {{name}}" - }, - "form": { - "filament_updated": "This filament has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" - } - }, - "vendor": { - "vendor": "Vendors", - "fields": { - "id": "ID", - "name": "Name", - "registered": "Registered", - "comment": "Comment" - }, - "titles": { - "create": "Create Vendor", - "clone": "Clone Vendor", - "edit": "Edit Vendor", - "list": "Vendors", - "show": "Show Vendor", - "show_title": "[Vendor #{{id}}] {{name}}" - }, - "form": { - "vendor_updated": "This vendor has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" - } - }, - "table": { - "actions": "Actions" - }, - "documentTitle": { - "default": "Spoolman", - "suffix": " | Spoolman", - "filament": { - "list": "Filaments | Spoolman", - "show": "#{{id}} Show Filament | Spoolman", - "edit": "#{{id}} Edit Filament | Spoolman", - "create": "Create Filament | Spoolman", - "clone": "#{{id}} Clone Filament | Spoolman" + "scanner": { + "title": "QR Code Scanner", + "description": "Scan a Spoolman QR code to view details about the spool.", + "error": { + "notAllowed": "You have not allowed access to the camera.", + "insecureContext": "The page is not served over HTTPS.", + "streamApiNotSupported": "The browser does not support the MediaStream API.", + "notReadable": "The camera is not readable.", + "notFound": "No camera was found.", + "unknown": "An unknown error occurred. ({{error}})" + } }, "spool": { - "list": "Spools | Spoolman", - "show": "#{{id}} Show Spool | Spoolman", - "edit": "#{{id}} Edit Spool | Spoolman", - "create": "Create Spool | Spoolman", - "clone": "#{{id}} Clone Spool | Spoolman" + "spool": "Spools", + "fields": { + "id": "ID", + "filament_name": "Filament", + "filament": "Filament", + "material": "Material", + "weight_to_use": "Weight", + "used_weight": "Used Weight", + "remaining_weight": "Remaining Weight", + "measured_weight": "Measured Weight", + "used_length": "Used Length", + "remaining_length": "Remaining Length", + "location": "Location", + "lot_nr": "Lot Nr", + "first_used": "First Used", + "last_used": "Last Used", + "registered": "Registered", + "comment": "Comment", + "archived": "Archived" + }, + "fields_help": { + "weight_to_use": "Select what weight value to enter. Measured weight is only available if the spool weight is set for the selected filament.", + "used_weight": "How much filament has been used from the spool. A new spool should have 0g used.", + "remaining_weight": "How much filament is left on the spool. For a new spool this should match the spool weight.", + "measured_weight": "How much the filament and spool weigh.", + "location": "Where the spool is located if you have multiple locations where you store your spools.", + "lot_nr": "Manufacturer's lot number. Can be used to ensure a print has consistent color if multiple spools are used." + }, + "titles": { + "create": "Create Spool", + "clone": "Clone Spool", + "edit": "Edit Spool", + "list": "Spools", + "show": "Show Spool", + "show_title": "[Spool #{{id}}] {{name}}", + "archive": "Archive Spool" + }, + "form": { + "new_location_prompt": "Enter a new location", + "spool_updated": "This spool has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" + }, + "messages": { + "archive": "Are you sure you want to archive this spool?" + } + }, + "filament": { + "filament": "Filaments", + "fields": { + "id": "ID", + "vendor_name": "Vendor", + "vendor": "Vendor", + "name": "Name", + "material": "Material", + "price": "Price", + "density": "Density", + "diameter": "Diameter", + "weight": "Weight", + "spool_weight": "Spool Weight", + "article_number": "Article Number", + "registered": "Registered", + "comment": "Comment", + "settings_extruder_temp": "Extruder Temp", + "settings_bed_temp": "Bed Temp", + "color_hex": "Color", + "spools": "Show Spools" + }, + "fields_help": { + "name": "Filament name, to distinguish this filament type among others from the same vendor. Should contain the color for example.", + "material": "E.g. PLA, ABS, PETG, etc.", + "price": "Price of a full spool in the system configured currency.", + "weight": "The filament weight of a full spool (net weight). This should not include the weight of the spool itself, only the filament. It is what is usually written on the packaging.", + "spool_weight": "The weight of an empty spool. Used to determine measured weight of a spool.", + "article_number": "E.g. EAN, UPC, etc." + }, + "titles": { + "create": "Create Filament", + "clone": "Clone Filament", + "edit": "Edit Filament", + "list": "Filaments", + "show": "Show Filament", + "show_title": "[Filament #{{id}}] {{name}}" + }, + "form": { + "filament_updated": "This filament has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" + } }, "vendor": { - "list": "Vendors | Spoolman", - "show": "#{{id}} Show Vendor | Spoolman", - "edit": "#{{id}} Edit Vendor | Spoolman", - "create": "Create Vendor | Spoolman", - "clone": "#{{id}} Clone Vendor | Spoolman" + "vendor": "Vendors", + "fields": { + "id": "ID", + "name": "Name", + "registered": "Registered", + "comment": "Comment" + }, + "titles": { + "create": "Create Vendor", + "clone": "Clone Vendor", + "edit": "Edit Vendor", + "list": "Vendors", + "show": "Show Vendor", + "show_title": "[Vendor #{{id}}] {{name}}" + }, + "form": { + "vendor_updated": "This vendor has been updated by someone/something else since you opened this page. Saving will overwrite those changes!" + } + }, + "table": { + "actions": "Actions" + }, + "documentTitle": { + "default": "Spoolman", + "suffix": " | Spoolman", + "filament": { + "list": "Filaments | Spoolman", + "show": "#{{id}} Show Filament | Spoolman", + "edit": "#{{id}} Edit Filament | Spoolman", + "create": "Create Filament | Spoolman", + "clone": "#{{id}} Clone Filament | Spoolman" + }, + "spool": { + "list": "Spools | Spoolman", + "show": "#{{id}} Show Spool | Spoolman", + "edit": "#{{id}} Edit Spool | Spoolman", + "create": "Create Spool | Spoolman", + "clone": "#{{id}} Clone Spool | Spoolman" + }, + "vendor": { + "list": "Vendors | Spoolman", + "show": "#{{id}} Show Vendor | Spoolman", + "edit": "#{{id}} Edit Vendor | Spoolman", + "create": "Create Vendor | Spoolman", + "clone": "#{{id}} Clone Vendor | Spoolman" + } } - } } diff --git a/client/src/pages/spools/create.tsx b/client/src/pages/spools/create.tsx index a4db0e9..6a087ce 100644 --- a/client/src/pages/spools/create.tsx +++ b/client/src/pages/spools/create.tsx @@ -131,28 +131,27 @@ export const SpoolCreate: React.FC ( <> - - - - } - addonAfter={ - - } - > - +
+ + + + +
- )} + ) + } > -
+
); }; diff --git a/client/src/utils/overrides.css b/client/src/utils/overrides.css index f0ee2dc..bd9e39f 100644 --- a/client/src/utils/overrides.css +++ b/client/src/utils/overrides.css @@ -1,7 +1,3 @@ -.ant-input-number-group-addon { - padding: 0 !important; -} - -.ant-input-number-input { +#qty-input { text-align: center !important; -} +} \ No newline at end of file From 5563074c309285c81072b458110ea04d5644bf5e Mon Sep 17 00:00:00 2001 From: Connor Cleveland Date: Fri, 27 Oct 2023 13:34:32 -0500 Subject: [PATCH 7/9] add trailing whitespace --- client/src/utils/overrides.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/utils/overrides.css b/client/src/utils/overrides.css index bd9e39f..8d6ba51 100644 --- a/client/src/utils/overrides.css +++ b/client/src/utils/overrides.css @@ -1,3 +1,3 @@ #qty-input { text-align: center !important; -} \ No newline at end of file +} From 1c361d0e37ccd4b97bb3a6e44b1ae670e7aa50e2 Mon Sep 17 00:00:00 2001 From: Connor Cleveland Date: Sat, 28 Oct 2023 14:46:51 -0500 Subject: [PATCH 8/9] disable default warnWhenUnsavedChanges --- client/src/pages/spools/create.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/pages/spools/create.tsx b/client/src/pages/spools/create.tsx index 6a087ce..c905e28 100644 --- a/client/src/pages/spools/create.tsx +++ b/client/src/pages/spools/create.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import { IResourceComponentsProps, useTranslate } from "@refinedev/core"; import { Create, useForm, useSelect } from "@refinedev/antd"; import { Form, Input, DatePicker, Select, InputNumber, Radio, Divider, Button } from "antd"; @@ -19,8 +19,10 @@ export const SpoolCreate: React.FC({ - redirect: false + redirect: false, + warnWhenUnsavedChanges: false }); + if (props.mode === "clone" && formProps.initialValues) { // Clear out the values that we don't want to clone formProps.initialValues.first_used = null; @@ -37,11 +39,10 @@ export const SpoolCreate: React.FC await onFinish(r)); - redirect(redirectTo, (values as ISpool).id); } else { await onFinish(values); - redirect(redirectTo, (values as ISpool).id); } + redirect(redirectTo, (values as ISpool).id); } const { queryResult } = useSelect({ From 2d1895c360bb579b77a9ca65eeb29d4809747d7c Mon Sep 17 00:00:00 2001 From: Connor Cleveland Date: Sun, 29 Oct 2023 01:27:40 -0500 Subject: [PATCH 9/9] Fix empty filters saving to hash --- client/src/utils/saveload.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/client/src/utils/saveload.ts b/client/src/utils/saveload.ts index 35d2dbe..28184b6 100644 --- a/client/src/utils/saveload.ts +++ b/client/src/utils/saveload.ts @@ -18,18 +18,18 @@ export function useInitialTableState(tableId: string): TableState { const savedSorters = hasHashProperty("sorters") ? getHashProperty("sorters") : isLocalStorageAvailable - ? localStorage.getItem(`${tableId}-sorters`) - : null; + ? localStorage.getItem(`${tableId}-sorters`) + : null; const savedFilters = hasHashProperty("filters") ? getHashProperty("filters") : isLocalStorageAvailable - ? localStorage.getItem(`${tableId}-filters`) - : null; + ? localStorage.getItem(`${tableId}-filters`) + : null; const savedPagination = hasHashProperty("pagination") ? getHashProperty("pagination") : isLocalStorageAvailable - ? localStorage.getItem(`${tableId}-pagination`) - : null; + ? localStorage.getItem(`${tableId}-pagination`) + : null; const savedShowColumns = isLocalStorageAvailable ? localStorage.getItem(`${tableId}-showColumns`) : null; const sorters = savedSorters ? JSON.parse(savedSorters) : [{ field: "id", order: "asc" }]; @@ -59,7 +59,7 @@ export function useStoreInitialState(tableId: string, state: TableState) { if (filters.length > 0) { if (isLocalStorageAvailable) { localStorage.setItem(`${tableId}-filters`, JSON.stringify(filters)); - setURLHash("filters", JSON.stringify(state.filters)); + setURLHash("filters", JSON.stringify(filters)); } } else { localStorage.removeItem(`${tableId}-filters`);