-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f34f2e2
commit 6760af5
Showing
14 changed files
with
91 additions
and
75 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
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
12 changes: 5 additions & 7 deletions
12
packages/apps/dev-wallet/src/Components/Table/FormatKeys.tsx
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
5 changes: 1 addition & 4 deletions
5
packages/apps/dev-wallet/src/pages/keys/Components/KeySets.tsx
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
8 changes: 4 additions & 4 deletions
8
packages/libs/kode-ui/src/patterns/CompactTable/TableFormatters/FormatAccount.tsx
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,8 +1,8 @@ | ||
import type { FC } from 'react'; | ||
import { maskValue } from './../../../components'; | ||
import type { ICompactTableFormatterProps } from './types'; | ||
import { valueToString } from './utils'; | ||
|
||
export const FormatAccount: () => FC<ICompactTableFormatterProps> = | ||
export const FormatAccount = | ||
() => | ||
({ value }) => | ||
value && maskValue(value); | ||
({ value }: ICompactTableFormatterProps) => | ||
value && maskValue(valueToString(value)); |
8 changes: 4 additions & 4 deletions
8
packages/libs/kode-ui/src/patterns/CompactTable/TableFormatters/FormatAmount.tsx
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,11 +1,11 @@ | ||
import type { FC } from 'react'; | ||
import React from 'react'; | ||
import type { ICompactTableFormatterProps } from './types'; | ||
import { valueToString } from './utils'; | ||
|
||
export const FormatAmount = (): FC<ICompactTableFormatterProps> => { | ||
const Component: FC<ICompactTableFormatterProps> = ({ value }) => { | ||
export const FormatAmount = () => { | ||
const Component = ({ value }: ICompactTableFormatterProps) => { | ||
if (!value) return null; | ||
return <>{parseFloat(value).toLocaleString()} KDA</>; | ||
return <>{parseFloat(valueToString(value)).toLocaleString()} KDA</>; | ||
}; | ||
return Component; | ||
}; |
15 changes: 4 additions & 11 deletions
15
packages/libs/kode-ui/src/patterns/CompactTable/TableFormatters/FormatDefault.tsx
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,17 +1,10 @@ | ||
import type { FC } from 'react'; | ||
import React from 'react'; | ||
import type { ICompactTableFormatterProps } from './types'; | ||
import { valueToString } from './utils'; | ||
|
||
export const FormatDefault = (): FC<ICompactTableFormatterProps> => { | ||
const Component: FC<ICompactTableFormatterProps> = ({ value }) => { | ||
if (typeof value === 'object') { | ||
return value.reduce((acc, val) => { | ||
if (!val) return acc; | ||
return `${acc}${val} `; | ||
}, ''); | ||
} | ||
|
||
return <>{value}</>; | ||
export const FormatDefault = () => { | ||
const Component = ({ value }: ICompactTableFormatterProps) => { | ||
return <>{valueToString(value)}</>; | ||
}; | ||
return Component; | ||
}; |
16 changes: 9 additions & 7 deletions
16
packages/libs/kode-ui/src/patterns/CompactTable/TableFormatters/FormatJsonParse.tsx
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,14 +1,16 @@ | ||
import type { FC } from 'react'; | ||
import React from 'react'; | ||
import { dataFieldClass } from '../styles.css'; | ||
import { Text } from './../../../components'; | ||
import type { ICompactTableFormatterProps } from './types'; | ||
|
||
export const FormatJsonParse = (): FC<ICompactTableFormatterProps> => { | ||
const Component: FC<ICompactTableFormatterProps> = ({ value }) => ( | ||
<Text variant="code" className={dataFieldClass}> | ||
{!!value && value?.length > 0 ? JSON.parse(value) : value} | ||
</Text> | ||
); | ||
export const FormatJsonParse = () => { | ||
const Component = ({ value }: ICompactTableFormatterProps) => { | ||
const valueString = typeof value === 'string' ? JSON.parse(value) : value; | ||
return ( | ||
<Text variant="code" className={dataFieldClass}> | ||
{!!value && value?.length > 0 ? JSON.parse(valueString) : value} | ||
</Text> | ||
); | ||
}; | ||
return Component; | ||
}; |
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
5 changes: 2 additions & 3 deletions
5
packages/libs/kode-ui/src/patterns/CompactTable/TableFormatters/FormatMultiStepTx.tsx
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
8 changes: 4 additions & 4 deletions
8
packages/libs/kode-ui/src/patterns/CompactTable/TableFormatters/FormatStatus.tsx
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,10 +1,10 @@ | ||
import { MonoCheck, MonoClear } from '@kadena/kode-icons/system'; | ||
import type { FC } from 'react'; | ||
import React from 'react'; | ||
import type { ICompactTableFormatterProps } from './types'; | ||
import { valueToString } from './utils'; | ||
|
||
export const FormatStatus = (): FC<ICompactTableFormatterProps> => { | ||
const Component: FC<ICompactTableFormatterProps> = ({ value }) => | ||
value ? <MonoCheck /> : <MonoClear />; | ||
export const FormatStatus = () => { | ||
const Component = ({ value }: ICompactTableFormatterProps) => | ||
valueToString(value) ? <MonoCheck /> : <MonoClear />; | ||
return Component; | ||
}; |
10 changes: 10 additions & 0 deletions
10
packages/libs/kode-ui/src/patterns/CompactTable/TableFormatters/utils.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,10 @@ | ||
export const valueToString = (value: string | string[]): string => { | ||
if (typeof value === 'object') { | ||
return value.reduce((acc, val) => { | ||
if (!val) return acc; | ||
return `${acc}${val} `; | ||
}, ''); | ||
} | ||
|
||
return value; | ||
}; |