Skip to content

Commit

Permalink
Make bool fields editable again (twentyhq#6551)
Browse files Browse the repository at this point in the history
As title
  • Loading branch information
thomtrp authored Aug 6, 2024
1 parent cd33471 commit 67c4125
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { RelationPickerHotkeyScope } from '@/object-record/relation-picker/types

import { useInlineCell } from '../hooks/useInlineCell';

import { RecordInlineCellContainer } from './RecordInlineCellContainer';
import { useIsFieldReadOnly } from '@/object-record/record-field/hooks/useIsFieldReadOnly';
import { RecordInlineCellContainer } from './RecordInlineCellContainer';

type RecordInlineCellProps = {
readonly?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { useContext } from 'react';

import { FieldInput } from '@/object-record/record-field/components/FieldInput';
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { useIsFieldReadOnly } from '@/object-record/record-field/hooks/useIsFieldReadOnly';
import { FieldInputEvent } from '@/object-record/record-field/types/FieldInputEvent';
import { RecordTableContext } from '@/object-record/record-table/contexts/RecordTableContext';

export const RecordTableCellFieldInput = () => {
const { onUpsertRecord, onMoveFocus, onCloseTableCell } =
useContext(RecordTableContext);
const { entityId, fieldDefinition } = useContext(FieldContext);
const isFieldReadOnly = useIsFieldReadOnly();

const handleEnter: FieldInputEvent = (persistField) => {
onUpsertRecord({
Expand Down Expand Up @@ -87,7 +89,7 @@ export const RecordTableCellFieldInput = () => {
onShiftTab={handleShiftTab}
onSubmit={handleSubmit}
onTab={handleTab}
isReadOnly={true}
isReadOnly={isFieldReadOnly}
/>
);
};

0 comments on commit 67c4125

Please sign in to comment.