Minor fix to ActionsColumn function

No longer uses hooks but instead takes in the title
This commit is contained in:
Donkie
2024-08-07 12:40:54 +02:00
parent 736e59d1eb
commit 8413e33895
4 changed files with 8 additions and 7 deletions

View File

@@ -266,11 +266,12 @@ export function DateColumn<Obj extends Entity>(props: BaseColumnProps<Obj>) {
}); });
} }
export function ActionsColumn<Obj extends Entity>(actionsFn: (record: Obj) => Action[]): ColumnType<Obj> | undefined { export function ActionsColumn<Obj extends Entity>(
const t = useTranslate(); title: string,
actionsFn: (record: Obj) => Action[]
): ColumnType<Obj> | undefined {
return { return {
title: t("table.actions"), title,
responsive: ["lg"], responsive: ["lg"],
render: (_, record) => { render: (_, record) => {
const buttons = actionsFn(record).map((action) => { const buttons = actionsFn(record).map((action) => {

View File

@@ -343,7 +343,7 @@ export const FilamentList: React.FC<IResourceComponentsProps> = () => {
i18ncat: "filament", i18ncat: "filament",
width: 150, width: 150,
}), }),
ActionsColumn(actions), ActionsColumn(t("table.actions"), actions),
])} ])}
/> />
</List> </List>

View File

@@ -465,7 +465,7 @@ export const SpoolList: React.FC<IResourceComponentsProps> = () => {
i18ncat: "spool", i18ncat: "spool",
width: 150, width: 150,
}), }),
ActionsColumn(actions), ActionsColumn(t("table.actions"), actions),
])} ])}
/> />
</List> </List>

View File

@@ -202,7 +202,7 @@ export const VendorList: React.FC<IResourceComponentsProps> = () => {
id: "comment", id: "comment",
i18ncat: "vendor", i18ncat: "vendor",
}), }),
ActionsColumn<IVendor>(actions), ActionsColumn<IVendor>(t("table.actions"), actions),
])} ])}
/> />
</List> </List>