about summary refs log tree commit diff
path: root/src/components/dialogs/EmailDialog/types.ts
blob: 7edc3facc6c58470946991db67c81fb62fe555ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {type ReactNode} from 'react'

import {type DialogControlProps} from '#/components/Dialog'

export type EmailDialogProps = {
  control: DialogControlProps
}

export type EmailDialogInnerProps = EmailDialogProps & {}

export type Screen =
  | {
      id: ScreenID.Update
    }
  | {
      id: ScreenID.Verify
      instructions?: ReactNode[]
      onVerify?: () => void
      onCloseWithoutVerifying?: () => void
    }
  | {
      id: ScreenID.VerificationReminder
    }
  | {
      id: ScreenID.Manage2FA
    }

export enum ScreenID {
  Update = 'Update',
  Verify = 'Verify',
  VerificationReminder = 'VerificationReminder',
  Manage2FA = 'Manage2FA',
}

export type ScreenProps<T extends ScreenID> = {
  config: Extract<Screen, {id: T}>
  showScreen: (screen: Screen) => void
}