Make record name editable on show page (#9172)

When fields are not displayed in show page, title should be editable



https://github.com/user-attachments/assets/049c2998-6944-46c7-9e9e-f6d29da06c6c
This commit is contained in:
Thomas Trompette
2024-12-26 10:59:17 +01:00
committed by GitHub
parent 29d364fa7b
commit f63b0a235a
6 changed files with 137 additions and 10 deletions

View File

@ -1,3 +1,6 @@
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { RecordEditableName } from '@/object-record/components/RecordEditableName';
import { useRecordShowContainerTabs } from '@/object-record/record-show/hooks/useRecordShowContainerTabs';
import { useRecordShowPage } from '@/object-record/record-show/hooks/useRecordShowPage';
import { useRecordShowPagePagination } from '@/object-record/record-show/hooks/useRecordShowPagePagination';
import { PageHeader } from '@/ui/layout/page/components/PageHeader';
@ -17,13 +20,33 @@ export const RecordShowPageHeader = ({
navigateToPreviousRecord,
navigateToNextRecord,
navigateToIndexView,
objectMetadataItem,
} = useRecordShowPagePagination(objectNameSingular, objectRecordId);
const { headerIcon } = useRecordShowPage(objectNameSingular, objectRecordId);
const { layout } = useRecordShowContainerTabs(
false,
objectNameSingular as CoreObjectNameSingular,
false,
objectMetadataItem,
);
const hasEditableName = layout.hideSummaryAndFields === true;
return (
<PageHeader
title={viewName}
title={
hasEditableName ? (
<RecordEditableName
objectNameSingular={objectNameSingular}
objectRecordId={objectRecordId}
objectLabelPlural={objectMetadataItem.labelPlural}
/>
) : (
viewName
)
}
hasPaginationButtons
hasClosePageButton
onClosePage={navigateToIndexView}