-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transaction views customization (#1275)
* Stability UI customizations V0 Fixes #1269 * oops * [skip ci] clean up
- Loading branch information
Showing
21 changed files
with
321 additions
and
95 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
import type { IdenticonType } from 'types/views/address'; | ||
import { IDENTICON_TYPES } from 'types/views/address'; | ||
import type { AddressViewId, IdenticonType } from 'types/views/address'; | ||
import { ADDRESS_VIEWS_IDS, IDENTICON_TYPES } from 'types/views/address'; | ||
|
||
import { getEnvValue } from 'configs/app/utils'; | ||
import { getEnvValue, parseEnvJson } from 'configs/app/utils'; | ||
|
||
const identiconType: IdenticonType = (() => { | ||
const value = getEnvValue('NEXT_PUBLIC_VIEWS_ADDRESS_IDENTICON_TYPE'); | ||
|
||
return IDENTICON_TYPES.find((type) => value === type) || 'jazzicon'; | ||
})(); | ||
|
||
const hiddenViews = (() => { | ||
const parsedValue = parseEnvJson<Array<AddressViewId>>(getEnvValue('NEXT_PUBLIC_VIEWS_ADDRESS_HIDDEN_VIEWS')) || []; | ||
|
||
if (!Array.isArray(parsedValue)) { | ||
return undefined; | ||
} | ||
|
||
const result = ADDRESS_VIEWS_IDS.reduce((result, item) => { | ||
result[item] = parsedValue.includes(item); | ||
return result; | ||
}, {} as Record<AddressViewId, boolean>); | ||
|
||
return result; | ||
})(); | ||
|
||
const config = Object.freeze({ | ||
identiconType: identiconType, | ||
identiconType, | ||
hiddenViews, | ||
}); | ||
|
||
export default config; |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as block } from './block'; | ||
export { default as address } from './address'; | ||
export { default as block } from './block'; | ||
export { default as tx } from './tx'; |
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,41 @@ | ||
import type { TxAdditionalFieldsId, TxFieldsId } from 'types/views/tx'; | ||
import { TX_ADDITIONAL_FIELDS_IDS, TX_FIELDS_IDS } from 'types/views/tx'; | ||
|
||
import { getEnvValue, parseEnvJson } from 'configs/app/utils'; | ||
|
||
const hiddenFields = (() => { | ||
const parsedValue = parseEnvJson<Array<TxFieldsId>>(getEnvValue('NEXT_PUBLIC_VIEWS_TX_HIDDEN_FIELDS')) || []; | ||
|
||
if (!Array.isArray(parsedValue)) { | ||
return undefined; | ||
} | ||
|
||
const result = TX_FIELDS_IDS.reduce((result, item) => { | ||
result[item] = parsedValue.includes(item); | ||
return result; | ||
}, {} as Record<TxFieldsId, boolean>); | ||
|
||
return result; | ||
})(); | ||
|
||
const additionalFields = (() => { | ||
const parsedValue = parseEnvJson<Array<TxAdditionalFieldsId>>(getEnvValue('NEXT_PUBLIC_VIEWS_TX_ADDITIONAL_FIELDS')) || []; | ||
|
||
if (!Array.isArray(parsedValue)) { | ||
return undefined; | ||
} | ||
|
||
const result = TX_ADDITIONAL_FIELDS_IDS.reduce((result, item) => { | ||
result[item] = parsedValue.includes(item); | ||
return result; | ||
}, {} as Record<TxAdditionalFieldsId, boolean>); | ||
|
||
return result; | ||
})(); | ||
|
||
const config = Object.freeze({ | ||
hiddenFields, | ||
additionalFields, | ||
}); | ||
|
||
export default config; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { ArrayElement } from 'types/utils'; | ||
|
||
export const TX_FIELDS_IDS = [ | ||
'value', | ||
'fee_currency', | ||
'gas_price', | ||
'tx_fee', | ||
'gas_fees', | ||
'burnt_fees', | ||
] as const; | ||
|
||
export type TxFieldsId = ArrayElement<typeof TX_FIELDS_IDS>; | ||
|
||
export const TX_ADDITIONAL_FIELDS_IDS = [ | ||
'fee_per_gas', | ||
] as const; | ||
|
||
export type TxAdditionalFieldsId = ArrayElement<typeof TX_ADDITIONAL_FIELDS_IDS>; |
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
Oops, something went wrong.