Skip to content

Commit

Permalink
Fixes storybook for AudioCapture
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-signal committed Jan 21, 2023
1 parent 99c9579 commit b5947e0
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion ts/components/CompositionArea.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { StorybookThemeContext } from '../../.storybook/StorybookThemeContext';

import { fakeDraftAttachment } from '../test-both/helpers/fakeAttachment';
import { landscapeGreenUrl } from '../storybook/Fixtures';
import { RecordingState } from '../state/ducks/audioRecorder';
import { RecordingState } from '../types/AudioRecorder';
import { ConversationColors } from '../types/Colors';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
import { PaymentEventKind } from '../types/Payment';
Expand Down
4 changes: 2 additions & 2 deletions ts/components/CompositionArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import type {
LocalizerType,
ThemeType,
} from '../types/Util';
import type { ErrorDialogAudioRecorderType } from '../state/ducks/audioRecorder';
import { RecordingState } from '../state/ducks/audioRecorder';
import type { ErrorDialogAudioRecorderType } from '../types/AudioRecorder';
import { RecordingState } from '../types/AudioRecorder';
import type { imageToBlurHash } from '../util/imageToBlurHash';
import { Spinner } from './Spinner';
import type {
Expand Down
2 changes: 1 addition & 1 deletion ts/components/conversation/AudioCapture.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { select } from '@storybook/addon-knobs';
import {
ErrorDialogAudioRecorderType,
RecordingState,
} from '../../state/ducks/audioRecorder';
} from '../../types/AudioRecorder';
import type { PropsType } from './AudioCapture';
import { AudioCapture } from './AudioCapture';
import { setupI18n } from '../../util/setupI18n';
Expand Down
8 changes: 4 additions & 4 deletions ts/components/conversation/AudioCapture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ import type {
} from '../../types/Attachment';
import { ConfirmationDialog } from '../ConfirmationDialog';
import type { LocalizerType } from '../../types/Util';
import {
ErrorDialogAudioRecorderType,
RecordingState,
} from '../../state/ducks/audioRecorder';
import { ToastVoiceNoteLimit } from '../ToastVoiceNoteLimit';
import { ToastVoiceNoteMustBeOnlyAttachment } from '../ToastVoiceNoteMustBeOnlyAttachment';
import { useEscapeHandling } from '../../hooks/useEscapeHandling';
import {
useStartRecordingShortcut,
useKeyboardShortcuts,
} from '../../hooks/useKeyboardShortcuts';
import {
ErrorDialogAudioRecorderType,
RecordingState,
} from '../../types/AudioRecorder';

type OnSendAudioRecordingType = (rec: InMemoryAttachmentDraftType) => unknown;

Expand Down
16 changes: 4 additions & 12 deletions ts/state/ducks/audioRecorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,13 @@ import { stringToMIMEType } from '../../types/MIME';
import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions';
import { useBoundActions } from '../../hooks/useBoundActions';
import { getComposerStateForConversation } from './composer';

export enum ErrorDialogAudioRecorderType {
Blur,
ErrorRecording,
Timeout,
}
import {
ErrorDialogAudioRecorderType,
RecordingState,
} from '../../types/AudioRecorder';

// State

export enum RecordingState {
Recording = 'recording',
Initializing = 'initializing',
Idle = 'idle',
}

export type AudioPlayerStateType = ReadonlyDeep<{
recordingState: RecordingState;
errorDialogAudioRecorderType?: ErrorDialogAudioRecorderType;
Expand Down
2 changes: 1 addition & 1 deletion ts/state/ducks/composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
REMOVE_PREVIEW as REMOVE_LINK_PREVIEW,
} from './linkPreviews';
import { LinkPreviewSourceType } from '../../types/LinkPreview';
import { RecordingState } from './audioRecorder';
import { RecordingState } from '../../types/AudioRecorder';
import { SHOW_TOAST } from './toast';
import { ToastType } from '../../types/Toast';
import { SafetyNumberChangeSource } from '../../components/SafetyNumberChangeDialog';
Expand Down
14 changes: 14 additions & 0 deletions ts/types/AudioRecorder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only

export enum ErrorDialogAudioRecorderType {
Blur,
ErrorRecording,
Timeout,
}

export enum RecordingState {
Recording = 'recording',
Initializing = 'initializing',
Idle = 'idle',
}

0 comments on commit b5947e0

Please sign in to comment.