refactor: move createState to twenty-ui (#4716)
Split from https://github.com/twentyhq/twenty/pull/4518 Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
import { IconComponent } from '@/ui/display/icon/types/IconComponent';
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
|
||||
export const iconsState = createState<Record<string, IconComponent>>({
|
||||
key: 'iconsState',
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { createState } from 'twenty-ui';
|
||||
import { IconApps } from 'twenty-ui';
|
||||
|
||||
import { IconComponent } from '@/ui/display/icon/types/IconComponent';
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
|
||||
type IconPickerState = {
|
||||
Icon: IconComponent;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const isRightDrawerExpandedState = createState<boolean>({
|
||||
key: 'isRightDrawerExpandedState',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const isRightDrawerOpenState = createState<boolean>({
|
||||
key: 'ui/layout/is-right-drawer-open',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const rightDrawerCloseEventState = createState<Event | null>({
|
||||
key: 'rightDrawerCloseEventState',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
import { RightDrawerPages } from '../types/RightDrawerPages';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
import { ActionBarEntry } from '../types/ActionBarEntry';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const actionBarOpenState = createState<boolean>({
|
||||
key: 'actionBarOpenState',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
import { ContextMenuEntry } from '../types/ContextMenuEntry';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const contextMenuIsOpenState = createState<boolean>({
|
||||
key: 'contextMenuIsOpenState',
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
import { PositionType } from '@/ui/navigation/context-menu/types/PositionType';
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
|
||||
export const contextMenuPositionState = createState<PositionType>({
|
||||
key: 'contextMenuPositionState',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const navigationMemorizedUrlState = createState<string>({
|
||||
key: 'navigationMemorizedUrlState',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export type StepsState = {
|
||||
activeStep: number;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
import { INITIAL_HOTKEYS_SCOPE } from '../../constants/InitialHotkeysScope';
|
||||
import { HotkeyScope } from '../../types/HotkeyScope';
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const internalHotkeysEnabledScopesState = createState<string[]>({
|
||||
key: 'internalHotkeysEnabledScopesState',
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { Keys } from 'react-hotkeys-hook/dist/types';
|
||||
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const pendingHotkeyState = createState<Keys | null>({
|
||||
key: 'pendingHotkeyState',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
import { HotkeyScope } from '../../types/HotkeyScope';
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const currentPageLocationState = createState<string>({
|
||||
key: 'currentPageLocationState',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const lockedListenerIdState = createState<string | null>({
|
||||
key: 'lockedListenerIdState',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const scrollLeftState = createState<number>({
|
||||
key: 'scroll/scrollLeftState',
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { createState } from '@/ui/utilities/state/utils/createState';
|
||||
import { createState } from 'twenty-ui';
|
||||
|
||||
export const scrollTopState = createState<number>({
|
||||
key: 'scroll/scrollTopState',
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
import { atom, AtomEffect } from 'recoil';
|
||||
|
||||
export const createState = <ValueType>({
|
||||
key,
|
||||
defaultValue,
|
||||
effects,
|
||||
}: {
|
||||
key: string;
|
||||
defaultValue: ValueType;
|
||||
effects?: ReadonlyArray<AtomEffect<ValueType>>;
|
||||
}) => {
|
||||
const recoilState = atom<ValueType>({
|
||||
key,
|
||||
default: defaultValue,
|
||||
effects,
|
||||
});
|
||||
return recoilState;
|
||||
};
|
||||
Reference in New Issue
Block a user