-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add geo fence modal provider - add Dialog styles to theme WIP🚧 - move checkbox icons to theme lib - set default checkbox icons through theme
- Loading branch information
Showing
10 changed files
with
168 additions
and
10 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 was deleted.
Oops, something went wrong.
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
123 changes: 123 additions & 0 deletions
123
libs/shared/providers/src/geoFence/components/GeoFenceProvider.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,123 @@ | ||
import { useState } from 'react'; | ||
|
||
import { | ||
Button, | ||
Checkbox, | ||
Dialog, | ||
DialogActions, | ||
DialogContent, | ||
DialogContentText, | ||
DialogTitle, | ||
Divider, | ||
FormControlLabel, | ||
Stack, | ||
Typography, | ||
} from '@mui/material'; | ||
import { useLocalStorageValue } from '@react-hookz/web'; | ||
import { useIntl } from 'react-intl'; | ||
|
||
import type { ReactNode } from 'react'; | ||
|
||
export type GeoFenceProviderProps = { children: ReactNode }; | ||
|
||
export const GeoFenceProvider = ({ children }: GeoFenceProviderProps) => { | ||
const intl = useIntl(); | ||
const [checked, setChecked] = useState(false); | ||
const { value: geoCheck, set: setGeoCheck } = useLocalStorageValue( | ||
'@originprotocol/oeth-geo-check', | ||
{ | ||
defaultValue: false, | ||
}, | ||
); | ||
|
||
return ( | ||
<> | ||
{children} | ||
<Dialog open={!geoCheck} maxWidth="sm"> | ||
<DialogTitle> | ||
{intl.formatMessage({ defaultMessage: 'Restricted Access' })} | ||
</DialogTitle> | ||
<Divider /> | ||
<DialogContent> | ||
<DialogContentText> | ||
{intl.formatMessage({ | ||
defaultMessage: `The Origin Ether dapp is not available to restricted jurisdictions. Before proceeding, please carefully read the following:`, | ||
})} | ||
</DialogContentText> | ||
<Stack | ||
component="ul" | ||
sx={{ | ||
backgroundColor: 'grey.800', | ||
my: 3, | ||
pl: 5, | ||
pr: 3, | ||
py: 3, | ||
borderRadius: 1, | ||
}} | ||
spacing={3} | ||
> | ||
<Typography component="li" variant="body2"> | ||
{intl.formatMessage({ | ||
defaultMessage: `You confirm that you are not a resident of, citizen of, located in, incorporated in, or have a registered office in the United States or any country or region currently currently subject to sanctions by the United States.`, | ||
})} | ||
</Typography> | ||
<Typography component="li" variant="body2"> | ||
{intl.formatMessage({ | ||
defaultMessage: `You affirm that you are not a subject of economic or trade sanctions administered or enforced by any governmental authority or otherwise designated on any list of prohibited or restricted parties, including the list maintained by the Office of Foreign Assets Control of the U.S. Department of the Treasury.`, | ||
})} | ||
</Typography> | ||
<Typography component="li" variant="body2"> | ||
{intl.formatMessage({ | ||
defaultMessage: `You agree not to use any VPN or other privacy or anonymization tools or techniques to attempt to circumvent these eligibility restrictions.`, | ||
})} | ||
</Typography> | ||
<Typography component="li" variant="body2"> | ||
{intl.formatMessage({ | ||
defaultMessage: `You are lawfully permitted to access this site. You understand and accept the risks associated with using Origin Ether.`, | ||
})} | ||
</Typography> | ||
</Stack> | ||
<FormControlLabel | ||
label={intl.formatMessage({ | ||
defaultMessage: 'I have read and agree to the above terms', | ||
})} | ||
onChange={(_, val) => { | ||
setChecked(val); | ||
}} | ||
control={<Checkbox checked={checked} />} | ||
sx={{ pl: 0.2 }} | ||
/> | ||
</DialogContent> | ||
<DialogActions sx={{ gap: 3, px: 3, pb: 3 }}> | ||
<Button | ||
href="https://oeth.com" | ||
variant="action" | ||
fullWidth | ||
sx={{ | ||
fontSize: 16, | ||
borderRadius: 8, | ||
padding: 1, | ||
}} | ||
> | ||
{intl.formatMessage({ defaultMessage: 'Exit' })} | ||
</Button> | ||
<Button | ||
disabled={!checked} | ||
variant="action" | ||
fullWidth | ||
onClick={() => { | ||
setGeoCheck(true); | ||
}} | ||
sx={{ | ||
fontSize: 16, | ||
borderRadius: 8, | ||
padding: 1, | ||
}} | ||
> | ||
{intl.formatMessage({ defaultMessage: 'I agree' })} | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
</> | ||
); | ||
}; |
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 './components/GeoFenceProvider'; |
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,6 +1,7 @@ | ||
export * from './chart'; | ||
export * from './curve'; | ||
export * from './gas'; | ||
export * from './geoFence'; | ||
export * from './notifications'; | ||
export * from './prices'; | ||
export * from './wagmi'; |
File renamed without changes.
File renamed without changes.
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