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:
@ -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}
|
||||
|
||||
Reference in New Issue
Block a user