-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: disable builds and fix ts error
- Loading branch information
Showing
3 changed files
with
146 additions
and
2 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
144 changes: 144 additions & 0 deletions
144
apps/web-nomic/src/screens/account_details/components/overview/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
import Box from '@/components/box'; | ||
import { useWindowOrigin } from '@/hooks/use_window'; | ||
import { useOverview } from '@/screens/account_details/components/overview/hooks'; | ||
import useStyles from '@/screens/account_details/components/overview/styles'; | ||
import { useDisplayStyles } from '@/styles/useSharedStyles'; | ||
import { getMiddleEllipsis } from '@/utils/get_middle_ellipsis'; | ||
import Dialog from '@mui/material/Dialog'; | ||
import Typography from '@mui/material/Typography'; | ||
import useAppTranslation from '@/hooks/useAppTranslation'; | ||
import { QRCodeSVG } from 'qrcode.react'; | ||
import { FC } from 'react'; | ||
import { | ||
EmailIcon, | ||
EmailShareButton, | ||
FacebookIcon, | ||
FacebookShareButton, | ||
TelegramIcon, | ||
TelegramShareButton, | ||
TwitterIcon, | ||
TwitterShareButton, | ||
WhatsappIcon, | ||
WhatsappShareButton, | ||
} from 'react-share'; | ||
import CopyIcon from 'shared-utils/assets/icon-copy.svg'; | ||
import ShareIcon from 'shared-utils/assets/icon-share.svg'; | ||
import { useAccountDetails } from '@/screens/account_details/hooks'; | ||
|
||
type OverviewProps = { | ||
className?: string; | ||
}; | ||
|
||
const Overview: FC<OverviewProps> = ({ className }) => { | ||
const { location } = useWindowOrigin(); | ||
const { classes, cx } = useStyles(); | ||
const display = useDisplayStyles().classes; | ||
const { t } = useAppTranslation('accounts'); | ||
const { open, handleClose, handleOpen, handleCopyToClipboard } = useOverview(t); | ||
const { state } = useAccountDetails() || {}; | ||
const { address, withdrawalAddress } = state?.overview || {}; | ||
|
||
const url = `${location}/accounts/${address}`; | ||
const hashTags = ['bigdipperexplorer', 'bigdipper']; | ||
return ( | ||
<> | ||
<Dialog maxWidth="xl" onClose={handleClose} aria-labelledby="simple-dialog-title" open={open}> | ||
<Box className={classes.dialog}> | ||
<Typography variant="body1" align="center"> | ||
{t('scanForAddress')} | ||
</Typography> | ||
<QRCodeSVG value={address} size={200} bgColor="#ffffff" fgColor="#000000" /> | ||
<div className="dialog__share--wrapper"> | ||
<Typography variant="body1">{t('shareTo')}</Typography> | ||
<div className={classes.icons}> | ||
<FacebookShareButton | ||
url={url} | ||
quote={address} | ||
hashtag={hashTags[0]} | ||
className="share-buttons" | ||
> | ||
<FacebookIcon round /> | ||
</FacebookShareButton> | ||
<TwitterShareButton | ||
url={url} | ||
title={address} | ||
hashtags={hashTags} | ||
className="share-buttons" | ||
> | ||
<TwitterIcon round /> | ||
</TwitterShareButton> | ||
|
||
<TelegramShareButton url={url} title={address} className="share-buttons"> | ||
<TelegramIcon round /> | ||
</TelegramShareButton> | ||
|
||
<WhatsappShareButton | ||
url={url} | ||
title={address} | ||
separator=":: " | ||
className="share-buttons" | ||
> | ||
<WhatsappIcon round /> | ||
</WhatsappShareButton> | ||
<EmailShareButton | ||
url={url} | ||
subject="address" | ||
body={address} | ||
separator=":: " | ||
className="share-buttons email" | ||
> | ||
<EmailIcon round /> | ||
</EmailShareButton> | ||
</div> | ||
</div> | ||
</Box> | ||
</Dialog> | ||
<Box className={cx(classes.root, className)}> | ||
<div className={cx(classes.copyText, classes.item)}> | ||
<Typography variant="body1" className="label"> | ||
{t('address')} | ||
</Typography> | ||
<div className="detail"> | ||
<CopyIcon | ||
onClick={() => handleCopyToClipboard(address)} | ||
className={classes.actionIcons} | ||
/> | ||
<ShareIcon onClick={handleOpen} className={classes.actionIcons} /> | ||
<Typography variant="body1" className="value"> | ||
<span className={display.hiddenUntilLg}>{address}</span> | ||
<span className={display.hiddenWhenLg}> | ||
{getMiddleEllipsis(address, { | ||
beginning: 15, | ||
ending: 5, | ||
})} | ||
</span> | ||
</Typography> | ||
</div> | ||
</div> | ||
|
||
<div className={cx(classes.copyText, classes.item)}> | ||
<Typography variant="body1" className="label"> | ||
{t('rewardAddress')} | ||
</Typography> | ||
<div className="detail"> | ||
<CopyIcon | ||
className={classes.actionIcons} | ||
onClick={() => handleCopyToClipboard(withdrawalAddress)} | ||
/> | ||
<Typography variant="body1" className="value"> | ||
<span className={display.hiddenUntilLg}>{withdrawalAddress}</span> | ||
<span className={display.hiddenWhenLg}> | ||
{getMiddleEllipsis(withdrawalAddress, { | ||
beginning: 15, | ||
ending: 5, | ||
})} | ||
</span> | ||
</Typography> | ||
</div> | ||
</div> | ||
</Box> | ||
</> | ||
); | ||
}; | ||
|
||
export default Overview; |
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