Skip to content

Commit

Permalink
Merge pull request #222 from kaleido-io/tokens-active
Browse files Browse the repository at this point in the history
Update token pool to use active boolean
  • Loading branch information
nguyer authored Mar 20, 2024
2 parents 9a2b322 + fc0b31b commit 7194297
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
10 changes: 7 additions & 3 deletions src/components/Chips/PoolStatusChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@

import { Chip } from '@mui/material';
import React from 'react';
import { ITokenPool, PoolStateColorMap } from '../../interfaces';
import {
ITokenPool,
PoolStateColorMap,
PoolStateString,
} from '../../interfaces';

interface Props {
pool: ITokenPool;
Expand All @@ -25,8 +29,8 @@ interface Props {
export const PoolStatusChip: React.FC<Props> = ({ pool }) => {
return (
<Chip
label={pool.state.toLocaleUpperCase()}
sx={{ backgroundColor: PoolStateColorMap[pool.state] }}
label={PoolStateString(pool.active)}
sx={{ backgroundColor: PoolStateColorMap(pool.active) }}
/>
);
};
2 changes: 1 addition & 1 deletion src/components/Lists/PoolList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const PoolList: React.FC<Props> = ({ pool }) => {
},
{
label: t('state'),
value: pool.state && <PoolStatusChip pool={pool} />,
value: <PoolStatusChip pool={pool} />,
},
{
label: t('created'),
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ export interface ITokenPool {
locator: string;
connector: string;
message: string;
state: 'confirmed' | 'pending';
active: boolean;
created: string;
tx?: ITx;
info?: any;
Expand Down
17 changes: 13 additions & 4 deletions src/interfaces/enums/transferTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import LocalFireDepartmentIcon from '@mui/icons-material/LocalFireDepartment';
import SwapHorizIcon from '@mui/icons-material/SwapHoriz';
import { IBlockchainCategory } from '.';
import { FFColors } from '../../theme';
import { t } from 'i18next';

export interface IHistTransferBucket {
[TransferCategoryEnum.MINT]: number;
Expand All @@ -37,10 +38,18 @@ export enum TransferCategoryEnum {
TRANSFER = 'Transfer',
}

export const PoolStateColorMap: { [key: string]: string } = {
unknown: FFColors.Red,
confirmed: FFColors.Purple,
pending: FFColors.Orange,
export const PoolStateColorMap = (active: boolean) => {
if (active) {
return FFColors.Purple;
}
return FFColors.Orange;
};

export const PoolStateString = (active: boolean) => {
if (active) {
return t('active');
}
return t('inactive');
};

export enum FF_TRANSFERS {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Tokens/views/Pools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const TokensPools: () => JSX.Element = () => {
t('standard'),
t('connector'),
t('locator'),
t('state'),
t('active'),
t('created'),
];
const tokenPoolRecords: IDataTableRecord[] | undefined = tokenPools?.map(
Expand Down
1 change: 1 addition & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"identityID": "Identity ID",
"identityUpdated": "Identity Updated",
"in": "In",
"inactive": "Inactive",
"info": "Info",
"input": "Input",
"inputOutputDetail": "Input, Output and Detail",
Expand Down

0 comments on commit 7194297

Please sign in to comment.