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,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