Skip to content

Commit 7194297

Browse files
authored
Merge pull request #222 from kaleido-io/tokens-active
Update token pool to use active boolean
2 parents 9a2b322 + fc0b31b commit 7194297

File tree

6 files changed

+24
-10
lines changed

6 files changed

+24
-10
lines changed

src/components/Chips/PoolStatusChip.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616

1717
import { Chip } from '@mui/material';
1818
import React from 'react';
19-
import { ITokenPool, PoolStateColorMap } from '../../interfaces';
19+
import {
20+
ITokenPool,
21+
PoolStateColorMap,
22+
PoolStateString,
23+
} from '../../interfaces';
2024

2125
interface Props {
2226
pool: ITokenPool;
@@ -25,8 +29,8 @@ interface Props {
2529
export const PoolStatusChip: React.FC<Props> = ({ pool }) => {
2630
return (
2731
<Chip
28-
label={pool.state.toLocaleUpperCase()}
29-
sx={{ backgroundColor: PoolStateColorMap[pool.state] }}
32+
label={PoolStateString(pool.active)}
33+
sx={{ backgroundColor: PoolStateColorMap(pool.active) }}
3034
/>
3135
);
3236
};

src/components/Lists/PoolList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export const PoolList: React.FC<Props> = ({ pool }) => {
9797
},
9898
{
9999
label: t('state'),
100-
value: pool.state && <PoolStatusChip pool={pool} />,
100+
value: <PoolStatusChip pool={pool} />,
101101
},
102102
{
103103
label: t('created'),

src/interfaces/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ export interface ITokenPool {
551551
locator: string;
552552
connector: string;
553553
message: string;
554-
state: 'confirmed' | 'pending';
554+
active: boolean;
555555
created: string;
556556
tx?: ITx;
557557
info?: any;

src/interfaces/enums/transferTypes.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import LocalFireDepartmentIcon from '@mui/icons-material/LocalFireDepartment';
1919
import SwapHorizIcon from '@mui/icons-material/SwapHoriz';
2020
import { IBlockchainCategory } from '.';
2121
import { FFColors } from '../../theme';
22+
import { t } from 'i18next';
2223

2324
export interface IHistTransferBucket {
2425
[TransferCategoryEnum.MINT]: number;
@@ -37,10 +38,18 @@ export enum TransferCategoryEnum {
3738
TRANSFER = 'Transfer',
3839
}
3940

40-
export const PoolStateColorMap: { [key: string]: string } = {
41-
unknown: FFColors.Red,
42-
confirmed: FFColors.Purple,
43-
pending: FFColors.Orange,
41+
export const PoolStateColorMap = (active: boolean) => {
42+
if (active) {
43+
return FFColors.Purple;
44+
}
45+
return FFColors.Orange;
46+
};
47+
48+
export const PoolStateString = (active: boolean) => {
49+
if (active) {
50+
return t('active');
51+
}
52+
return t('inactive');
4453
};
4554

4655
export enum FF_TRANSFERS {

src/pages/Tokens/views/Pools.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const TokensPools: () => JSX.Element = () => {
9898
t('standard'),
9999
t('connector'),
100100
t('locator'),
101-
t('state'),
101+
t('active'),
102102
t('created'),
103103
];
104104
const tokenPoolRecords: IDataTableRecord[] | undefined = tokenPools?.map(

src/translations/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
"identityID": "Identity ID",
142142
"identityUpdated": "Identity Updated",
143143
"in": "In",
144+
"inactive": "Inactive",
144145
"info": "Info",
145146
"input": "Input",
146147
"inputOutputDetail": "Input, Output and Detail",

0 commit comments

Comments
 (0)