mirror of
https://github.com/lingble/twenty.git
synced 2025-10-29 20:02:29 +00:00
fix: Minor bug in column scroll in mobile viewport (#7448)
> [!Note] > - This PR fixes #7447 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@@ -38,6 +38,6 @@ export const Default: Story = {
|
|||||||
await canvas.findByText('Tasks');
|
await canvas.findByText('Tasks');
|
||||||
await canvas.findByText('People');
|
await canvas.findByText('People');
|
||||||
await canvas.findByText('Opportunities');
|
await canvas.findByText('Opportunities');
|
||||||
await canvas.findByText('My Customs');
|
await canvas.findByText('Rockets');
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const meta: Meta<typeof EventRowMainObjectUpdated> = {
|
|||||||
},
|
},
|
||||||
} as TimelineActivity,
|
} as TimelineActivity,
|
||||||
mainObjectMetadataItem: generatedMockObjectMetadataItems.find(
|
mainObjectMetadataItem: generatedMockObjectMetadataItems.find(
|
||||||
(item) => item.namePlural === 'person',
|
(item) => item.nameSingular === 'person',
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
decorators: [
|
decorators: [
|
||||||
|
|||||||
@@ -24,15 +24,13 @@ import {
|
|||||||
type RecordInlineCellProps = {
|
type RecordInlineCellProps = {
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
isCentered?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RecordInlineCell = ({
|
export const RecordInlineCell = ({
|
||||||
readonly,
|
readonly,
|
||||||
loading,
|
loading,
|
||||||
isCentered,
|
|
||||||
}: RecordInlineCellProps) => {
|
}: RecordInlineCellProps) => {
|
||||||
const { fieldDefinition, recordId } = useContext(FieldContext);
|
const { fieldDefinition, recordId, isCentered } = useContext(FieldContext);
|
||||||
const buttonIcon = useGetButtonIcon();
|
const buttonIcon = useGetButtonIcon();
|
||||||
|
|
||||||
const isFieldInputOnly = useIsFieldInputOnly();
|
const isFieldInputOnly = useIsFieldInputOnly();
|
||||||
@@ -90,7 +88,7 @@ export const RecordInlineCell = ({
|
|||||||
label: fieldDefinition.label,
|
label: fieldDefinition.label,
|
||||||
labelWidth: fieldDefinition.labelWidth,
|
labelWidth: fieldDefinition.labelWidth,
|
||||||
showLabel: fieldDefinition.showLabel,
|
showLabel: fieldDefinition.showLabel,
|
||||||
isCentered: isCentered,
|
isCentered,
|
||||||
editModeContent: (
|
editModeContent: (
|
||||||
<FieldInput
|
<FieldInput
|
||||||
recordFieldInputdId={getRecordFieldInputId(
|
recordFieldInputdId={getRecordFieldInputId(
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ const StyledValueContainer = styled.div`
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
position: relative;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledLabelContainer = styled.div<{ width?: number }>`
|
const StyledLabelContainer = styled.div<{ width?: number }>`
|
||||||
@@ -79,7 +80,6 @@ export type RecordInlineCellContainerProps = {
|
|||||||
isDisplayModeFixHeight?: boolean;
|
isDisplayModeFixHeight?: boolean;
|
||||||
disableHoverEffect?: boolean;
|
disableHoverEffect?: boolean;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
isCentered?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RecordInlineCellContainer = () => {
|
export const RecordInlineCellContainer = () => {
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
|
import { RecordInlineCellContext } from '@/object-record/record-inline-cell/components/RecordInlineCellContext';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { autoUpdate, flip, offset, useFloating } from '@floating-ui/react';
|
import { autoUpdate, flip, offset, useFloating } from '@floating-ui/react';
|
||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
|
|
||||||
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
|
|
||||||
|
|
||||||
const StyledInlineCellEditModeContainer = styled.div`
|
const StyledInlineCellEditModeContainer = styled.div`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
|
|
||||||
margin-left: -${({ theme }) => theme.spacing(1)};
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledInlineCellInput = styled.div`
|
const StyledInlineCellInput = styled.div`
|
||||||
@@ -34,21 +33,21 @@ type RecordInlineCellEditModeProps = {
|
|||||||
export const RecordInlineCellEditMode = ({
|
export const RecordInlineCellEditMode = ({
|
||||||
children,
|
children,
|
||||||
}: RecordInlineCellEditModeProps) => {
|
}: RecordInlineCellEditModeProps) => {
|
||||||
const { isCentered } = useContext(FieldContext);
|
const { isCentered } = useContext(RecordInlineCellContext);
|
||||||
|
|
||||||
const { refs, floatingStyles } = useFloating({
|
const { refs, floatingStyles } = useFloating({
|
||||||
placement: isCentered ? undefined : 'right-start',
|
placement: isCentered ? 'bottom' : 'bottom-start',
|
||||||
middleware: [
|
middleware: [
|
||||||
flip(),
|
flip(),
|
||||||
offset(
|
offset(
|
||||||
isCentered
|
isCentered
|
||||||
? {
|
? {
|
||||||
mainAxis: -32,
|
mainAxis: -26,
|
||||||
crossAxis: 160,
|
crossAxis: 0,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
|
mainAxis: -28,
|
||||||
crossAxis: -4,
|
crossAxis: -4,
|
||||||
mainAxis: -4,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -202,10 +202,10 @@ export const RecordShowContainer = ({
|
|||||||
},
|
},
|
||||||
useUpdateRecord: useUpdateOneObjectRecordMutation,
|
useUpdateRecord: useUpdateOneObjectRecordMutation,
|
||||||
hotkeyScope: InlineCellHotkeyScope.InlineCell,
|
hotkeyScope: InlineCellHotkeyScope.InlineCell,
|
||||||
isCentered: true,
|
isCentered: !isMobile,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<RecordInlineCell readonly={isReadOnly} isCentered={true} />
|
<RecordInlineCell readonly={isReadOnly} />
|
||||||
</FieldContext.Provider>
|
</FieldContext.Provider>
|
||||||
}
|
}
|
||||||
avatarType={recordIdentifier?.avatarType ?? 'rounded'}
|
avatarType={recordIdentifier?.avatarType ?? 'rounded'}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ const StyledTableHead = styled.thead<{
|
|||||||
clip-path: inset(0px -4px 0px 0px);
|
clip-path: inset(0px -4px 0px 0px);
|
||||||
}
|
}
|
||||||
@media (max-width: ${MOBILE_VIEWPORT}px) {
|
@media (max-width: ${MOBILE_VIEWPORT}px) {
|
||||||
width: 35px;
|
width: 30px;
|
||||||
max-width: 35px;
|
max-width: 35px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user