-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol-designer): create redesign ff and scaffolding for new n…
- Loading branch information
Showing
33 changed files
with
431 additions
and
78 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
8 changes: 1 addition & 7 deletions
8
protocol-designer/src/components/App.tsx → protocol-designer/src/App.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 |
---|---|---|
@@ -1,12 +1,6 @@ | ||
import * as React from 'react' | ||
import { ProtocolEditor } from './ProtocolEditor' | ||
|
||
import '../css/reset.module.css' | ||
|
||
export function App(): JSX.Element { | ||
return ( | ||
<div className="container"> | ||
<ProtocolEditor /> | ||
</div> | ||
) | ||
return <ProtocolEditor /> | ||
} |
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,62 @@ | ||
import * as React from 'react' | ||
import { NavLink } from 'react-router-dom' | ||
import styled from 'styled-components' | ||
|
||
import { | ||
ALIGN_CENTER, | ||
ALIGN_FLEX_START, | ||
ALIGN_STRETCH, | ||
COLORS, | ||
DIRECTION_COLUMN, | ||
FLEX_NONE, | ||
Flex, | ||
JUSTIFY_SPACE_BETWEEN, | ||
SPACING, | ||
LegacyStyledText, | ||
TYPOGRAPHY, | ||
DIRECTION_ROW, | ||
} from '@opentrons/components' | ||
|
||
import type { RouteProps } from './types' | ||
|
||
export function Navbar({ routes }: { routes: RouteProps[] }): JSX.Element { | ||
const navRoutes = routes.filter( | ||
({ navLinkTo }: RouteProps) => navLinkTo != null | ||
) | ||
return ( | ||
<Flex | ||
css={TYPOGRAPHY.h3Regular} | ||
flexDirection={DIRECTION_COLUMN} | ||
flex={FLEX_NONE} | ||
justifyContent={JUSTIFY_SPACE_BETWEEN} | ||
alignItems={ALIGN_CENTER} | ||
> | ||
<Flex | ||
flexDirection={DIRECTION_ROW} | ||
flex={FLEX_NONE} | ||
alignItems={ALIGN_FLEX_START} | ||
alignSelf={ALIGN_STRETCH} | ||
> | ||
{navRoutes.map(({ name, navLinkTo }: RouteProps) => ( | ||
<NavbarLink key={name} to={navLinkTo}> | ||
<LegacyStyledText | ||
as="h3" | ||
margin={`${SPACING.spacing8} 0 ${SPACING.spacing8} ${SPACING.spacing12}`} | ||
> | ||
{name} | ||
</LegacyStyledText> | ||
</NavbarLink> | ||
))} | ||
</Flex> | ||
</Flex> | ||
) | ||
} | ||
|
||
const NavbarLink = styled(NavLink)` | ||
color: ${COLORS.black90}; | ||
text-decoration: none; | ||
align-self: ${ALIGN_STRETCH}; | ||
&:hover { | ||
color: ${COLORS.black70}; | ||
} | ||
` |
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,99 @@ | ||
import * as React from 'react' | ||
import cx from 'classnames' | ||
import { DndProvider } from 'react-dnd' | ||
import { BrowserRouter } from 'react-router-dom' | ||
import { useDispatch, useSelector } from 'react-redux' | ||
import { HTML5Backend } from 'react-dnd-html5-backend' | ||
import { | ||
DIRECTION_COLUMN, | ||
DIRECTION_ROW, | ||
Flex, | ||
PrimaryButton, | ||
SPACING, | ||
} from '@opentrons/components' | ||
import { getEnableRedesign } from './feature-flags/selectors' | ||
import { setFeatureFlags } from './feature-flags/actions' | ||
import { ComputingSpinner } from './components/ComputingSpinner' | ||
import { ConnectedNav } from './containers/ConnectedNav' | ||
import { Sidebar } from './containers/ConnectedSidebar' | ||
import { ConnectedTitleBar } from './containers/ConnectedTitleBar' | ||
import { MainPanel } from './containers/ConnectedMainPanel' | ||
import { PortalRoot as MainPageModalPortalRoot } from './components/portals/MainPageModalPortal' | ||
import { MAIN_CONTENT_FORCED_SCROLL_CLASSNAME } from './ui/steps/utils' | ||
import { PrereleaseModeIndicator } from './components/PrereleaseModeIndicator' | ||
import { PortalRoot as TopPortalRoot } from './components/portals/TopPortal' | ||
import { FileUploadMessageModal } from './components/modals/FileUploadMessageModal/FileUploadMessageModal' | ||
import { LabwareUploadMessageModal } from './components/modals/LabwareUploadMessageModal/LabwareUploadMessageModal' | ||
import { GateModal } from './components/modals/GateModal' | ||
import { CreateFileWizard } from './components/modals/CreateFileWizard' | ||
import { AnnouncementModal } from './components/modals/AnnouncementModal' | ||
import { ProtocolRoutes } from './ProtocolRoutes' | ||
|
||
import styles from './components/ProtocolEditor.module.css' | ||
import './css/reset.module.css' | ||
|
||
const showGateModal = | ||
process.env.NODE_ENV === 'production' || process.env.OT_PD_SHOW_GATE | ||
|
||
function ProtocolEditorComponent(): JSX.Element { | ||
const enableRedesign = useSelector(getEnableRedesign) | ||
const dispatch = useDispatch() | ||
|
||
return ( | ||
<div id="protocol-editor"> | ||
<TopPortalRoot /> | ||
{enableRedesign ? ( | ||
<Flex flexDirection={DIRECTION_COLUMN}> | ||
<Flex padding={SPACING.spacing12} flexDirection={DIRECTION_ROW}> | ||
<PrimaryButton | ||
onClick={() => { | ||
dispatch(setFeatureFlags({ OT_PD_ENABLE_REDESIGN: false })) | ||
}} | ||
> | ||
turn off redesign | ||
</PrimaryButton> | ||
</Flex> | ||
<BrowserRouter> | ||
<ProtocolRoutes /> | ||
</BrowserRouter> | ||
</Flex> | ||
) : ( | ||
<div className="container"> | ||
<ComputingSpinner /> | ||
<TopPortalRoot /> | ||
{showGateModal ? <GateModal /> : null} | ||
<PrereleaseModeIndicator /> | ||
<div className={styles.wrapper}> | ||
<ConnectedNav /> | ||
<Sidebar /> | ||
<div className={styles.main_page_wrapper}> | ||
<ConnectedTitleBar /> | ||
|
||
<div | ||
id="main-page" | ||
className={cx( | ||
styles.main_page_content, | ||
MAIN_CONTENT_FORCED_SCROLL_CLASSNAME | ||
)} | ||
> | ||
<AnnouncementModal /> | ||
<CreateFileWizard /> | ||
<FileUploadMessageModal /> | ||
|
||
<MainPageModalPortalRoot /> | ||
<LabwareUploadMessageModal /> | ||
<MainPanel /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
export const ProtocolEditor = (): JSX.Element => ( | ||
<DndProvider backend={HTML5Backend}> | ||
<ProtocolEditorComponent /> | ||
</DndProvider> | ||
) |
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,72 @@ | ||
import * as React from 'react' | ||
import { Route, Navigate, Routes, useLocation } from 'react-router-dom' | ||
import { Box } from '@opentrons/components' | ||
import { Landing } from './pages/Landing' | ||
import { ProtocolOverview } from './pages/ProtocolOverview' | ||
import { Liquids } from './pages/Liquids' | ||
import { StartingDeckState } from './pages/StartingDeckState' | ||
import { ProtocolSteps } from './pages/ProtocolSteps' | ||
import { CreateNewProtocol } from './pages/CreateNewProtocol' | ||
import { Navbar } from './Navbar' | ||
|
||
import type { RouteProps } from './types' | ||
|
||
const LANDING_ROUTE = '/' | ||
const pdRoutes: RouteProps[] = [ | ||
{ | ||
Component: ProtocolOverview, | ||
name: 'Protocol overview', | ||
navLinkTo: '/overview', | ||
path: '/overview', | ||
}, | ||
{ | ||
Component: Liquids, | ||
name: 'Liquids', | ||
navLinkTo: '/liquids', | ||
path: '/liquids', | ||
}, | ||
{ | ||
Component: StartingDeckState, | ||
name: 'Starting deck state', | ||
navLinkTo: '/startingDeckState', | ||
path: '/startingDeckState', | ||
}, | ||
{ | ||
Component: ProtocolSteps, | ||
name: 'Protocol steps', | ||
navLinkTo: '/steps', | ||
path: '/steps', | ||
}, | ||
{ | ||
Component: CreateNewProtocol, | ||
name: 'Create new protocol', | ||
navLinkTo: '/createNew', | ||
path: '/createNew', | ||
}, | ||
] | ||
|
||
export function ProtocolRoutes(): JSX.Element { | ||
const location = useLocation() | ||
const currentPath = location.pathname | ||
const landingPage: RouteProps = { | ||
Component: Landing, | ||
name: 'Landing', | ||
navLinkTo: '/', | ||
path: '/', | ||
} | ||
const allRoutes: RouteProps[] = [...pdRoutes, landingPage] | ||
|
||
return ( | ||
<> | ||
{currentPath === LANDING_ROUTE ? null : <Navbar routes={pdRoutes} />} | ||
<Box width="100%"> | ||
<Routes> | ||
{allRoutes.map(({ Component, path }: RouteProps) => { | ||
return <Route key={path} path={path} element={<Component />} /> | ||
})} | ||
<Route path="*" element={<Navigate to={LANDING_ROUTE} />} /> | ||
</Routes> | ||
</Box> | ||
</> | ||
) | ||
} |
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
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
Oops, something went wrong.