Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mobile guard view #100

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions apps/warp-protocol/src/components/layout/Layout.module.sass
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,34 @@
height: 20px !important
path
fill: rgba(215, 224, 223, 1) !important

.mobile_background_warp
height: 320px

.mobile_warning
position: relative
padding: 20px
height: 100%
width: 100%
display: flex
justify-content: space-between
align-items: center
flex-direction: column

.logo
align-self: flex-start
font-size: 24px
color: #DFE2E1
font-weight: 600
text-transform: lowercase

.center
position: absolute
top: calc(50% - 100px)
display: flex
flex-direction: column
justify-content: center
align-items: center

.warning_label
margin-top: 10px
51 changes: 37 additions & 14 deletions apps/warp-protocol/src/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,53 @@ import { Text } from 'components/primitives';
import { useChainSelector } from '@terra-money/apps/hooks';
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import { useChainSelectorDialog } from 'components/dialog/chain-selector/ChainSelectorDialog';
import { useMediaQuery } from 'usehooks-ts';

interface LayoutProps extends PropsWithChildren {}

const MobileWarning = () => (
<div className={styles.mobile_warning}>
<div className={styles.logo}>warp.</div>
<div className={styles.center}>
<Text variant="text" className={styles.warning_text}>
Mobile Layout Not Supported
</Text>
<Text variant="label" className={styles.warning_label}>
Please visit from a desktop to access the app.
</Text>
</div>

<img alt="" src="images/BackgroundBigBall.png" className={styles.mobile_background_warp} />
</div>
);

export const Layout = ({ children }: LayoutProps) => {
const { selectedChain } = useChainSelector();
const openChainSelectorDialog = useChainSelectorDialog();

const isMobile = useMediaQuery('(max-width: 768px)');

return (
<div className={styles.root}>
<>
<BackgroundWrap className={styles.background_wrap} />
<Text variant="label" className={styles.protocol_name}>
Warp protocol
</Text>
<div className={styles.chain_selector} onClick={() => openChainSelectorDialog({})}>
<div className={styles.chain_icon}>{selectedChain.icon}</div>
<Text variant="text" className={styles.chain_text}>
{selectedChain.name}
{isMobile ? (
<MobileWarning />
) : (
<>
<BackgroundWrap className={styles.background_wrap} />
<Text variant="label" className={styles.protocol_name}>
Warp protocol
</Text>
<KeyboardArrowDownIcon className={styles.chevron} />
</div>
</>
<Sidebar className={styles.sidebar} />
<div className={styles.content}>{children}</div>
<div className={styles.chain_selector} onClick={() => openChainSelectorDialog({})}>
<div className={styles.chain_icon}>{selectedChain.icon}</div>
<Text variant="text" className={styles.chain_text}>
{selectedChain.name}
</Text>
<KeyboardArrowDownIcon className={styles.chevron} />
</div>
<Sidebar className={styles.sidebar} />
<div className={styles.content}>{children}</div>
</>
)}
</div>
);
};
Loading