increase recordCard field hovering zone width + click (recordCard and summaryCard) (#11983)
PR preview https://github.com/user-attachments/assets/7d90f384-6bee-41d7-9aec-cadb434e7db6 closes https://github.com/twentyhq/twenty/issues/10561
This commit is contained in:
@ -1,11 +1,10 @@
|
|||||||
import { ReactNode } from 'react';
|
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
const StyledFieldContainer = styled.div`
|
const StyledFieldContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
width: fit-content;
|
width: 100%;
|
||||||
max-width: 100%;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const StopPropagationContainer = ({
|
export const StopPropagationContainer = ({
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { getRecordFieldInputId } from '@/object-record/utils/getRecordFieldInput
|
|||||||
|
|
||||||
import { assertFieldMetadata } from '@/object-record/record-field/types/guards/assertFieldMetadata';
|
import { assertFieldMetadata } from '@/object-record/record-field/types/guards/assertFieldMetadata';
|
||||||
import { isFieldText } from '@/object-record/record-field/types/guards/isFieldText';
|
import { isFieldText } from '@/object-record/record-field/types/guards/isFieldText';
|
||||||
|
import { useInlineCell } from '@/object-record/record-inline-cell/hooks/useInlineCell';
|
||||||
import {
|
import {
|
||||||
AppTooltip,
|
AppTooltip,
|
||||||
OverflowingTextWithTooltip,
|
OverflowingTextWithTooltip,
|
||||||
@ -86,8 +87,14 @@ export const StyledSkeletonDiv = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export const RecordInlineCellContainer = () => {
|
export const RecordInlineCellContainer = () => {
|
||||||
const { readonly, IconLabel, label, labelWidth, showLabel } =
|
const {
|
||||||
useRecordInlineCellContext();
|
readonly,
|
||||||
|
IconLabel,
|
||||||
|
label,
|
||||||
|
labelWidth,
|
||||||
|
showLabel,
|
||||||
|
editModeContentOnly,
|
||||||
|
} = useRecordInlineCellContext();
|
||||||
|
|
||||||
const { recordId, fieldDefinition } = useContext(FieldContext);
|
const { recordId, fieldDefinition } = useContext(FieldContext);
|
||||||
|
|
||||||
@ -97,6 +104,14 @@ export const RecordInlineCellContainer = () => {
|
|||||||
|
|
||||||
const { setIsFocused } = useFieldFocus();
|
const { setIsFocused } = useFieldFocus();
|
||||||
|
|
||||||
|
const { openInlineCell } = useInlineCell();
|
||||||
|
|
||||||
|
const handleDisplayModeClick = () => {
|
||||||
|
if (!readonly && !editModeContentOnly) {
|
||||||
|
openInlineCell();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleContainerMouseEnter = () => {
|
const handleContainerMouseEnter = () => {
|
||||||
if (!readonly) {
|
if (!readonly) {
|
||||||
setIsFocused(true);
|
setIsFocused(true);
|
||||||
@ -119,6 +134,7 @@ export const RecordInlineCellContainer = () => {
|
|||||||
<StyledInlineCellBaseContainer
|
<StyledInlineCellBaseContainer
|
||||||
onMouseEnter={handleContainerMouseEnter}
|
onMouseEnter={handleContainerMouseEnter}
|
||||||
onMouseLeave={handleContainerMouseLeave}
|
onMouseLeave={handleContainerMouseLeave}
|
||||||
|
onClick={handleDisplayModeClick}
|
||||||
>
|
>
|
||||||
{(IconLabel || label) && (
|
{(IconLabel || label) && (
|
||||||
<StyledLabelAndIconContainer id={labelId}>
|
<StyledLabelAndIconContainer id={labelId}>
|
||||||
|
|||||||
@ -39,13 +39,7 @@ export const RecordInlineCellValue = () => {
|
|||||||
isCentered,
|
isCentered,
|
||||||
} = useRecordInlineCellContext();
|
} = useRecordInlineCellContext();
|
||||||
|
|
||||||
const { isInlineCellInEditMode, openInlineCell } = useInlineCell();
|
const { isInlineCellInEditMode } = useInlineCell();
|
||||||
|
|
||||||
const handleDisplayModeClick = () => {
|
|
||||||
if (!readonly && !editModeContentOnly) {
|
|
||||||
openInlineCell();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading === true) {
|
if (loading === true) {
|
||||||
return <RecordInlineCellSkeletonLoader />;
|
return <RecordInlineCellSkeletonLoader />;
|
||||||
@ -63,11 +57,7 @@ export const RecordInlineCellValue = () => {
|
|||||||
</RecordInlineCellDisplayMode>
|
</RecordInlineCellDisplayMode>
|
||||||
</StyledClickableContainer>
|
</StyledClickableContainer>
|
||||||
) : (
|
) : (
|
||||||
<StyledClickableContainer
|
<StyledClickableContainer readonly={readonly} isCentered={isCentered}>
|
||||||
readonly={readonly}
|
|
||||||
onClick={handleDisplayModeClick}
|
|
||||||
isCentered={isCentered}
|
|
||||||
>
|
|
||||||
<RecordInlineCellDisplayMode>
|
<RecordInlineCellDisplayMode>
|
||||||
{displayModeContent}
|
{displayModeContent}
|
||||||
</RecordInlineCellDisplayMode>
|
</RecordInlineCellDisplayMode>
|
||||||
|
|||||||
Reference in New Issue
Block a user