some ts-error-fixes (#6563)
@FelixMalfait Let me know what do you think. Thanks
This commit is contained in:
@ -7,14 +7,14 @@ import { AuthContext } from '@/auth/contexts/AuthContext';
|
|||||||
import { FieldContext } from '../../contexts/FieldContext';
|
import { FieldContext } from '../../contexts/FieldContext';
|
||||||
|
|
||||||
export const useActorFieldDisplay = () => {
|
export const useActorFieldDisplay = () => {
|
||||||
const { entityId, fieldDefinition } = useContext(FieldContext);
|
const { recordId, fieldDefinition } = useContext(FieldContext);
|
||||||
|
|
||||||
const { currentWorkspaceMembers } = useContext(AuthContext);
|
const { currentWorkspaceMembers } = useContext(AuthContext);
|
||||||
|
|
||||||
const fieldName = fieldDefinition.metadata.fieldName;
|
const fieldName = fieldDefinition.metadata.fieldName;
|
||||||
|
|
||||||
const fieldValue = useRecordFieldValue<FieldActorValue | undefined>(
|
const fieldValue = useRecordFieldValue<FieldActorValue | undefined>(
|
||||||
entityId,
|
recordId,
|
||||||
fieldName,
|
fieldName,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ export type RelationFromManyFieldInputProps = {
|
|||||||
export const RelationFromManyFieldInput = ({
|
export const RelationFromManyFieldInput = ({
|
||||||
onSubmit,
|
onSubmit,
|
||||||
}: RelationFromManyFieldInputProps) => {
|
}: RelationFromManyFieldInputProps) => {
|
||||||
const { fieldDefinition, entityId } = useContext(FieldContext);
|
const { fieldDefinition, recordId } = useContext(FieldContext);
|
||||||
const relationPickerScopeId = `relation-picker-${fieldDefinition.fieldMetadataId}`;
|
const relationPickerScopeId = `relation-picker-${fieldDefinition.fieldMetadataId}`;
|
||||||
const { updateRelation } = useUpdateRelationFromManyFieldInput({
|
const { updateRelation } = useUpdateRelationFromManyFieldInput({
|
||||||
scopeId: relationPickerScopeId,
|
scopeId: relationPickerScopeId,
|
||||||
@ -48,7 +48,7 @@ export const RelationFromManyFieldInput = ({
|
|||||||
relationFieldDefinition.metadata.relationObjectMetadataNameSingular,
|
relationFieldDefinition.metadata.relationObjectMetadataNameSingular,
|
||||||
relationObjectMetadataItem,
|
relationObjectMetadataItem,
|
||||||
relationFieldMetadataItem,
|
relationFieldMetadataItem,
|
||||||
entityId,
|
recordId,
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -14,8 +14,8 @@ import { RelationPickerHotkeyScope } from '@/object-record/relation-picker/types
|
|||||||
import { useInlineCell } from '../hooks/useInlineCell';
|
import { useInlineCell } from '../hooks/useInlineCell';
|
||||||
|
|
||||||
import { useIsFieldReadOnly } from '@/object-record/record-field/hooks/useIsFieldReadOnly';
|
import { useIsFieldReadOnly } from '@/object-record/record-field/hooks/useIsFieldReadOnly';
|
||||||
import { RecordInlineCellContainer } from './RecordInlineCellContainer';
|
|
||||||
import { getRecordFieldInputId } from '@/object-record/utils/getRecordFieldInputId';
|
import { getRecordFieldInputId } from '@/object-record/utils/getRecordFieldInputId';
|
||||||
|
import { RecordInlineCellContainer } from './RecordInlineCellContainer';
|
||||||
|
|
||||||
type RecordInlineCellProps = {
|
type RecordInlineCellProps = {
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
@ -98,7 +98,10 @@ export const RecordInlineCell = ({
|
|||||||
isCentered={isCentered}
|
isCentered={isCentered}
|
||||||
editModeContent={
|
editModeContent={
|
||||||
<FieldInput
|
<FieldInput
|
||||||
recordFieldInputdId={getRecordFieldInputId(recordId, fieldDefinition?.metadata?.fieldName)}
|
recordFieldInputdId={getRecordFieldInputId(
|
||||||
|
recordId,
|
||||||
|
fieldDefinition?.metadata?.fieldName,
|
||||||
|
)}
|
||||||
onEnter={handleEnter}
|
onEnter={handleEnter}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
onEscape={handleEscape}
|
onEscape={handleEscape}
|
||||||
|
|||||||
@ -6,9 +6,9 @@ import { AppTooltip, IconComponent, TooltipDelay } from 'twenty-ui';
|
|||||||
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
|
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
|
||||||
import { useFieldFocus } from '@/object-record/record-field/hooks/useFieldFocus';
|
import { useFieldFocus } from '@/object-record/record-field/hooks/useFieldFocus';
|
||||||
import { RecordInlineCellValue } from '@/object-record/record-inline-cell/components/RecordInlineCellValue';
|
import { RecordInlineCellValue } from '@/object-record/record-inline-cell/components/RecordInlineCellValue';
|
||||||
|
import { getRecordFieldInputId } from '@/object-record/utils/getRecordFieldInputId';
|
||||||
import { EllipsisDisplay } from '@/ui/field/display/components/EllipsisDisplay';
|
import { EllipsisDisplay } from '@/ui/field/display/components/EllipsisDisplay';
|
||||||
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
||||||
import { getRecordFieldInputId } from '@/object-record/utils/getRecordFieldInputId';
|
|
||||||
|
|
||||||
const StyledIconContainer = styled.div`
|
const StyledIconContainer = styled.div`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -112,7 +112,10 @@ export const RecordInlineCellContainer = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const labelId = `label-${getRecordFieldInputId(recordId,fieldDefinition?.metadata?.fieldName)}`;
|
const labelId = `label-${getRecordFieldInputId(
|
||||||
|
recordId,
|
||||||
|
fieldDefinition?.metadata?.fieldName,
|
||||||
|
)}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledInlineCellBaseContainer
|
<StyledInlineCellBaseContainer
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
export const getRecordFieldInputId = (recordId: string, fieldName?: string): string => {
|
export const getRecordFieldInputId = (
|
||||||
return `${recordId}-${fieldName}`;
|
recordId: string,
|
||||||
};
|
fieldName?: string,
|
||||||
|
): string => {
|
||||||
|
return `${recordId}-${fieldName}`;
|
||||||
|
};
|
||||||
|
|||||||
@ -18,6 +18,10 @@ export const CustomAddBlockItem = ({
|
|||||||
}: CustomAddBlockItemProps) => {
|
}: CustomAddBlockItemProps) => {
|
||||||
const Components = useComponentsContext();
|
const Components = useComponentsContext();
|
||||||
|
|
||||||
|
if (!Components) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
const blockIdentifier = editor.getTextCursorPosition().block;
|
const blockIdentifier = editor.getTextCursorPosition().block;
|
||||||
const currentBlockContent = blockIdentifier?.content as
|
const currentBlockContent = blockIdentifier?.content as
|
||||||
|
|||||||
Reference in New Issue
Block a user