Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4900 multi select field front implement expanded cells #5151

Merged
merged 52 commits into from
May 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
c9566d8
WIP: Use isHovered in fieldDisplay
martmull Apr 23, 2024
ebd95b2
Update design
martmull Apr 23, 2024
8fe7363
Add shrink
martmull Apr 24, 2024
cd3b1cd
Use width to compute hover
martmull Apr 24, 2024
accabe9
Simplify
martmull Apr 24, 2024
466bba9
Merge branch 'main' into 4900-multi-select-field-front-implement-expa…
martmull Apr 24, 2024
63f4e33
Use dropdown for expanded cell
martmull Apr 25, 2024
0b02ba9
Update dropdown component
martmull Apr 25, 2024
07bec4a
Factorize
martmull Apr 26, 2024
5be6608
Fix dropdown for inline cell
martmull Apr 26, 2024
eadb24a
WIP: add default state
martmull Apr 26, 2024
1d48763
Fix soft focus
martmull Apr 26, 2024
cebc4b2
Inject children properties in parent
martmull Apr 26, 2024
4be93e9
Rename state
martmull Apr 26, 2024
9cb05af
Rename component
martmull Apr 26, 2024
fa10ac6
Factorize type
martmull Apr 26, 2024
fc610d4
Factorize Var
martmull Apr 26, 2024
cbdc290
Fix dropdown size
martmull Apr 26, 2024
8a8433c
Display when navigating with keyboard
martmull Apr 26, 2024
55b7519
Fix +number chip width
martmull Apr 26, 2024
784826e
Use expanded list in activities
martmull Apr 26, 2024
2f50fa8
Fix: Use expanded list in activities
martmull Apr 29, 2024
74e8298
Use expanded list in calendar
martmull Apr 29, 2024
0405af5
Fix multiworkspace
martmull Apr 29, 2024
d453ee9
WIP: fix force display hidden count
martmull Apr 29, 2024
60bda4e
Merge branch 'main' into 4900-multi-select-field-front-implement-expa…
martmull Apr 29, 2024
1548766
Simplify
martmull Apr 30, 2024
fd3c37a
Make expandable list component function pure
martmull Apr 30, 2024
62d7733
Merge branch 'main' into 4900-multi-select-field-front-implement-expa…
martmull Apr 30, 2024
2c69203
Move expandable list to proper place
martmull Apr 30, 2024
d09bbb3
Split components in two
martmull Apr 30, 2024
ee17e78
Move to proper place and fix imports
martmull Apr 30, 2024
4f5f3b2
Remove width for chip
martmull Apr 30, 2024
82bf06e
Create dedicated function to compute children properties
martmull May 1, 2024
1b3ae40
Remove useless parameter
martmull May 1, 2024
a00216b
Add tests
martmull May 1, 2024
e1db801
Merge branch 'main' into 4900-multi-select-field-front-implement-expa…
martmull May 2, 2024
38014bf
Code review returns
martmull May 2, 2024
5cceba8
Disallow allowImportingTsExtensions
martmull May 2, 2024
0bdb6a3
Remove useless component
martmull May 2, 2024
50dd265
Remove ANIMATION DIV PROPS constant
martmull May 3, 2024
a84177a
Add story for expandableList
martmull May 3, 2024
409bcc7
Rename variable
martmull May 3, 2024
6046af9
Fix ci
martmull May 3, 2024
a3be163
Fix ci
martmull May 3, 2024
eb27698
Fix console error
martmull May 3, 2024
82732b0
Fix console error
martmull May 3, 2024
cb9a9ff
Fix test
martmull May 3, 2024
0a18062
Remove fix
martmull May 3, 2024
40cf4bf
Update test
martmull May 3, 2024
8bdec12
Merge branch 'main' into 4900-multi-select-field-front-implement-expa…
martmull May 3, 2024
25a117e
Merge branch 'main' into 4900-multi-select-field-front-implement-expa…
martmull May 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename state
  • Loading branch information
martmull committed Apr 26, 2024
commit 4be93e974c41640eb4188bd64d2b298f99fc7232
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Chip, ChipVariant } from 'twenty-ui';

import { AnimationDivProps } from '@/object-record/record-table/record-table-cell/components/RecordTableCellButton.tsx';
import { DropdownMenu } from '@/ui/layout/dropdown/components/DropdownMenu.tsx';

const StyledContainer = styled.div`
align-items: center;
display: flex;
Expand Down Expand Up @@ -57,17 +58,17 @@ export const ExpandableCell = ({
}) => {
const [containerWidth, setContainerWidth] = useState(0);
const [isDropdownMenuOpen, setIsDropdownMenuOpen] = useState(false);
const [childrenContainerWidth, setChildrenContainerWidth] = useState<
Record<number, number>
>({});
const [childrenWidths, setChildrenWidths] = useState<Record<number, number>>(
{},
);

const chipContainerWidth = 52;

const computeChildProperties = (index: number) => {
const availableWidth = containerWidth - chipContainerWidth;
const childWidth = childrenContainerWidth[index];
const childWidth = childrenWidths[index];
const cumulatedChildrenWidth = Array.from(Array(index).keys()).reduce(
(acc, currentIndex) => acc + childrenContainerWidth[currentIndex],
(acc, currentIndex) => acc + childrenWidths[currentIndex],
0,
);
if (!isHovered) {
Expand All @@ -83,7 +84,7 @@ export const ExpandableCell = ({
};

const computeHiddenChildrenNumber = () => {
const childrenContainerWidthValues = Object.values(childrenContainerWidth);
const childrenContainerWidthValues = Object.values(childrenWidths);
let result = 0;
let cumulatedWidth = 0;
childrenContainerWidthValues.forEach((childrenContainerWidthValue) => {
Expand Down Expand Up @@ -125,8 +126,8 @@ export const ExpandableCell = ({
return (
<StyledChildContainer
ref={(el) => {
if (!el || childrenContainerWidth[index] > 0) return;
setChildrenContainerWidth((prevState) => {
if (!el || childrenWidths[index] > 0) return;
setChildrenWidths((prevState) => {
prevState[index] = el.getBoundingClientRect().width;
return prevState;
});
Expand Down