-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ts): convert some useful code to ts
- Loading branch information
Philip London
committed
Aug 11, 2020
1 parent
c479eba
commit 25fa282
Showing
17 changed files
with
120 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
29 changes: 0 additions & 29 deletions
29
packages/blockchain-wallet-v4-frontend/src/data/alerts/actions.js
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
packages/blockchain-wallet-v4-frontend/src/data/alerts/actions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { AlertNatureType } from './types' | ||
import { ALERTS_CLEAR, ALERTS_DISMISS, ALERTS_SHOW } from './actionTypes' | ||
import { CoinType } from 'core/types' | ||
|
||
const generateId = () => | ||
Math.random() | ||
.toString(36) | ||
.substr(2, 10) | ||
|
||
const display = ( | ||
nature: AlertNatureType, | ||
message: string, | ||
data: any, | ||
persist?: boolean, | ||
coin?: CoinType | ||
) => ({ | ||
type: ALERTS_SHOW, | ||
payload: { id: generateId(), nature, message, data, persist, coin } | ||
}) | ||
export const displayWarning = ( | ||
message: string, | ||
data?: any, | ||
persist?: boolean | ||
) => display('warn', message, data, persist) | ||
|
||
export const displayInfo = (message: string, data?: any, persist?: boolean) => | ||
display('info', message, data, persist) | ||
|
||
export const displaySuccess = ( | ||
message: string, | ||
data?: any, | ||
persist?: boolean | ||
) => display('success', message, data, persist) | ||
|
||
export const displayError = ( | ||
message: string, | ||
data?: any, | ||
persist?: boolean, | ||
coin?: CoinType | ||
) => display('error', message, data, persist, coin) | ||
|
||
export const clearAlerts = () => ({ type: ALERTS_CLEAR }) | ||
|
||
export const dismissAlert = id => ({ type: ALERTS_DISMISS, payload: { id } }) |
12 changes: 0 additions & 12 deletions
12
packages/blockchain-wallet-v4-frontend/src/data/alerts/reducers.spec.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
packages/blockchain-wallet-v4-frontend/src/data/alerts/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { CoinType } from 'core/types' | ||
|
||
// types | ||
export type AlertNatureType = 'info' | 'warn' | 'success' | 'error' | ||
|
||
export type AlertType = { | ||
coin?: CoinType | ||
data?: any | ||
id: string | ||
message: string | ||
nature: AlertNatureType | ||
persist?: boolean | ||
} | ||
|
||
// state | ||
export type AlertsState = Array<AlertType> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters