-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mobile onboarding/connect-wallet screens (#107)
## Description Adjusted the onboarding screen to be mobile friendly. Adjusted the connect-wallet page to be mobile friendly including error toasts and kado pop up. Adjusted the privacy screen to be mobile friendly. Closes #110 ## Screenshots (if applicable) https://github.com/Kryha/KREAd/assets/54764628/f7f28943-f611-4eb1-b6c6-f33e0f33da1b ## Checklist Make sure all items are checked before submitting the pull request. Remove any items that are not applicable. - [x] The PR title is clear and concise. - [x] Are there changes in the /fronted folder? Make sure `cd frontend && yarn build` runs successfully.; --------- Co-authored-by: CARLOS TRIGO <[email protected]>
- Loading branch information
1 parent
17cbf2c
commit 09a7050
Showing
39 changed files
with
2,220 additions
and
26 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 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
76 changes: 76 additions & 0 deletions
76
frontend/src/components/base-route-mobile/base-route-mobile.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,76 @@ | ||
import React, { FC, useMemo } from "react"; | ||
|
||
import { text } from "../../assets"; | ||
import { routes } from "../../navigation"; | ||
import { Footer } from "../footer"; | ||
import { NavigationSection, NavigationTab } from "../navigation-tab"; | ||
import { Box, ChildrenContainer, FooterContainer, RightBox, TopbarContainer } from "./styles"; | ||
import { useCharacterBuilder } from "../../context/character-builder-context"; | ||
import { MAIN_MODE, Section } from "../../constants"; | ||
import { useLocation, useNavigate, useParams } from "react-router-dom"; | ||
import { SwitchSelector } from "../switch-selector"; | ||
import { KreadContainer } from "../../pages/shop/styles"; | ||
import { KreadIcon } from "../logo/styles"; | ||
import { ButtonText, PrimaryButton } from "../atoms"; | ||
import { color } from "../../design"; | ||
import { useKadoWidget } from "../../context/filter-context"; | ||
import styled from "@emotion/styled"; | ||
import { BuyCryptoButton } from "../base-route/base-route"; | ||
|
||
interface BaseRouteProps { | ||
sideNavigation: React.ReactNode; | ||
children?: React.ReactNode; | ||
onboarding?: boolean; | ||
isLanding?: boolean; | ||
isShop?: boolean; | ||
} | ||
|
||
export const BaseRouteMobile: FC<BaseRouteProps> = ({ children, sideNavigation, onboarding = false, isLanding = false, isShop = false }) => { | ||
const isOnboarding = onboarding ? routes.onboarding : routes.character; | ||
const { interactionMode } = useCharacterBuilder(); | ||
|
||
const { pathname } = useLocation(); | ||
const { section } = useParams<{ section: Section }>(); | ||
const navigate = useNavigate(); | ||
const home = () => { | ||
navigate(routes.character); | ||
}; | ||
|
||
const pageSelector = useMemo( | ||
() => ( | ||
<SwitchSelector | ||
buttonOneText={text.character.items} | ||
buttonTwoText={text.character.characters} | ||
selectedSection={section || "items"} | ||
path={pathname} | ||
/> | ||
), | ||
[section, pathname], | ||
); | ||
|
||
return ( | ||
<> | ||
{interactionMode === MAIN_MODE && ( | ||
<TopbarContainer isLanding={isLanding}> | ||
<Box> | ||
<NavigationSection route={isOnboarding}> | ||
<NavigationTab title={text.navigation.character} route={isOnboarding} /> | ||
</NavigationSection> | ||
</Box> | ||
<KreadContainer onClick={home}> | ||
<KreadIcon /> | ||
</KreadContainer> | ||
<RightBox> | ||
{isShop && <BuyCryptoButton />} | ||
{!isLanding && <>{pageSelector}</>} | ||
{sideNavigation} | ||
</RightBox> | ||
</TopbarContainer> | ||
)} | ||
<ChildrenContainer isLanding={isLanding}>{children}</ChildrenContainer> | ||
<FooterContainer isLanding={isLanding}> | ||
<Footer /> | ||
</FooterContainer> | ||
</> | ||
); | ||
}; |
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 "./base-route-mobile"; |
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,78 @@ | ||
import { css } from "@emotion/react"; | ||
import styled from "@emotion/styled"; | ||
import { breakpoints, color, margins, zIndex } from "../../design"; | ||
|
||
interface AnimationProps { | ||
isLanding: boolean; | ||
} | ||
|
||
export const NavBarDivider = styled.div` | ||
border: 0.5px solid ${color.grey}; | ||
transform: rotate(90deg); | ||
width: 41px; | ||
`; | ||
|
||
export const TopbarContainer = styled.header<AnimationProps>` | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: flex-end; | ||
z-index: 100; | ||
top: 0; | ||
margin-left: ${margins.medium}; | ||
margin-right: ${margins.medium}; | ||
padding-top: ${margins.medium}; | ||
padding-bottom: ${margins.medium}; | ||
background: transparent; | ||
@media screen and (max-width: ${breakpoints.tablet}) { | ||
padding: ${margins.mini}; | ||
} | ||
`; | ||
|
||
export const Box = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
padding: 0; | ||
z-index: 1; | ||
align-items: center; | ||
`; | ||
|
||
export const RightBox = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
padding: 0; | ||
z-index: 1; | ||
align-items: center; | ||
gap: 12px; | ||
`; | ||
|
||
export const ChildrenContainer = styled.div<AnimationProps>` | ||
display: flex; | ||
flex: 1; | ||
${({ isLanding }) => | ||
isLanding === true | ||
? css` | ||
margin-left: 0; | ||
margin-right: 0; | ||
` | ||
: css` | ||
margin-left: ${margins.medium}; | ||
margin-right: ${margins.medium}; | ||
`}; | ||
@media screen and (max-width: ${breakpoints.tablet}) { | ||
margin-left: 0; | ||
margin-right: 0; | ||
} | ||
`; | ||
|
||
export const FooterContainer = styled.div<AnimationProps>` | ||
display: flex; | ||
flex-direction: row; | ||
bottom: 0; | ||
align-items: center; | ||
justify-content: flex-end; | ||
width: 100%; | ||
background: transparent; | ||
z-index: ${zIndex.overCharacter}; | ||
`; |
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
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 "./onboarding-character-mobile"; |
51 changes: 51 additions & 0 deletions
51
frontend/src/components/onboarding-character-mobile/onboarding-character-mobile.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,51 @@ | ||
import { FC, useEffect, useState } from "react"; | ||
|
||
import { CharacterContainer, CharacterSwitchIcon, FifthIcon, FirstIcon, FourthIcon, ThirdIcon } from "./styles"; | ||
import { useViewport } from "../../hooks"; | ||
import { | ||
ArmaCitizen, | ||
ArmaPerk_I6, | ||
ArmaPerk_I7, | ||
ElephiaCitizen, | ||
Empty, | ||
Headpiece_Arma_3, | ||
Headpiece_Arma_5, | ||
Headpiece_Farma_4, | ||
Legendary_Garment_Arma_7, | ||
Mask_Elephia_24, | ||
Mask_Elephia_32, | ||
Mask_Mount_3, | ||
Rare_Garment_Arma_2, | ||
text, | ||
Uncommon_Garment_Arma_1, | ||
} from "../../assets"; | ||
import { zIndex } from "../../design"; | ||
|
||
const characterImages = [ArmaCitizen, ElephiaCitizen]; | ||
const headPieceImages = [Headpiece_Arma_3, Headpiece_Farma_4, Headpiece_Arma_5, Empty]; | ||
const perk1Images = [ArmaPerk_I6, ArmaPerk_I7, Empty]; | ||
const maskImages = [Mask_Mount_3, Mask_Elephia_24, Mask_Elephia_32]; | ||
const garmentImages = [Legendary_Garment_Arma_7, Rare_Garment_Arma_2, Uncommon_Garment_Arma_1]; | ||
|
||
export const OnboardingCharacterMobile: FC = () => { | ||
const { width, height } = useViewport(); | ||
const [currentIndex, setCurrentIndex] = useState(0); | ||
|
||
useEffect(() => { | ||
const intervalId = setInterval(() => { | ||
setCurrentIndex(Math.floor(Math.random() * 3.5)); | ||
}, 5000); | ||
|
||
return () => clearInterval(intervalId); | ||
}, []); | ||
|
||
return ( | ||
<CharacterContainer> | ||
<CharacterSwitchIcon src={characterImages[currentIndex] || ArmaCitizen} /> | ||
<FourthIcon src={perk1Images[currentIndex] || Empty} alt={text.character.perk1} width={width} height={height} zIndex={zIndex.perk1} /> | ||
<ThirdIcon src={headPieceImages[currentIndex] || Empty} alt={text.character.headPiece} zIndex={zIndex.headPiece} /> | ||
<FifthIcon src={maskImages[currentIndex] || Empty} alt={text.character.mask} width={width} height={height} zIndex={zIndex.mask} /> | ||
<FirstIcon src={garmentImages[currentIndex] || Empty} alt={text.character.garment} zIndex={zIndex.garment} /> | ||
</CharacterContainer> | ||
); | ||
}; |
Oops, something went wrong.