-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WAITP-1201 Top bar * WAITP-1201 Add map layout part 1 * WAITP-1201 Map layout part 2 * WAITP-1201 Update map layout * WAITP-1202 Update map layout and add context for sidebar * WAITP-1201 add types for context * WAITP-1201 fix types * WAITP-1201 add comments * WAITP-1201 AuthModal layout * WAITP-1201 update menus * WAITP-1201 Add buttons to auth modal * WAITP-1201 Set user views as auth modals * WAITP-1201 Update comments and folder structure * WAITP-1201 Add stories * WAITP-1201 remove storybook-react-router * WAITP-1201 tweaks * WAITP-1201 remove theme variables * WAITP-1201 remove dropdown and stories * WAITP-1201 move mapdiv * WAITP-1201 remove extra height line * WAITP-1201 keep padding in close button * Update packages/tupaia-web/src/layout/Sidebar/Sidebar.tsx Co-authored-by: Tom Caiger <caigertom@gmail.com> * Update min-width Co-authored-by: Tom Caiger <caigertom@gmail.com> --------- Co-authored-by: Tom Caiger <caigertom@gmail.com>
- Loading branch information
Showing
46 changed files
with
1,200 additions
and
302 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { useEffect } from 'react'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { BrowserRouter, useLocation } from 'react-router-dom'; | ||
import { Args } from '@storybook/react'; | ||
import { DecoratorFunction } from '@storybook/csf'; | ||
|
||
const LocationChangeAction = ({ children }) => { | ||
const location = useLocation(); | ||
|
||
useEffect(() => { | ||
if (location.key !== 'default') action('React Router Location Change')(location); | ||
}, [location]); | ||
|
||
return <>{children}</>; | ||
}; | ||
|
||
const ReactRouterDecorator: DecoratorFunction<any, Args> = (Story, context) => { | ||
return ( | ||
<BrowserRouter> | ||
<LocationChangeAction> | ||
<Story {...context} /> | ||
</LocationChangeAction> | ||
</BrowserRouter> | ||
); | ||
}; | ||
|
||
export default ReactRouterDecorator; |
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
Loading
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import React from 'react'; | ||
import { Navigate, Route, Routes as RouterRoutes } from 'react-router-dom'; | ||
import { | ||
LandingPage, | ||
LoginForm, | ||
PasswordResetForm, | ||
Project, | ||
RegisterForm, | ||
RequestAccessForm, | ||
VerifyEmailForm, | ||
} from './pages'; | ||
import { DEFAULT_URL } from './constants'; | ||
|
||
/** | ||
* This Router is using [version 6.3]{@link https://reactrouter.com/en/v6.3.0}, as later versions are not supported by our TS setup. See [this issue here]{@link https://github.com/remix-run/react-router/discussions/8364} | ||
* This means the newer 'createBrowserRouter' and 'RouterProvider' can't be used here. | ||
* | ||
* **/ | ||
|
||
export const Routes = () => ( | ||
<RouterRoutes> | ||
<Route path="/" element={<Navigate to={`/${DEFAULT_URL}`} replace />} /> | ||
<Route path="login" element={<LoginForm />} /> | ||
<Route path="register" element={<RegisterForm />} /> | ||
<Route path="reset-password" element={<PasswordResetForm />} /> | ||
<Route path="request-access" element={<RequestAccessForm />} /> | ||
<Route path="verify-email" element={<VerifyEmailForm />} /> | ||
<Route path="/:landingPageUrlSegment" element={<LandingPage />} /> | ||
{/** Because react-router v 6.3 doesn't support optional url segments, we need to handle dashboardCode with a splat/catch-all instead */} | ||
<Route path="/:projectCode/:entityCode/*" element={<Project />} /> | ||
</RouterRoutes> | ||
); |
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,61 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import React, { ReactNode } from 'react'; | ||
import { Dialog, Paper as MuiPaper, useTheme, useMediaQuery } from '@material-ui/core'; | ||
import MuiCloseIcon from '@material-ui/icons/Close'; | ||
import styled from 'styled-components'; | ||
import { IconButton } from '@tupaia/ui-components'; | ||
|
||
interface ModalProps { | ||
children?: ReactNode; | ||
onClose: () => void; | ||
isOpen: boolean; | ||
} | ||
|
||
const Wrapper = styled.div` | ||
text-align: center; | ||
overflow-x: hidden; | ||
padding: 2em; | ||
`; | ||
|
||
const CloseIcon = styled(MuiCloseIcon)` | ||
width: 1.2em; | ||
height: 1.2em; | ||
`; | ||
|
||
const CloseButton = styled(IconButton)` | ||
background-color: transparent; | ||
min-width: initial; | ||
position: absolute; | ||
top: 0.6em; | ||
right: 0.6em; | ||
`; | ||
|
||
const Paper = styled(MuiPaper)` | ||
background-color: ${({ theme }) => theme.palette.background.default}; | ||
padding: 0; | ||
color: rgba(255, 255, 255, 0.9); | ||
overflow-y: auto; | ||
max-width: 920px; | ||
min-width: 300px; | ||
// Prevent width from animating. | ||
transition: transform 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms; | ||
`; | ||
|
||
export const Modal = ({ children, isOpen, onClose }: ModalProps) => { | ||
// make the modal full screen at small screen sizes | ||
const theme = useTheme(); | ||
const fullScreen = useMediaQuery(theme.breakpoints.down('xs')); | ||
return ( | ||
<Dialog open={isOpen} onClose={onClose} PaperComponent={Paper} fullScreen={fullScreen}> | ||
<Wrapper id="overlay-wrapper"> | ||
<CloseButton onClick={onClose} color="default"> | ||
<CloseIcon /> | ||
</CloseButton> | ||
{children} | ||
</Wrapper> | ||
</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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
export { Modal } from './Modal'; |
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,5 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2021 Beyond Essential Systems Pty Ltd | ||
*/ | ||
export const TRANSPARENT_BLACK = 'rgba(43, 45, 56, 0.94)'; |
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
Oops, something went wrong.