-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [lw-12362] view cbor in dapp confirmation (#1747)
- Loading branch information
Showing
9 changed files
with
128 additions
and
6 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
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
22 changes: 22 additions & 0 deletions
22
.../core/src/ui/components/ActivityDetail/components/TxDetailsCBOR/TxDetailsCBOR.module.scss
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,22 @@ | ||
@import '../../../../styles/theme.scss'; | ||
@import '../../../../../../../common/src/ui/styles/abstracts/typography'; | ||
|
||
.cbor { | ||
word-break: break-all; | ||
width: 100%; | ||
display: -webkit-box; | ||
-webkit-box-orient: vertical; | ||
line-clamp: 3; | ||
-webkit-line-clamp: 3; | ||
overflow: hidden; | ||
} | ||
|
||
.copyButton { | ||
color: var(--dark-mode-mid-grey, var(--light-mode-light-grey)); | ||
font-size: 26px; | ||
cursor: pointer; | ||
opacity: .5; | ||
&:hover { | ||
opacity: 1; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
packages/core/src/ui/components/ActivityDetail/components/TxDetailsCBOR/TxDetailsCBOR.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { useCallback } from 'react'; | ||
import { TxDetailsGroup } from '../../TxDetailsGroup'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Flex, Text } from '@input-output-hk/lace-ui-toolkit'; | ||
import { ReactComponent as CopyIcon } from '../../../../assets/icons/copy-icon.svg'; | ||
import styles from './TxDetailsCBOR.module.scss'; | ||
import CopyToClipboard from 'react-copy-to-clipboard'; | ||
import { toast } from '@lace/common'; | ||
|
||
interface TxDetailsCBORProps { | ||
cbor: string; | ||
} | ||
|
||
export const TxDetailsCBOR = ({ cbor }: TxDetailsCBORProps): React.ReactElement => { | ||
const { t } = useTranslation(); | ||
|
||
const doToast = useCallback(() => { | ||
toast.notify({ | ||
text: t('core.addressCard.handle.copy.notification'), | ||
icon: CopyIcon | ||
}); | ||
}, [t]); | ||
|
||
return ( | ||
<TxDetailsGroup title={t('core.activityDetails.CBOR')} testId="cbor-detail" withSeparatorLine> | ||
<Flex flexDirection="column" gap="$20"> | ||
<Flex w="$fill" justifyContent="flex-end"> | ||
<CopyToClipboard text={cbor}> | ||
<CopyIcon className={styles.copyButton} data-testid="copy-address-btn" onClick={doToast} /> | ||
</CopyToClipboard> | ||
</Flex> | ||
<Text.Body.Normal data-testid="cbor" className={styles.cbor} weight="$medium"> | ||
{cbor} | ||
</Text.Body.Normal> | ||
</Flex> | ||
</TxDetailsGroup> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
packages/core/src/ui/components/ActivityDetail/components/index.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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './TxDetailsCertificates/TxDetailsCertificates'; | ||
export * from './TxDetailsCBOR/TxDetailsCBOR'; | ||
export * from './TxDetailsProposalProcedures'; | ||
export * from './TxDetailsVotingProcedures'; |
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