Client: Improved show page titles

This commit is contained in:
Donkie
2023-08-13 10:14:48 +02:00
parent 373067bd09
commit 980284be1d
3 changed files with 25 additions and 6 deletions

View File

@@ -21,13 +21,21 @@ export const FilamentShow: React.FC<IResourceComponentsProps> = () => {
const record = data?.data;
const formatTitle = (item: IFilament) => {
let vendorPrefix = "";
if (item.vendor) {
vendorPrefix = `${item.vendor.name} - `;
}
return `[Filament #${item.id}] ${vendorPrefix}${item.name}`;
};
const formatVendor = (item: IVendor) => {
const URL = `/vendor/show/${item.id}`;
return <a href={URL}>{item.name}</a>;
};
return (
<Show isLoading={isLoading}>
<Show isLoading={isLoading} title={record ? formatTitle(record) : ""}>
<Title level={5}>{t("filament.fields.id")}</Title>
<NumberField value={record?.id ?? ""} />
<Title level={5}>{t("filament.fields.vendor")}</Title>