Skip to content

Commit

Permalink
add redirect to resources route
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian-Bright committed Oct 9, 2022
1 parent 890ba21 commit ef3892a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/Locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export const ActiveGameLocation = (id: string) => `/game/${id}`;
export const JoinGameLocationTemplate = '/join-game/:id';
export const JoinGameLocation = (id: string) => `/join-game/${id}`;
export const NewGameLocation = '/new-game';
export const ResourcesLocation = '/resources';
export const RootLocation = '/';
6 changes: 6 additions & 0 deletions src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import {
ActiveGameLocationTemplate,
JoinGameLocationTemplate,
NewGameLocation,
ResourcesLocation,
RootLocation
} from 'Locations';
import { Navigate, useRoutes } from 'react-router-dom';
import BuildBoard from 'views/BuildBoardView';
import Game from 'views/Game';
import Home from 'views/Home';
import Resources from 'views/Resources';

const routeList = (isConnected: boolean) => [
{
Expand All @@ -26,6 +28,10 @@ const routeList = (isConnected: boolean) => [
{
path: NewGameLocation,
element: isConnected ? <BuildBoard /> : <Navigate to={RootLocation} />
},
{
path: ResourcesLocation,
element: <Resources />
}
];

Expand Down
46 changes: 33 additions & 13 deletions src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ const useStyles = createUseStyles({
width: 'calc(100% - 108px)',
zIndex: 10
},
docs: {
cursor: 'pointer',
fontSize: '16px',
fontWeight: 600
},
left: {
alignItems: 'center',
display: 'flex',
Expand Down Expand Up @@ -45,6 +50,11 @@ const useStyles = createUseStyles({
letterSpacing: '5.4px',
lineHieght: '52px'
},
right: {
alignItems: 'center',
display: 'flex',
gap: '16px'
},
separator: {
background: '#D1D2DE',
height: '44px',
Expand All @@ -69,19 +79,29 @@ export default function Header(): JSX.Element {
<div className={styles.separator} />
<div className={styles.logoText}>BATTLEZIPS</div>
</div>
<div
className={styles.loginButton}
onClick={() =>
!isConnecting && (!isConnected ? connectWallet() : disconnect())
}
>
{address && <Avatar address={address} />}
<div>
{isConnected
? formatAddress(address, ensName)
: isConnecting
? 'Connecting...'
: 'Connect'}
<div className={styles.right}>
<div
className={styles.docs}
onClick={() =>
window.open('https://battlezips.gitbook.io/battlezips')
}
>
Docs
</div>
<div
className={styles.loginButton}
onClick={() =>
!isConnecting && (!isConnected ? connectWallet() : disconnect())
}
>
{address && <Avatar address={address} />}
<div>
{isConnected
? formatAddress(address, ensName)
: isConnecting
? 'Connecting...'
: 'Connect'}
</div>
</div>
</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions src/views/Resources/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { useEffect } from 'react';

export default function Resources() {
useEffect(() => {
window.location.href = 'https://battlezips.gitbook.io/battlezips';
}, []);
return <></>;
}

0 comments on commit ef3892a

Please sign in to comment.