From 8413e338957142523e3a6b047b1db6a06df825ec Mon Sep 17 00:00:00 2001 From: Donkie Date: Wed, 7 Aug 2024 12:40:54 +0200 Subject: [PATCH] Minor fix to ActionsColumn function No longer uses hooks but instead takes in the title --- client/src/components/column.tsx | 9 +++++---- client/src/pages/filaments/list.tsx | 2 +- client/src/pages/spools/list.tsx | 2 +- client/src/pages/vendors/list.tsx | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/src/components/column.tsx b/client/src/components/column.tsx index 969da48..32d7f81 100644 --- a/client/src/components/column.tsx +++ b/client/src/components/column.tsx @@ -266,11 +266,12 @@ export function DateColumn(props: BaseColumnProps) { }); } -export function ActionsColumn(actionsFn: (record: Obj) => Action[]): ColumnType | undefined { - const t = useTranslate(); - +export function ActionsColumn( + title: string, + actionsFn: (record: Obj) => Action[] +): ColumnType | undefined { return { - title: t("table.actions"), + title, responsive: ["lg"], render: (_, record) => { const buttons = actionsFn(record).map((action) => { diff --git a/client/src/pages/filaments/list.tsx b/client/src/pages/filaments/list.tsx index f87a586..fa9b60b 100644 --- a/client/src/pages/filaments/list.tsx +++ b/client/src/pages/filaments/list.tsx @@ -343,7 +343,7 @@ export const FilamentList: React.FC = () => { i18ncat: "filament", width: 150, }), - ActionsColumn(actions), + ActionsColumn(t("table.actions"), actions), ])} /> diff --git a/client/src/pages/spools/list.tsx b/client/src/pages/spools/list.tsx index 824624c..9760bb1 100644 --- a/client/src/pages/spools/list.tsx +++ b/client/src/pages/spools/list.tsx @@ -465,7 +465,7 @@ export const SpoolList: React.FC = () => { i18ncat: "spool", width: 150, }), - ActionsColumn(actions), + ActionsColumn(t("table.actions"), actions), ])} /> diff --git a/client/src/pages/vendors/list.tsx b/client/src/pages/vendors/list.tsx index 1755df9..5d49e12 100644 --- a/client/src/pages/vendors/list.tsx +++ b/client/src/pages/vendors/list.tsx @@ -202,7 +202,7 @@ export const VendorList: React.FC = () => { id: "comment", i18ncat: "vendor", }), - ActionsColumn(actions), + ActionsColumn(t("table.actions"), actions), ])} />