-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui+home: add home screen with connect buttons
- Loading branch information
Showing
9 changed files
with
224 additions
and
19 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import React, { useCallback, useState } from 'react'; | ||
import { observer } from 'mobx-react-lite'; | ||
import styled from '@emotion/styled'; | ||
import DashUX from 'assets/images/home_dash_ss.png'; | ||
import LoopUX from 'assets/images/home_loop_ss.png'; | ||
import { ReactComponent as Youtube } from 'assets/images/youtube.svg'; | ||
import { usePrefixedTranslation } from 'hooks'; | ||
import { useStore } from 'store'; | ||
import { | ||
BoltOutlined, | ||
Button, | ||
Column, | ||
Display, | ||
Paragraph, | ||
QRCode, | ||
Row, | ||
} from 'components/base'; | ||
import PurpleButton from 'components/connect/PurpleButton'; | ||
import QRCodeModal from 'components/connect/QRCodeModal'; | ||
import YoutubeModal from './YoutubeModal'; | ||
|
||
const Styled = { | ||
Wrapper: styled.div` | ||
padding: 72px 0; | ||
`, | ||
PurpleButton: styled(PurpleButton)` | ||
font-size: ${props => props.theme.sizes.s}; | ||
line-height: 24px; | ||
padding: 8px 16px; | ||
margin-right: 24px; | ||
`, | ||
YoutubeButton: styled(Button)` | ||
font-family: ${props => props.theme.fonts.open.semiBold}; | ||
padding-left: 0; | ||
svg { | ||
margin-right: 16px; | ||
} | ||
`, | ||
Image: styled.img` | ||
width: 100%; | ||
margin-bottom: 24px; | ||
`, | ||
}; | ||
|
||
const HomePage: React.FC = () => { | ||
const { l } = usePrefixedTranslation('cmps.home.HomePage'); | ||
const [showQR, setShowQR] = useState(false); | ||
const [showVideo, setShowVideo] = useState(false); | ||
const { sessionStore } = useStore(); | ||
|
||
const toggleQRModal = useCallback(() => setShowQR(v => !v), []); | ||
const toggleVideoModal = useCallback(() => setShowVideo(v => !v), []); | ||
|
||
const { Wrapper, PurpleButton, YoutubeButton, Image } = Styled; | ||
return ( | ||
<Wrapper> | ||
<Display semiBold space={16}> | ||
{l('pageTitle')} | ||
</Display> | ||
<Paragraph space={32}>{l('connectDesc')}</Paragraph> | ||
<Paragraph space={40}> | ||
<a href={sessionStore.firstSessionTerminalUrl} target="_blank" rel="noreferrer"> | ||
<PurpleButton> | ||
<BoltOutlined /> | ||
{l('connectTerminalBtn')} | ||
</PurpleButton> | ||
</a> | ||
<PurpleButton secondary onClick={toggleQRModal}> | ||
<QRCode /> | ||
{l('connectQrBtn')} | ||
</PurpleButton> | ||
</Paragraph> | ||
<Paragraph space={32}>{l('learnDesc')}</Paragraph> | ||
<Paragraph space={40}> | ||
<YoutubeButton ghost borderless compact onClick={toggleVideoModal}> | ||
<Youtube /> | ||
Learn More | ||
</YoutubeButton> | ||
</Paragraph> | ||
<Display semiBold space={16}> | ||
{l('whatsDiff')} | ||
</Display> | ||
<Paragraph space={24}>{l('diffDesc')}</Paragraph> | ||
<Row> | ||
<Column> | ||
<Image src={LoopUX} alt={l('loopTitle')} /> | ||
<Paragraph semiBold space={8}> | ||
{l('loopTitle')} | ||
</Paragraph> | ||
<Paragraph muted>{l('loopDesc')}</Paragraph> | ||
</Column> | ||
<Column> | ||
<Image src={DashUX} alt={l('dashTitle')} /> | ||
<Paragraph semiBold space={8}> | ||
{l('dashTitle')} | ||
</Paragraph> | ||
<Paragraph muted>{l('dashDesc')}</Paragraph> | ||
</Column> | ||
</Row> | ||
<QRCodeModal | ||
url={sessionStore.firstSessionTerminalUrl} | ||
visible={showQR} | ||
onClose={toggleQRModal} | ||
/> | ||
<YoutubeModal | ||
videoId="5kH1ByxjkTM" | ||
visible={showVideo} | ||
onClose={toggleVideoModal} | ||
/> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
export default observer(HomePage); |
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,53 @@ | ||
import React from 'react'; | ||
import styled from '@emotion/styled'; | ||
import { usePrefixedTranslation } from 'hooks'; | ||
import Modal from 'components/common/Modal'; | ||
|
||
const Styled = { | ||
VideoModal: styled(Modal)` | ||
width: 800px; | ||
max-width: 90%; | ||
overflow: hidden; | ||
`, | ||
VideoWrap: styled.div` | ||
position: relative; | ||
padding-bottom: 56.25%; /* 16:9 */ | ||
height: 0; | ||
> iframe { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
`, | ||
}; | ||
|
||
interface Props { | ||
videoId: string; | ||
visible: boolean; | ||
onClose: () => void; | ||
} | ||
|
||
const YoutubeModal: React.FC<Props> = ({ videoId, visible, onClose }) => { | ||
const { l } = usePrefixedTranslation('cmps.home.YoutubeModal'); | ||
const { VideoModal, VideoWrap } = Styled; | ||
return ( | ||
<VideoModal title={l('title')} visible={visible} onClose={onClose}> | ||
<VideoWrap> | ||
<iframe | ||
width="568" | ||
height="315" | ||
src={`https://www.youtube.com/embed/${videoId}`} | ||
title="YouTube video player" | ||
frameBorder="0" | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" | ||
allowFullScreen | ||
></iframe> | ||
</VideoWrap> | ||
</VideoModal> | ||
); | ||
}; | ||
|
||
export default YoutubeModal; |
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