From 9561111b90bf9abe23334bf34a9142a25204f343 Mon Sep 17 00:00:00 2001 From: Donkie Date: Sat, 8 Jul 2023 23:11:50 +0200 Subject: [PATCH] Client: Added a colored spool icon in the lists To indicate the filament color_hex field Resolves #23 --- client/src/icon_spool.svg | 33 +++++++++++++++++++++++++++++ client/src/pages/filaments/list.tsx | 25 +++++++++++++++++++++- client/src/pages/spools/list.tsx | 24 ++++++++++++++++++++- 3 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 client/src/icon_spool.svg diff --git a/client/src/icon_spool.svg b/client/src/icon_spool.svg new file mode 100644 index 0000000..aad88f1 --- /dev/null +++ b/client/src/icon_spool.svg @@ -0,0 +1,33 @@ + + + +Created with Fabric.js 5.3.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/src/pages/filaments/list.tsx b/client/src/pages/filaments/list.tsx index aaf5bc2..b88be17 100644 --- a/client/src/pages/filaments/list.tsx +++ b/client/src/pages/filaments/list.tsx @@ -24,11 +24,12 @@ import { typeFilters, useListFiltersForField, } from "../../utils/filtering"; -import { FilterOutlined } from "@ant-design/icons"; +import Icon, { FilterOutlined } from "@ant-design/icons"; import { useInitialTableState, useStoreInitialState, } from "../../utils/saveload"; +import { ReactComponent as SpoolIcon } from "../../icon_spool.svg"; dayjs.extend(utc); @@ -151,10 +152,32 @@ export const FilamentList: React.FC = () => { { + return ( + <> + {record.color_hex && ( + + )} + {value} + + ); + }} /> = () => { sortOrder={getSortOrderForField(typedSorters, "filament_name")} filters={useListFiltersForField(dataSource, "filament_name")} filteredValue={getFiltersForField(typedFilters, "filament_name")} + render={(value, record: ISpool) => { + return ( + <> + {record.filament.color_hex && ( + + )} + {value} + + ); + }} />