Skip to content

Commit

Permalink
Remove unused call + rename var
Browse files Browse the repository at this point in the history
  • Loading branch information
thomtrp committed Oct 9, 2024
1 parent 4afafaf commit 402228d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { FieldContext } from '../contexts/FieldContext';
export const useIsFieldReadOnly = () => {
const { fieldDefinition } = useContext(FieldContext);

const metadata = fieldDefinition.metadata;
const { metadata } = fieldDefinition;

return (
fieldDefinition.metadata.fieldName === 'noteTargets' ||
fieldDefinition.metadata.fieldName === 'taskTargets' ||
metadata.fieldName === 'noteTargets' ||
metadata.fieldName === 'taskTargets' ||
isFieldActor(fieldDefinition) ||
isFieldRichText(fieldDefinition) ||
isFieldReadonlyFromObjectMetadataName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const RecordDetailRelationRecordsListItem = ({
[isExpanded],
);

const isReadOnly = !isFieldReadonlyFromObjectMetadataName(
const canEdit = !isFieldReadonlyFromObjectMetadataName(
fieldDefinition.metadata.fieldName,
fieldDefinition.metadata.objectMetadataNameSingular,
);
Expand All @@ -201,7 +201,7 @@ export const RecordDetailRelationRecordsListItem = ({
accent="tertiary"
/>
</StyledClickableZone>
{isReadOnly && (
{canEdit && (
<DropdownScope dropdownScopeId={dropdownScopeId}>
<Dropdown
dropdownId={dropdownScopeId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const RecordDetailRelationSection = ({
recordId,
});

const isReadOnly = !isFieldReadonlyFromObjectMetadataName(
const canEdit = !isFieldReadonlyFromObjectMetadataName(
fieldDefinition.metadata.fieldName,
fieldDefinition.metadata.objectMetadataNameSingular,
);
Expand All @@ -184,7 +184,7 @@ export const RecordDetailRelationSection = ({
hideRightAdornmentOnMouseLeave={!isDropdownOpen && !isMobile}
areRecordsAvailable={relationRecords.length > 0}
rightAdornment={
isReadOnly && (
canEdit && (
<DropdownScope dropdownScopeId={dropdownId}>
<StyledAddDropdown
dropdownId={dropdownId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
import { MenuItem } from '@/ui/navigation/menu-item/components/MenuItem';
import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMemorizedUrlState';

import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { useDestroyManyRecords } from '@/object-record/hooks/useDestroyManyRecords';
import { useRestoreManyRecords } from '@/object-record/hooks/useRestoreManyRecords';
import { recordStoreFamilyState } from '@/object-record/record-store/states/recordStoreFamilyState';
Expand Down Expand Up @@ -42,9 +41,7 @@ export const ShowPageMoreButton = ({
const { restoreManyRecords } = useRestoreManyRecords({
objectNameSingular,
});
const { objectMetadataItem } = useObjectMetadataItem({
objectNameSingular,
});

const handleDelete = () => {
deleteOneRecord(recordId);
closeDropdown();
Expand Down

0 comments on commit 402228d

Please sign in to comment.