-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #298 from Gateway-DAO/release/dec-7
Release - December 7th (Prod)
- Loading branch information
Showing
25 changed files
with
1,182 additions
and
1,035 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { PropsWithChildren } from 'react'; | ||
|
||
import { MotionBox } from '@gateway/ui'; | ||
|
||
export const AnimatedMessage = ({ children }: PropsWithChildren<unknown>) => ( | ||
<MotionBox | ||
initial={{ opacity: 0, x: -100 }} | ||
animate={{ opacity: 1, x: 0 }} | ||
exit={{ opacity: 0, x: 100 }} | ||
transition={{ ease: 'easeInOut' }} | ||
sx={{ | ||
position: 'absolute', | ||
textAlign: 'center', | ||
width: '100%', | ||
}} | ||
> | ||
{' '} | ||
{children} | ||
</MotionBox> | ||
); |
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,108 @@ | ||
import useTranslation from 'next-translate/useTranslation'; | ||
import { useEffect } from 'react'; | ||
|
||
import { useSnackbar } from 'notistack'; | ||
import { useCopyToClipboard } from 'react-use'; | ||
|
||
import { | ||
Reddit, | ||
Twitter, | ||
Facebook, | ||
Link as LinkIcon, | ||
} from '@mui/icons-material'; | ||
import { ListItemIcon, ListItemText, Menu, MenuItem } from '@mui/material'; | ||
|
||
import objectToParams from '../../utils/map-object'; | ||
|
||
type Props = { | ||
title?: string; | ||
url?: string; | ||
menu: { | ||
element: HTMLElement; | ||
isOpen: boolean; | ||
onOpen: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void; | ||
onClose: () => void; | ||
withOnClose: (cb: () => void) => () => void; | ||
}; | ||
}; | ||
|
||
type SocialProps = { | ||
title?: string; | ||
url?: string; | ||
}; | ||
|
||
const tweetLink = (props: SocialProps) => | ||
`https://twitter.com/intent/tweet${objectToParams({ | ||
text: props.title, | ||
url: props.url, | ||
})}`; | ||
|
||
const redditLink = (props: SocialProps) => | ||
`https://reddit.com/submit${objectToParams(props)}`; | ||
|
||
const facebookLink = (props: SocialProps) => | ||
`https://www.facebook.com/sharer/sharer.php${objectToParams({ | ||
u: props.url, | ||
quote: props.title, | ||
})}`; | ||
|
||
export function ShareButtonFn({ | ||
title = 'Gateway', | ||
url = typeof window !== 'undefined' ? window.location.href : '', | ||
menu, | ||
}: Props) { | ||
const { enqueueSnackbar } = useSnackbar(); | ||
const [state, copyToClipboard] = useCopyToClipboard(); | ||
const data = { title, url }; | ||
const { t } = useTranslation('common'); | ||
const onShare = () => { | ||
try { | ||
if (navigator?.share && navigator.canShare(data)) { | ||
navigator.share(data); | ||
} else { | ||
copyToClipboard(data.url); | ||
} | ||
} catch (e) { | ||
console.error(e); | ||
} finally { | ||
menu.onClose(); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
if (state?.value) { | ||
enqueueSnackbar('Copied link!'); | ||
} | ||
}, [state]); | ||
|
||
return ( | ||
<> | ||
<Menu anchorEl={menu.element} open={menu.isOpen} onClose={menu.onClose}> | ||
<MenuItem component="a" href={tweetLink(data)} target="_blank"> | ||
<ListItemIcon> | ||
<Twitter /> | ||
</ListItemIcon> | ||
<ListItemText>Twitter</ListItemText> | ||
</MenuItem> | ||
<MenuItem component="a" href={facebookLink(data)} target="_blank"> | ||
<ListItemIcon> | ||
<Facebook /> | ||
</ListItemIcon> | ||
<ListItemText>Facebook</ListItemText> | ||
</MenuItem> | ||
<MenuItem component="a" href={redditLink(data)} target="_blank"> | ||
<ListItemIcon> | ||
<Reddit /> | ||
</ListItemIcon> | ||
<ListItemText>Reddit</ListItemText> | ||
</MenuItem> | ||
<MenuItem onClick={onShare}> | ||
<ListItemIcon> | ||
<LinkIcon /> | ||
</ListItemIcon> | ||
<ListItemText>{t('actions.share-link')}</ListItemText> | ||
</MenuItem> | ||
</Menu> | ||
</> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './mint-dialog'; |
Oops, something went wrong.
211f43a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
gateway-website – ./
gateway-website-gateway-dao.vercel.app
gateway-website-git-main-gateway-dao.vercel.app
mygateway.xyz
www.mygateway.xyz