Move ToastType to its own file to avoid importing electron in storybooks
This commit is contained in:
parent
daf66f33da
commit
15efbde23d
18 changed files with 57 additions and 49 deletions
|
@ -12,7 +12,7 @@ import type {
|
|||
ReplacementValuesType,
|
||||
ThemeType,
|
||||
} from '../types/Util';
|
||||
import { ToastType } from '../state/ducks/toast';
|
||||
import { ToastType } from '../types/Toast';
|
||||
import { filterAndSortConversationsByRecent } from '../util/filterAndSortConversations';
|
||||
import { ConfirmationDialog } from './ConfirmationDialog';
|
||||
import type { Row } from './ConversationList';
|
||||
|
|
|
@ -8,7 +8,7 @@ import classNames from 'classnames';
|
|||
|
||||
import type { ExecuteMenuRoleType } from './TitleBarContainer';
|
||||
import type { MenuOptionsType, MenuActionType } from '../types/menu';
|
||||
import type { ToastType } from '../state/ducks/toast';
|
||||
import type { ToastType } from '../types/Toast';
|
||||
import type { ViewStoryActionCreatorType } from '../state/ducks/stories';
|
||||
import type { ReplacementValuesType } from '../types/Util';
|
||||
import { ThemeType } from '../types/Util';
|
||||
|
|
|
@ -6,7 +6,7 @@ import React from 'react';
|
|||
|
||||
import * as Errors from '../types/errors';
|
||||
import * as log from '../logging/log';
|
||||
import { ToastType } from '../state/ducks/toast';
|
||||
import { ToastType } from '../types/Toast';
|
||||
|
||||
export type Props = {
|
||||
children: ReactNode;
|
||||
|
|
|
@ -27,7 +27,7 @@ import { Modal } from './Modal';
|
|||
import { PanelRow } from './conversation/conversation-details/PanelRow';
|
||||
import type { ProfileDataType } from '../state/ducks/conversations';
|
||||
import { UsernameEditState } from '../state/ducks/usernameEnums';
|
||||
import { ToastType } from '../state/ducks/toast';
|
||||
import { ToastType } from '../types/Toast';
|
||||
import type { ShowToastActionCreatorType } from '../state/ducks/toast';
|
||||
import { getEmojiData, unifiedToEmoji } from './emoji/lib';
|
||||
import { assertDev } from '../util/assert';
|
||||
|
|
|
@ -8,7 +8,7 @@ import type { LocalizerType } from '../types/Util';
|
|||
import type { ShowToastActionCreatorType } from '../state/ducks/toast';
|
||||
import { ContextMenu } from './ContextMenu';
|
||||
import { Theme } from '../util/theme';
|
||||
import { ToastType } from '../state/ducks/toast';
|
||||
import { ToastType } from '../types/Toast';
|
||||
import {
|
||||
isVideoGoodForStories,
|
||||
ReasonVideoNotGood,
|
||||
|
|
|
@ -43,7 +43,7 @@ import {
|
|||
} from '../types/Stories';
|
||||
import { StoryViewsNRepliesModal } from './StoryViewsNRepliesModal';
|
||||
import { Theme } from '../util/theme';
|
||||
import { ToastType } from '../state/ducks/toast';
|
||||
import { ToastType } from '../types/Toast';
|
||||
import { getAvatarColor } from '../types/Colors';
|
||||
import { getStoryBackground } from '../util/getStoryBackground';
|
||||
import { getStoryDuration } from '../util/getStoryDuration';
|
||||
|
|
|
@ -7,7 +7,7 @@ import React from 'react';
|
|||
import type { PropsType } from './ToastManager';
|
||||
import enMessages from '../../_locales/en/messages.json';
|
||||
import { ToastManager } from './ToastManager';
|
||||
import { ToastType } from '../state/ducks/toast';
|
||||
import { ToastType } from '../types/Toast';
|
||||
import { setupI18n } from '../util/setupI18n';
|
||||
|
||||
const i18n = setupI18n('en', enMessages);
|
||||
|
|
|
@ -6,8 +6,8 @@ import type { LocalizerType, ReplacementValuesType } from '../types/Util';
|
|||
import { SECOND } from '../util/durations';
|
||||
import { Toast } from './Toast';
|
||||
import { ToastMessageBodyTooLong } from './ToastMessageBodyTooLong';
|
||||
import { ToastType } from '../state/ducks/toast';
|
||||
import { missingCaseError } from '../util/missingCaseError';
|
||||
import { ToastType } from '../types/Toast';
|
||||
|
||||
export type PropsType = {
|
||||
hideToast: () => unknown;
|
||||
|
|
|
@ -49,7 +49,8 @@ import { waitForOnline } from '../../util/waitForOnline';
|
|||
import * as mapUtil from '../../util/mapUtil';
|
||||
import { isCallSafe } from '../../util/isCallSafe';
|
||||
import { isDirectConversation } from '../../util/whatTypeOfConversation';
|
||||
import { SHOW_TOAST, ToastType } from './toast';
|
||||
import { SHOW_TOAST } from './toast';
|
||||
import { ToastType } from '../../types/Toast';
|
||||
import type { ShowToastActionType } from './toast';
|
||||
|
||||
// State
|
||||
|
|
|
@ -33,7 +33,8 @@ import {
|
|||
} from './linkPreviews';
|
||||
import { LinkPreviewSourceType } from '../../types/LinkPreview';
|
||||
import { RecordingState } from './audioRecorder';
|
||||
import { SHOW_TOAST, ToastType } from './toast';
|
||||
import { SHOW_TOAST } from './toast';
|
||||
import { ToastType } from '../../types/Toast';
|
||||
import { SafetyNumberChangeSource } from '../../components/SafetyNumberChangeDialog';
|
||||
import { UUID } from '../../types/UUID';
|
||||
import { assignWithNoUnnecessaryAllocation } from '../../util/assignWithNoUnnecessaryAllocation';
|
||||
|
|
|
@ -104,7 +104,8 @@ import { ReadStatus } from '../../messages/MessageReadStatus';
|
|||
import { isIncoming, isOutgoing } from '../selectors/message';
|
||||
import { sendDeleteForEveryoneMessage } from '../../util/sendDeleteForEveryoneMessage';
|
||||
import type { ShowToastActionType } from './toast';
|
||||
import { SHOW_TOAST, ToastType } from './toast';
|
||||
import { SHOW_TOAST } from './toast';
|
||||
import { ToastType } from '../../types/Toast';
|
||||
import { isMemberRequestingToJoin } from '../../util/isMemberRequestingToJoin';
|
||||
import { removePendingMember } from '../../util/removePendingMember';
|
||||
import { denyPendingApprovalRequest } from '../../util/denyPendingApprovalRequest';
|
||||
|
|
|
@ -18,7 +18,8 @@ import {
|
|||
isVideoTypeSupported,
|
||||
} from '../../util/GoogleChrome';
|
||||
import { isTapToView } from '../selectors/message';
|
||||
import { SHOW_TOAST, ToastType } from './toast';
|
||||
import { SHOW_TOAST } from './toast';
|
||||
import { ToastType } from '../../types/Toast';
|
||||
import { saveAttachmentFromMessage } from './conversations';
|
||||
import { showStickerPackPreview } from './globalModals';
|
||||
import { useBoundActions } from '../../hooks/useBoundActions';
|
||||
|
|
|
@ -7,39 +7,7 @@ import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions';
|
|||
import type { NoopActionType } from './noop';
|
||||
import type { ReplacementValuesType } from '../../types/Util';
|
||||
import { useBoundActions } from '../../hooks/useBoundActions';
|
||||
|
||||
export enum ToastType {
|
||||
AddingUserToGroup = 'AddingUserToGroup',
|
||||
Blocked = 'Blocked',
|
||||
BlockedGroup = 'BlockedGroup',
|
||||
CannotMixMultiAndNonMultiAttachments = 'CannotMixMultiAndNonMultiAttachments',
|
||||
CannotStartGroupCall = 'CannotStartGroupCall',
|
||||
CopiedUsername = 'CopiedUsername',
|
||||
CopiedUsernameLink = 'CopiedUsernameLink',
|
||||
DangerousFileType = 'DangerousFileType',
|
||||
DeleteForEveryoneFailed = 'DeleteForEveryoneFailed',
|
||||
Error = 'Error',
|
||||
Expired = 'Expired',
|
||||
FailedToDeleteUsername = 'FailedToDeleteUsername',
|
||||
FileSaved = 'FileSaved',
|
||||
FileSize = 'FileSize',
|
||||
InvalidConversation = 'InvalidConversation',
|
||||
LeftGroup = 'LeftGroup',
|
||||
MaxAttachments = 'MaxAttachments',
|
||||
MessageBodyTooLong = 'MessageBodyTooLong',
|
||||
PinnedConversationsFull = 'PinnedConversationsFull',
|
||||
ReportedSpamAndBlocked = 'ReportedSpamAndBlocked',
|
||||
StoryMuted = 'StoryMuted',
|
||||
StoryReact = 'StoryReact',
|
||||
StoryReply = 'StoryReply',
|
||||
StoryVideoError = 'StoryVideoError',
|
||||
StoryVideoTooLong = 'StoryVideoTooLong',
|
||||
StoryVideoUnsupported = 'StoryVideoUnsupported',
|
||||
UnableToLoadAttachment = 'UnableToLoadAttachment',
|
||||
UnsupportedMultiAttachment = 'UnsupportedMultiAttachment',
|
||||
UserAddedToGroup = 'UserAddedToGroup',
|
||||
}
|
||||
|
||||
import type { ToastType } from '../../types/Toast';
|
||||
// State
|
||||
|
||||
export type ToastStateType = {
|
||||
|
|
|
@ -23,7 +23,8 @@ import {
|
|||
UsernameReservationState,
|
||||
UsernameReservationError,
|
||||
} from './usernameEnums';
|
||||
import { showToast, ToastType } from './toast';
|
||||
import { showToast } from './toast';
|
||||
import { ToastType } from '../../types/Toast';
|
||||
import type { ToastActionType } from './toast';
|
||||
|
||||
export type UsernameReservationStateType = Readonly<{
|
||||
|
|
|
@ -9,7 +9,8 @@ import type { LocalizerType } from '../../types/Util';
|
|||
import type { StateType } from '../reducer';
|
||||
import type { SelectedStoryDataType } from '../ducks/stories';
|
||||
import { StoryViewer } from '../../components/StoryViewer';
|
||||
import { ToastType, useToastActions } from '../ducks/toast';
|
||||
import { ToastType } from '../../types/Toast';
|
||||
import { useToastActions } from '../ducks/toast';
|
||||
import { getConversationSelector } from '../selectors/conversations';
|
||||
import {
|
||||
getEmojiSkinTone,
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
UsernameReservationError,
|
||||
} from '../../../state/ducks/usernameEnums';
|
||||
import { actions } from '../../../state/ducks/username';
|
||||
import { ToastType } from '../../../state/ducks/toast';
|
||||
import { ToastType } from '../../../types/Toast';
|
||||
import { noopAction } from '../../../state/ducks/noop';
|
||||
import { reducer } from '../../../state/reducer';
|
||||
import { ReserveUsernameError } from '../../../types/Username';
|
||||
|
|
34
ts/types/Toast.tsx
Normal file
34
ts/types/Toast.tsx
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export enum ToastType {
|
||||
AddingUserToGroup = 'AddingUserToGroup',
|
||||
Blocked = 'Blocked',
|
||||
BlockedGroup = 'BlockedGroup',
|
||||
CannotMixMultiAndNonMultiAttachments = 'CannotMixMultiAndNonMultiAttachments',
|
||||
CannotStartGroupCall = 'CannotStartGroupCall',
|
||||
CopiedUsername = 'CopiedUsername',
|
||||
CopiedUsernameLink = 'CopiedUsernameLink',
|
||||
DangerousFileType = 'DangerousFileType',
|
||||
DeleteForEveryoneFailed = 'DeleteForEveryoneFailed',
|
||||
Error = 'Error',
|
||||
Expired = 'Expired',
|
||||
FailedToDeleteUsername = 'FailedToDeleteUsername',
|
||||
FileSaved = 'FileSaved',
|
||||
FileSize = 'FileSize',
|
||||
InvalidConversation = 'InvalidConversation',
|
||||
LeftGroup = 'LeftGroup',
|
||||
MaxAttachments = 'MaxAttachments',
|
||||
MessageBodyTooLong = 'MessageBodyTooLong',
|
||||
PinnedConversationsFull = 'PinnedConversationsFull',
|
||||
ReportedSpamAndBlocked = 'ReportedSpamAndBlocked',
|
||||
StoryMuted = 'StoryMuted',
|
||||
StoryReact = 'StoryReact',
|
||||
StoryReply = 'StoryReply',
|
||||
StoryVideoError = 'StoryVideoError',
|
||||
StoryVideoTooLong = 'StoryVideoTooLong',
|
||||
StoryVideoUnsupported = 'StoryVideoUnsupported',
|
||||
UnableToLoadAttachment = 'UnableToLoadAttachment',
|
||||
UnsupportedMultiAttachment = 'UnsupportedMultiAttachment',
|
||||
UserAddedToGroup = 'UserAddedToGroup',
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import type { ConversationAttributesType } from '../model-types';
|
||||
|
||||
import { ToastType } from '../state/ducks/toast';
|
||||
import { ToastType } from '../types/Toast';
|
||||
import {
|
||||
isDirectConversation,
|
||||
isGroupV1,
|
||||
|
|
Loading…
Add table
Reference in a new issue