-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Queue): add share block to transaction details (#4838)
* feat(Queue): add share block to transaction details * fix(Queue): use different event for share block * fix(Queue): rename owners to signers * feat(Queue): add event to track expanding block * fix(Queue): change handler property * fix(Queue): use same event with label
- Loading branch information
Showing
7 changed files
with
119 additions
and
12 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
43 changes: 43 additions & 0 deletions
43
apps/web/src/components/transactions/TxShareLink/TxShareBlock.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,43 @@ | ||
import { Accordion, AccordionDetails, AccordionSummary, Button, Paper, SvgIcon, Typography } from '@mui/material' | ||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore' | ||
import type { ReactElement } from 'react' | ||
|
||
import ShareIcon from '@/public/images/messages/link.svg' | ||
import { trackEvent, TX_LIST_EVENTS } from '@/services/analytics' | ||
import TxShareLink from '.' | ||
|
||
import css from './styles.module.css' | ||
|
||
export function TxShareBlock({ txId }: { txId: string }): ReactElement | null { | ||
const onExpand = (_: React.SyntheticEvent, expanded: boolean) => { | ||
if (expanded) { | ||
trackEvent(TX_LIST_EVENTS.OPEN_SHARE_BLOCK) | ||
} | ||
} | ||
|
||
return ( | ||
<Paper className={css.wrapper}> | ||
<Accordion className={css.accordion} onChange={onExpand}> | ||
<AccordionSummary expandIcon={<ExpandMoreIcon />} className={css.summary}> | ||
<Typography className={css.header}>Share link with other signers</Typography> | ||
</AccordionSummary> | ||
<AccordionDetails className={css.details}> | ||
If signers have previously subscribed to notifications, they will be notified about signing this transaction. | ||
You can also share the link with them to speed up the process. | ||
</AccordionDetails> | ||
</Accordion> | ||
<div className={css.copy}> | ||
<TxShareLink id={txId} eventLabel="share-block"> | ||
<Button | ||
variant="outlined" | ||
size="compact" | ||
startIcon={<SvgIcon component={ShareIcon} inheritViewBox fontSize="small" className={css.icon} />} | ||
className={css.button} | ||
> | ||
Copy link | ||
</Button> | ||
</TxShareLink> | ||
</div> | ||
</Paper> | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
apps/web/src/components/transactions/TxShareLink/TxShareButton.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,16 @@ | ||
import { IconButton, Link, SvgIcon } from '@mui/material' | ||
import React from 'react' | ||
import type { ReactElement } from 'react' | ||
|
||
import ShareIcon from '@/public/images/common/share.svg' | ||
import TxShareLink from '.' | ||
|
||
export function TxShareButton({ txId }: { txId: string }): ReactElement { | ||
return ( | ||
<TxShareLink id={txId} eventLabel="button"> | ||
<IconButton data-testid="share-btn" component={Link} aria-label="Share"> | ||
<SvgIcon component={ShareIcon} inheritViewBox fontSize="small" color="border" /> | ||
</IconButton> | ||
</TxShareLink> | ||
) | ||
} |
20 changes: 12 additions & 8 deletions
20
apps/web/src/components/transactions/TxShareLink/index.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
37 changes: 37 additions & 0 deletions
37
apps/web/src/components/transactions/TxShareLink/styles.module.css
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,37 @@ | ||
.wrapper { | ||
border: 1px solid var(--color-border-light); | ||
margin-top: var(--space-2); | ||
} | ||
|
||
.accordion { | ||
border: unset; | ||
} | ||
|
||
.summary { | ||
background: unset !important; | ||
} | ||
|
||
.header { | ||
font-weight: 700; | ||
} | ||
|
||
.details { | ||
padding-top: 0; | ||
padding-bottom: 12px; | ||
} | ||
|
||
.copy { | ||
padding: var(--space-2); | ||
padding-top: 4px; | ||
} | ||
|
||
.icon { | ||
margin-right: 4px; | ||
} | ||
|
||
.button { | ||
padding-top: 4px; | ||
padding-bottom: 4px; | ||
padding-left: var(--space-2); | ||
padding-right: var(--space-2); | ||
} |
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