[CHORE] Avoid isDefined duplicated reference, move it to twenty-shared (#9967)
# Introduction Avoid having multiple `isDefined` definition across our pacakges Also avoid importing `isDefined` from `twenty-ui` which exposes a huge barrel for a such little util function ## In a nutshell Removed own `isDefined.ts` definition from `twenty-ui` `twenty-front` and `twenty-server` to move it to `twenty-shared`. Updated imports for each packages, and added explicit dependencies to `twenty-shared` if not already in place Related PR https://github.com/twentyhq/twenty/pull/9941
This commit is contained in:
@ -4,8 +4,8 @@ import { useCallback } from 'react';
|
||||
import { Key } from 'ts-key-enum';
|
||||
|
||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { Button } from 'twenty-ui';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { DialogHotkeyScope } from '../types/DialogHotkeyScope';
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ import {
|
||||
useProgressAnimation,
|
||||
} from 'twenty-ui';
|
||||
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export enum SnackBarVariant {
|
||||
Default = 'default',
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { useCallback } from 'react';
|
||||
import { useRecoilCallback } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { SnackBarManagerScopeInternalContext } from '@/ui/feedback/snack-bar-manager/scopes/scope-internal-context/SnackBarManagerScopeInternalContext';
|
||||
import {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { styled } from '@linaria/react';
|
||||
import { IconCheck, IconX, THEME_COMMON } from 'twenty-ui';
|
||||
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
const spacing = THEME_COMMON.spacingMultiplicator * 1;
|
||||
const iconSizeSm = THEME_COMMON.icon.size.sm;
|
||||
|
||||
@ -3,8 +3,8 @@ import { styled } from '@linaria/react';
|
||||
|
||||
import { FieldCurrencyValue } from '@/object-record/record-field/types/FieldMetadata';
|
||||
import { SETTINGS_FIELD_CURRENCY_CODES } from '@/settings/data-model/constants/SettingsFieldCurrencyCodes';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { formatAmount } from '~/utils/format/formatAmount';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
|
||||
type CurrencyDisplayProps = {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { MouseEvent } from 'react';
|
||||
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
import { ContactLink } from 'twenty-ui';
|
||||
import { EllipsisDisplay } from './EllipsisDisplay';
|
||||
|
||||
@ -4,7 +4,7 @@ import { RoundedLink, THEME_COMMON } from 'twenty-ui';
|
||||
import { FieldEmailsValue } from '@/object-record/record-field/types/FieldMetadata';
|
||||
import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList';
|
||||
import styled from '@emotion/styled';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
type EmailsDisplayProps = {
|
||||
value?: FieldEmailsValue;
|
||||
|
||||
@ -3,8 +3,8 @@ import { LinkType, RoundedLink, SocialLink } from 'twenty-ui';
|
||||
|
||||
import { FieldLinksValue } from '@/object-record/record-field/types/FieldMetadata';
|
||||
import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { checkUrlType } from '~/utils/checkUrlType';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { getAbsoluteUrl } from '~/utils/url/getAbsoluteUrl';
|
||||
import { getUrlHostName } from '~/utils/url/getUrlHostName';
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { parsePhoneNumber, PhoneNumber } from 'libphonenumber-js';
|
||||
import { MouseEvent } from 'react';
|
||||
import { ContactLink } from 'twenty-ui';
|
||||
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
interface PhoneDisplayProps {
|
||||
value: PhoneDisplayValueProps;
|
||||
|
||||
@ -7,7 +7,7 @@ import { ExpandableList } from '@/ui/layout/expandable-list/components/Expandabl
|
||||
|
||||
import { DEFAULT_PHONE_CALLING_CODE } from '@/object-record/record-field/meta-types/input/components/PhonesFieldInput';
|
||||
import { parsePhoneNumber } from 'libphonenumber-js';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { logError } from '~/utils/logError';
|
||||
|
||||
type PhonesDisplayProps = {
|
||||
|
||||
@ -12,7 +12,8 @@ import { activeDropdownFocusIdState } from '@/ui/layout/dropdown/states/activeDr
|
||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined, MOBILE_VIEWPORT } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { MOBILE_VIEWPORT } from 'twenty-ui';
|
||||
|
||||
const StyledAddressContainer = styled.div`
|
||||
padding: 4px 8px;
|
||||
|
||||
@ -10,7 +10,7 @@ import { Key } from 'ts-key-enum';
|
||||
|
||||
import { FieldDoubleText } from '@/object-record/record-field/types/FieldDoubleText';
|
||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
import { FieldInputContainer } from '@/ui/field/input/components/FieldInputContainer';
|
||||
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
|
||||
|
||||
@ -14,8 +14,8 @@ import { useSelectableListStates } from '@/ui/layout/selectable-list/hooks/inter
|
||||
import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList';
|
||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { MenuItemMultiSelectTag } from 'twenty-ui';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
|
||||
|
||||
type MultiSelectInputProps = {
|
||||
|
||||
@ -5,7 +5,7 @@ import { TEXT_INPUT_STYLE } from 'twenty-ui';
|
||||
|
||||
import { LightCopyIconButton } from '@/object-record/record-field/components/LightCopyIconButton';
|
||||
import { useRegisterInputEvents } from '@/object-record/record-field/meta-types/input/hooks/useRegisterInputEvents';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { turnIntoEmptyStringIfWhitespacesOnly } from '~/utils/string/turnIntoEmptyStringIfWhitespacesOnly';
|
||||
|
||||
export type TextAreaInputProps = {
|
||||
|
||||
@ -4,10 +4,9 @@ import { Trans, useLingui } from '@lingui/react/macro';
|
||||
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import React from 'react';
|
||||
import { getImageAbsoluteURI } from 'twenty-shared';
|
||||
import { getImageAbsoluteURI, isDefined } from 'twenty-shared';
|
||||
import { Button, IconPhotoUp, IconTrash, IconUpload, IconX } from 'twenty-ui';
|
||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
display: flex;
|
||||
|
||||
@ -9,7 +9,7 @@ import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownM
|
||||
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
|
||||
|
||||
import { SelectControl } from '@/ui/input/components/SelectControl';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { SelectHotkeyScope } from '../types/SelectHotkeyScope';
|
||||
|
||||
export type SelectOption<Value extends string | number | boolean | null> = {
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
import { SelectOption, SelectSizeVariant } from '@/ui/input/components/Select';
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import {
|
||||
IconChevronDown,
|
||||
isDefined,
|
||||
OverflowingTextWithTooltip,
|
||||
} from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { IconChevronDown, OverflowingTextWithTooltip } from 'twenty-ui';
|
||||
|
||||
const StyledControlContainer = styled.div<{
|
||||
disabled?: boolean;
|
||||
|
||||
@ -8,7 +8,8 @@ import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||
import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Key } from 'ts-key-enum';
|
||||
import { MenuItemSelectTag, TagColor, isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { MenuItemSelectTag, TagColor } from 'twenty-ui';
|
||||
|
||||
interface SelectInputProps {
|
||||
onOptionSelected: (selectedOption: SelectOption) => void;
|
||||
|
||||
@ -8,7 +8,7 @@ import {
|
||||
import { InputHotkeyScope } from '@/ui/input/types/InputHotkeyScope';
|
||||
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export type TextInputProps = TextInputV2ComponentProps & {
|
||||
disableHotkeys?: boolean;
|
||||
|
||||
@ -12,7 +12,7 @@ import { MIN_DATE } from '@/ui/input/components/internal/date/constants/MinDate'
|
||||
import { parseDateToString } from '@/ui/input/components/internal/date/utils/parseDateToString';
|
||||
import { parseStringToDate } from '@/ui/input/components/internal/date/utils/parseStringToDate';
|
||||
import { isNull } from '@sniptt/guards';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
const StyledInputContainer = styled.div`
|
||||
align-items: center;
|
||||
|
||||
@ -8,7 +8,7 @@ import {
|
||||
} from 'twenty-ui';
|
||||
|
||||
import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
import { AbsoluteDatePickerHeader } from '@/ui/input/components/internal/date/components/AbsoluteDatePickerHeader';
|
||||
import { DateTimeInput } from '@/ui/input/components/internal/date/components/DateTimeInput';
|
||||
|
||||
@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react';
|
||||
import { expect, userEvent, within } from '@storybook/test';
|
||||
import { ComponentDecorator } from 'twenty-ui';
|
||||
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { DateTimePicker } from '../InternalDatePicker';
|
||||
|
||||
const meta: Meta<typeof DateTimePicker> = {
|
||||
|
||||
@ -5,8 +5,8 @@ import { useDropdown } from '@/ui/layout/dropdown/hooks/useDropdown';
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { IconChevronDown, IconWorld } from 'twenty-ui';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
import { CountryPickerHotkeyScope } from '../types/CountryPickerHotkeyScope';
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export const useInputFocusWithoutScrollOnMount = () => {
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
@ -4,7 +4,7 @@ import { bottomBarHotkeyComponentState } from '@/ui/layout/bottom-bar/states/bot
|
||||
import { isBottomBarOpenedComponentState } from '@/ui/layout/bottom-bar/states/isBottomBarOpenedComponentState';
|
||||
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
||||
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export const useBottomBar = () => {
|
||||
const {
|
||||
|
||||
@ -20,7 +20,7 @@ import { MouseEvent, ReactNode } from 'react';
|
||||
import { flushSync } from 'react-dom';
|
||||
import { Keys } from 'react-hotkeys-hook';
|
||||
import { useRecoilCallback } from 'recoil';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { sleep } from '~/utils/sleep';
|
||||
import { useDropdown } from '../hooks/useDropdown';
|
||||
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { ComponentProps, MouseEvent } from 'react';
|
||||
import { IconComponent, isDefined, LightIconButton } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { IconComponent, LightIconButton } from 'twenty-ui';
|
||||
|
||||
const StyledHeader = styled.li`
|
||||
align-items: center;
|
||||
|
||||
@ -8,7 +8,7 @@ import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousH
|
||||
import { getScopeIdOrUndefinedFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdOrUndefinedFromComponentId';
|
||||
import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
|
||||
import { useCallback } from 'react';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export const useDropdown = (dropdownId?: string) => {
|
||||
const {
|
||||
|
||||
@ -5,7 +5,7 @@ import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDrop
|
||||
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
|
||||
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
||||
import { getScopeIdFromComponentId } from '@/ui/utilities/recoil-scope/utils/getScopeIdFromComponentId';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export const useDropdownV2 = () => {
|
||||
const {
|
||||
|
||||
@ -4,7 +4,7 @@ import { AnimatedContainer, Chip, ChipVariant } from 'twenty-ui';
|
||||
|
||||
import { ExpandedListDropdown } from '@/ui/layout/expandable-list/components/ExpandedListDropdown';
|
||||
import { isFirstOverflowingChildElement } from '@/ui/layout/expandable-list/utils/isFirstOverflowingChildElement';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
align-items: center;
|
||||
|
||||
@ -2,14 +2,10 @@ import styled from '@emotion/styled';
|
||||
import { expect } from '@storybook/jest';
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
import { userEvent, within } from '@storybook/test';
|
||||
import {
|
||||
ComponentDecorator,
|
||||
isDefined,
|
||||
MAIN_COLOR_NAMES,
|
||||
Tag,
|
||||
} from 'twenty-ui';
|
||||
|
||||
import { ExpandableList } from '@/ui/layout/expandable-list/components/ExpandableList';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { ComponentDecorator, MAIN_COLOR_NAMES, Tag } from 'twenty-ui';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
padding: ${({ theme }) => theme.spacing(1)};
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export const isFirstOverflowingChildElement = ({
|
||||
containerElement,
|
||||
|
||||
@ -6,9 +6,9 @@ import { useOnboardingStatus } from '@/onboarding/hooks/useOnboardingStatus';
|
||||
import { AppPath } from '@/types/AppPath';
|
||||
import { isDefaultLayoutAuthModalVisibleState } from '@/ui/layout/states/isDefaultLayoutAuthModalVisibleState';
|
||||
import { useSubscriptionStatus } from '@/workspace/hooks/useSubscriptionStatus';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { OnboardingStatus, SubscriptionStatus } from '~/generated/graphql';
|
||||
import { useIsMatchingLocation } from '~/hooks/useIsMatchingLocation';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
export const useShowAuthModal = () => {
|
||||
const isMatchingLocation = useIsMatchingLocation();
|
||||
|
||||
@ -6,7 +6,7 @@ import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { motion } from 'framer-motion';
|
||||
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
import { isRightDrawerOpenState } from '../states/isRightDrawerOpenState';
|
||||
import { rightDrawerPageState } from '../states/rightDrawerPageState';
|
||||
|
||||
@ -14,7 +14,7 @@ import { RightDrawerWorkflowEditStep } from '@/workflow/workflow-steps/component
|
||||
import { RightDrawerWorkflowViewStep } from '@/workflow/workflow-steps/components/RightDrawerWorkflowViewStep';
|
||||
import { RightDrawerWorkflowSelectAction } from '@/workflow/workflow-steps/workflow-actions/components/RightDrawerWorkflowSelectAction';
|
||||
import { RightDrawerWorkflowSelectTriggerType } from '@/workflow/workflow-trigger/components/RightDrawerWorkflowSelectTriggerType';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { rightDrawerPageState } from '../states/rightDrawerPageState';
|
||||
import { RightDrawerPages } from '../types/RightDrawerPages';
|
||||
|
||||
|
||||
@ -3,8 +3,8 @@ import { ReactNode, useEffect } from 'react';
|
||||
import { useSelectableListHotKeys } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListHotKeys';
|
||||
import { useSelectableList } from '@/ui/layout/selectable-list/hooks/useSelectableList';
|
||||
import { SelectableListScope } from '@/ui/layout/selectable-list/scopes/SelectableListScope';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { arrayToChunks } from '~/utils/array/arrayToChunks';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
type SelectableListProps = {
|
||||
children: ReactNode;
|
||||
|
||||
@ -2,7 +2,7 @@ import { useRecoilCallback, useSetRecoilState } from 'recoil';
|
||||
|
||||
import { useSelectableListStates } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListStates';
|
||||
import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export const useSelectableList = (selectableListId?: string) => {
|
||||
const {
|
||||
|
||||
@ -7,11 +7,11 @@ import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
|
||||
import { AppTooltip, Avatar, AvatarType, IconComponent } from 'twenty-ui';
|
||||
import { v4 as uuidV4 } from 'uuid';
|
||||
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import {
|
||||
beautifyExactDateTime,
|
||||
beautifyPastDateRelativeToNow,
|
||||
} from '~/utils/date-utils';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
type ShowPageSummaryCardProps = {
|
||||
avatarPlaceholder: string;
|
||||
|
||||
@ -2,7 +2,7 @@ import { sortedFieldByTableFamilyState } from '@/ui/layout/table/states/sortedFi
|
||||
import { TableMetadata } from '@/ui/layout/table/types/TableMetadata';
|
||||
import { useMemo } from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export const useSortedArray = <T>(
|
||||
arrayToSort: T[],
|
||||
|
||||
@ -8,7 +8,7 @@ import styled from '@emotion/styled';
|
||||
import { useRef, useState } from 'react';
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { Key } from 'ts-key-enum';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { useHotkeyScopeOnMount } from '~/hooks/useHotkeyScopeOnMount';
|
||||
|
||||
type EditableBreadcrumbItemProps = {
|
||||
|
||||
@ -4,7 +4,8 @@ import { useListenClickOutside } from '@/ui/utilities/pointer-event/hooks/useLis
|
||||
import styled from '@emotion/styled';
|
||||
import { FocusEvent, useRef } from 'react';
|
||||
import { Key } from 'ts-key-enum';
|
||||
import { IconComponent, TablerIconsProps, isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { IconComponent, TablerIconsProps } from 'twenty-ui';
|
||||
import { useHotkeyScopeOnMount } from '~/hooks/useHotkeyScopeOnMount';
|
||||
|
||||
type NavigationDrawerInputProps = {
|
||||
|
||||
@ -11,7 +11,7 @@ import styled from '@emotion/styled';
|
||||
import { ReactNode } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { capitalize } from 'twenty-shared';
|
||||
import { capitalize, isDefined } from 'twenty-shared';
|
||||
import {
|
||||
IconComponent,
|
||||
Label,
|
||||
@ -19,7 +19,6 @@ import {
|
||||
Pill,
|
||||
TablerIconsProps,
|
||||
} from 'twenty-ui';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
const DEFAULT_INDENTATION_LEVEL = 1;
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||
import styled from '@emotion/styled';
|
||||
import React from 'react';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
const StyledTitle = styled.div`
|
||||
align-items: center;
|
||||
|
||||
@ -4,7 +4,7 @@ import { useRecoilState } from 'recoil';
|
||||
|
||||
import { pendingHotkeyState } from '../states/internal/pendingHotkeysState';
|
||||
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { useScopedHotkeyCallback } from './useScopedHotkeyCallback';
|
||||
|
||||
type UseHotkeysOptionsWithoutBuggyOptions = Omit<Options, 'enabled'>;
|
||||
|
||||
@ -2,7 +2,7 @@ import { Options, useHotkeys } from 'react-hotkeys-hook';
|
||||
import { Keys } from 'react-hotkeys-hook/dist/types';
|
||||
import { useRecoilState } from 'recoil';
|
||||
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
import { pendingHotkeyState } from '../states/internal/pendingHotkeysState';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { useRecoilCallback } from 'recoil';
|
||||
|
||||
import { DEBUG_HOTKEY_SCOPE } from '@/ui/utilities/hotkey/hooks/useScopedHotkeyCallback';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { logDebug } from '~/utils/logDebug';
|
||||
|
||||
import { DEFAULT_HOTKEYS_SCOPE_CUSTOM_SCOPES } from '../constants/DefaultHotkeysScopeCustomScopes';
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
ClickOutsideMode,
|
||||
useListenClickOutside,
|
||||
} from '@/ui/utilities/pointer-event/hooks/useListenClickOutside';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
const containerRef = React.createRef<HTMLDivElement>();
|
||||
const nullRef = React.createRef<HTMLDivElement>();
|
||||
|
||||
@ -4,8 +4,8 @@ import { useRecoilCallback } from 'recoil';
|
||||
import { useClickOustideListenerStates } from '@/ui/utilities/pointer-event/hooks/useClickOustideListenerStates';
|
||||
|
||||
import { ClickOutsideListenerCallback } from '@/ui/utilities/pointer-event/types/ClickOutsideListenerCallback';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
import { toSpliced } from '~/utils/array/toSpliced';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
|
||||
export const useClickOutsideListener = (componentId: string) => {
|
||||
const {
|
||||
|
||||
@ -9,7 +9,7 @@ import { ComponentInstanceStateContext } from '@/ui/utilities/state/component-st
|
||||
import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap';
|
||||
import { SelectorGetter } from '@/ui/utilities/state/types/SelectorGetter';
|
||||
import { SelectorSetter } from '@/ui/utilities/state/types/SelectorSetter';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export function createComponentFamilySelectorV2<
|
||||
ValueType,
|
||||
|
||||
@ -11,7 +11,7 @@ import {
|
||||
WrappedValue,
|
||||
} from 'recoil';
|
||||
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
type CreateComponentFamilyStateArgs<
|
||||
ValueType,
|
||||
|
||||
@ -9,7 +9,7 @@ import { ComponentStateKeyV2 } from '@/ui/utilities/state/component-state/types/
|
||||
import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap';
|
||||
import { SelectorGetter } from '@/ui/utilities/state/types/SelectorGetter';
|
||||
import { SelectorSetter } from '@/ui/utilities/state/types/SelectorSetter';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
export function createComponentSelectorV2<ValueType>(options: {
|
||||
key: string;
|
||||
|
||||
@ -4,7 +4,7 @@ import { ComponentStateV2 } from '@/ui/utilities/state/component-state/types/Com
|
||||
import { globalComponentInstanceContextMap } from '@/ui/utilities/state/component-state/utils/globalComponentInstanceContextMap';
|
||||
import { AtomEffect, atomFamily } from 'recoil';
|
||||
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
type CreateComponentInstanceStateArgs<ValueType> = {
|
||||
key: string;
|
||||
|
||||
@ -4,7 +4,7 @@ import { ScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-interna
|
||||
|
||||
import { RecoilComponentState } from '@/ui/utilities/state/component-state/types/RecoilComponentState';
|
||||
import { RecoilComponentStateKey } from '@/ui/utilities/state/component-state/types/RecoilComponentStateKey';
|
||||
import { isDefined } from '~/utils/isDefined';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
type CreateComponentStateV2Type<ValueType> = {
|
||||
key: string;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ComponentInstanceStateContext } from '@/ui/utilities/state/component-state/types/ComponentInstanceStateContext';
|
||||
import { isDefined } from 'twenty-ui';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
|
||||
class ComponentInstanceContextMap {
|
||||
constructor() {
|
||||
|
||||
Reference in New Issue
Block a user