From d62f63aff882115215309d7ce0e84628afc0afb6 Mon Sep 17 00:00:00 2001 From: Dan Peterson Date: Wed, 20 Oct 2021 13:33:31 -0500 Subject: [PATCH] delete duplicate flow type files (#105) * delete duplicate flow type files * merge types from deleted files * revert dispatch to type any. (linting issues) --- flow-typed/Notification.js | 93 -------------------------------------- flow-typed/Publish.js | 27 ----------- flow-typed/Redux.js | 6 --- flow-typed/notification.js | 93 ++++++++++++++++++++++++++++++++++++++ flow-typed/redux.js | 3 ++ 5 files changed, 96 insertions(+), 126 deletions(-) delete mode 100644 flow-typed/Notification.js delete mode 100644 flow-typed/Publish.js delete mode 100644 flow-typed/Redux.js diff --git a/flow-typed/Notification.js b/flow-typed/Notification.js deleted file mode 100644 index f0f63a1a9..000000000 --- a/flow-typed/Notification.js +++ /dev/null @@ -1,93 +0,0 @@ -// @flow -import * as ACTIONS from 'constants/action_types'; - -/* - Toasts: - - First-in, first-out queue - - Simple messages that are shown in response to user interactions - - Never saved - - If they are the result of errors, use the isError flag when creating - - For errors that should interrupt user behavior, use Error -*/ -declare type ToastParams = { - message: string, - title?: string, - linkText?: string, - linkTarget?: string, - isError?: boolean, -}; - -declare type Toast = { - id: string, - params: ToastParams, -}; - -declare type DoToast = { - type: ACTIONS.CREATE_TOAST, - data: Toast, -}; - -/* - Notifications: - - List of notifications based on user interactions/app notifications - - Always saved, but can be manually deleted - - Can happen in the background, or because of user interaction (ex: publish confirmed) -*/ -declare type Notification = { - id: string, // Unique id - dateCreated: number, - isRead: boolean, // Used to display "new" notifications that a user hasn't seen yet - source?: string, // The type/area an notification is from. Used for sorting (ex: publishes, transactions) - // We may want to use priority/isDismissed in the future to specify how urgent a notification is - // and if the user should see it immediately - // isDissmied: boolean, - // priority?: number -}; - -declare type DoNotification = { - type: ACTIONS.CREATE_NOTIFICATION, - data: Notification, -}; - -declare type DoEditNotification = { - type: ACTIONS.EDIT_NOTIFICATION, - data: { - notification: Notification, - }, -}; - -declare type DoDeleteNotification = { - type: ACTIONS.DELETE_NOTIFICATION, - data: { - id: string, // The id to delete - }, -}; - -/* - Errors: - - First-in, first-out queue - - Errors that should interupt user behavior - - For errors that can be shown without interrupting a user, use Toast with the isError flag -*/ -declare type ErrorNotification = { - title: string, - text: string, -}; - -declare type DoError = { - type: ACTIONS.CREATE_ERROR, - data: ErrorNotification, -}; - -declare type DoDismissError = { - type: ACTIONS.DISMISS_ERROR, -}; - -/* - NotificationState -*/ -declare type NotificationState = { - notifications: Array, - errors: Array, - toasts: Array, -}; diff --git a/flow-typed/Publish.js b/flow-typed/Publish.js deleted file mode 100644 index 87955ae24..000000000 --- a/flow-typed/Publish.js +++ /dev/null @@ -1,27 +0,0 @@ -// @flow - -declare type UpdatePublishFormData = { - filePath?: string, - contentIsFree?: boolean, - fee?: { - amount: string, - currency: string, - }, - title?: string, - thumbnail_url?: string, - uploadThumbnailStatus?: string, - thumbnailPath?: string, - description?: string, - language?: string, - channel?: string, - channelId?: string, - name?: string, - nameError?: string, - bid?: string, - bidError?: string, - otherLicenseDescription?: string, - licenseUrl?: string, - licenseType?: string, - uri?: string, - nsfw: boolean, -}; diff --git a/flow-typed/Redux.js b/flow-typed/Redux.js deleted file mode 100644 index addce023d..000000000 --- a/flow-typed/Redux.js +++ /dev/null @@ -1,6 +0,0 @@ -// @flow -/* eslint-disable no-use-before-define */ -declare type GetState = () => any; -declare type ThunkAction = (dispatch: Dispatch, getState: GetState) => any; -declare type Dispatch = (action: {} | Promise<*> | Array<{}> | ThunkAction) => any; // Need to refer to ThunkAction -/* eslint-enable */ diff --git a/flow-typed/notification.js b/flow-typed/notification.js index ea5a38c72..28bce14f5 100644 --- a/flow-typed/notification.js +++ b/flow-typed/notification.js @@ -1,4 +1,97 @@ // @flow +import * as ACTIONS from 'constants/action_types'; + +/* + Toasts: + - First-in, first-out queue + - Simple messages that are shown in response to user interactions + - Never saved + - If they are the result of errors, use the isError flag when creating + - For errors that should interrupt user behavior, use Error +*/ +declare type ToastParams = { + message: string, + title?: string, + linkText?: string, + linkTarget?: string, + isError?: boolean, +}; + +declare type Toast = { + id: string, + params: ToastParams, +}; + +declare type DoToast = { + type: ACTIONS.CREATE_TOAST, + data: Toast, +}; + +/* + Notifications: + - List of notifications based on user interactions/app notifications + - Always saved, but can be manually deleted + - Can happen in the background, or because of user interaction (ex: publish confirmed) +*/ +declare type Notification = { + id: string, // Unique id + dateCreated: number, + isRead: boolean, // Used to display "new" notifications that a user hasn't seen yet + source?: string, // The type/area an notification is from. Used for sorting (ex: publishes, transactions) + // We may want to use priority/isDismissed in the future to specify how urgent a notification is + // and if the user should see it immediately + // isDissmied: boolean, + // priority?: number +}; + +declare type DoNotification = { + type: ACTIONS.CREATE_NOTIFICATION, + data: Notification, +}; + +declare type DoEditNotification = { + type: ACTIONS.EDIT_NOTIFICATION, + data: { + notification: Notification, + }, +}; + +declare type DoDeleteNotification = { + type: ACTIONS.DELETE_NOTIFICATION, + data: { + id: string, // The id to delete + }, +}; + +/* + Errors: + - First-in, first-out queue + - Errors that should interupt user behavior + - For errors that can be shown without interrupting a user, use Toast with the isError flag +*/ +declare type ErrorNotification = { + title: string, + text: string, +}; + +declare type DoError = { + type: ACTIONS.CREATE_ERROR, + data: ErrorNotification, +}; + +declare type DoDismissError = { + type: ACTIONS.DISMISS_ERROR, +}; + +/* + NotificationState +*/ +declare type NotificationState = { + notifications: Array, + errors: Array, + toasts: Array, +}; + declare type WebNotification = { active_at: string, created_at: string, diff --git a/flow-typed/redux.js b/flow-typed/redux.js index e159c168e..3d059093b 100644 --- a/flow-typed/redux.js +++ b/flow-typed/redux.js @@ -1,3 +1,6 @@ // @flow +/* eslint-disable no-use-before-define */ +declare type GetState = () => any; declare type Dispatch = any; +/* eslint-enable */