Skip to content

Commit

Permalink
Migrate to twenty-ui - utilities/dimensions (twentyhq#7949)
Browse files Browse the repository at this point in the history
This PR was created by [GitStart](https://gitstart.com/) to address the
requirements from this ticket:
[TWNTY-7539](https://clients.gitstart.com/twenty/5449/tickets/TWNTY-7539).

 --- 

### Description

- Move the utilities/dimensions from twenty-front to twenty-ui and
update imports\

Fixes twentyhq/private-issues#79

---------

Co-authored-by: gitstart-twenty <[email protected]>
Co-authored-by: Charles Bochet <[email protected]>
  • Loading branch information
3 people authored Oct 23, 2024
1 parent 849d7c2 commit dcf92ae
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-front.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
run: npx nx reset:env twenty-front
- name: Run storybook tests
if: steps.changed-files.outputs.any_changed == 'true'
run: npx nx storybook:serve-and-test:static:performance twenty-front
run: npx nx run twenty-front:storybook:serve-and-test:static:performance
front-chromatic-deployment:
if: contains(github.event.pull_request.labels.*.name, 'run-chromatic') || github.event_name == 'push'
needs: front-sb-build
Expand Down
12 changes: 1 addition & 11 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
"storybook:build": {
"executor": "nx:run-commands",
"cache": true,
"dependsOn": ["^build"],
"inputs": ["^default", "excludeTests"],
"outputs": ["{projectRoot}/{options.output-dir}"],
"options": {
Expand Down Expand Up @@ -192,16 +191,7 @@
"executor": "nx:run-commands",
"options": {
"commands": [
"npx concurrently --kill-others --success=first -n SB,TEST 'nx storybook:serve:static {projectName} --port={args.port}' 'npx wait-on tcp:{args.port} && nx storybook:test {projectName} --port={args.port}'"
],
"port": 6006
}
},
"storybook:serve-and-test:static:performance": {
"executor": "nx:run-commands",
"options": {
"commands": [
"npx concurrently --kill-others --success=first -n SB,TEST 'nx storybook:serve:dev {projectName} --configuration=performance --port={args.port}' 'npx wait-on tcp:{args.port} && nx storybook:test:no-coverage {projectName} --port={args.port} --configuration=performance'"
"npx concurrently --kill-others --success=first -n SB,TEST 'nx storybook:serve:static {projectName} --port={args.port} --configuration={args.performance}' 'npx wait-on tcp:{args.port} && nx storybook:test {projectName} --port={args.port} --configuration={args.scope}'"
],
"port": 6006
}
Expand Down
6 changes: 5 additions & 1 deletion packages/twenty-front/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ const config: StorybookConfig = {
const { mergeConfig } = await import('vite');

return mergeConfig(config, {
// Add dependencies to pre-optimization
resolve: {
alias: {
'react-dom/client': 'react-dom/profiling',
},
},
});
},
};
Expand Down
26 changes: 13 additions & 13 deletions packages/twenty-front/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@
"storybook:build": {
"options": {
"env": { "NODE_OPTIONS": "--max_old_space_size=6500" }
},
"configurations": {
"docs": { "env": { "STORYBOOK_SCOPE": "ui-docs" } },
"modules": { "env": { "STORYBOOK_SCOPE": "modules" } },
"pages": { "env": { "STORYBOOK_SCOPE": "pages" } },
"performance": { "env": { "STORYBOOK_SCOPE": "performance" } }
}
},
"storybook:serve:dev": {
Expand All @@ -82,7 +88,13 @@
}
},
"storybook:serve:static": {
"options": { "port": 6006 }
"options": { "port": 6006 },
"configurations": {
"docs": { "env": { "STORYBOOK_SCOPE": "ui-docs" } },
"modules": { "env": { "STORYBOOK_SCOPE": "modules" } },
"pages": { "env": { "STORYBOOK_SCOPE": "pages" } },
"performance": { "env": { "STORYBOOK_SCOPE": "performance" } }
}
},
"storybook:coverage": {
"configurations": {
Expand All @@ -104,9 +116,6 @@
},
"storybook:serve-and-test:static": {
"options": {
"commands": [
"npx concurrently --kill-others --success=first -n SB,TEST 'nx storybook:serve:static {projectName} --port={args.port}' 'npx wait-on tcp:{args.port} && nx storybook:test {projectName} --port={args.port} --configuration={args.scope}'"
],
"port": 6006
},
"configurations": {
Expand All @@ -116,15 +125,6 @@
"performance": { "scope": "performance" }
}
},
"storybook:serve-and-test:static:performance": {},
"storybook:test:no-coverage": {
"configurations": {
"docs": { "env": { "STORYBOOK_SCOPE": "ui-docs" } },
"modules": { "env": { "STORYBOOK_SCOPE": "modules" } },
"pages": { "env": { "STORYBOOK_SCOPE": "pages" } },
"performance": { "env": { "STORYBOOK_SCOPE": "performance" } }
}
},
"graphql:generate": {
"executor": "nx:run-commands",
"defaultConfiguration": "data",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ChangeEvent } from 'react';
import styled from '@emotion/styled';
import { ChangeEvent } from 'react';

import { StyledTextInput as UIStyledTextInput } from '@/ui/field/input/components/TextInput';
import { ComputeNodeDimensions } from '@/ui/utilities/dimensions/components/ComputeNodeDimensions';
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';

import { ComputeNodeDimensions } from 'twenty-ui';
import { InputHotkeyScope } from '../types/InputHotkeyScope';

export type EntityTitleDoubleTextInputProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import styled from '@emotion/styled';
import { useMemo } from 'react';
import { useRecoilState } from 'recoil';

import { PROFILING_REPORTER_DIV_ID } from '~/testing/profiling/constants/ProfilingReporterDivId';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ReactNode, useLayoutEffect, useRef, useState } from 'react';
import styled from '@emotion/styled';

import { isDefined } from '~/utils/isDefined';
import { isDefined } from '@ui/utilities';
import { ReactNode, useLayoutEffect, useRef, useState } from 'react';

type ComputeNodeDimensionsProps = {
children: (
Expand Down
3 changes: 2 additions & 1 deletion packages/twenty-ui/src/utilities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ export * from './animation/components/AnimatedFadeOut';
export * from './animation/components/AnimatedTextWord';
export * from './animation/components/AnimatedTranslation';
export * from './color/utils/stringToHslColor';
export * from './getDisplayValueByUrlType';
export * from './dimensions/components/ComputeNodeDimensions';
export * from './image/getImageAbsoluteURI';
export * from './isDefined';
export * from './screen-size/hooks/useScreenSize';
export * from './state/utils/createState';
export * from './types/Nullable';
export * from './utils/getDisplayValueByUrlType';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LinkType } from '@ui/navigation/link';
import { isDefined } from './isDefined';
import { isDefined } from '../isDefined';

type getUrlDisplayValueByUrlTypeProps = {
type: LinkType;
Expand Down

0 comments on commit dcf92ae

Please sign in to comment.