-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(app): Add resources page to more section #1631
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// @flow | ||
// resources page layout | ||
import * as React from 'react' | ||
import {Card, OutlineButton} from '@opentrons/components' | ||
|
||
const TITLE = 'Knowledge Base' | ||
|
||
export default function KnowledgeCard () { | ||
return ( | ||
<Card | ||
title={TITLE} | ||
> | ||
<p>Visit our walkthroughs and FAQs</p> | ||
<OutlineButton | ||
Component="a" | ||
href="https://support.opentrons.com" | ||
target="_blank" | ||
> | ||
View in Browser | ||
</OutlineButton> | ||
</Card> | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// @flow | ||
// resources page layout | ||
import * as React from 'react' | ||
import {Card, OutlineButton} from '@opentrons/components' | ||
|
||
const TITLE = 'Protocol Library' | ||
|
||
export default function LibraryCard () { | ||
return ( | ||
<Card | ||
title={TITLE} | ||
> | ||
<p>Download a protocol to run on your robot</p> | ||
<OutlineButton | ||
Component="a" | ||
href="http://protocols.opentrons.com/" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's do |
||
target="_blank" | ||
> | ||
View in Browser | ||
</OutlineButton> | ||
</Card> | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// @flow | ||
// resources page layout | ||
import * as React from 'react' | ||
|
||
import KnowledgeCard from './KnowledgeCard' | ||
import LibraryCard from './LibraryCard' | ||
|
||
import styles from './styles.css' | ||
|
||
export default function Resources () { | ||
return ( | ||
<div className={styles.resources_page}> | ||
<div className={styles.row}> | ||
<KnowledgeCard /> | ||
</div> | ||
<div className={styles.row}> | ||
<LibraryCard /> | ||
</div> | ||
</div> | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* stylesheet for Resources page components */ | ||
@import '@opentrons/components'; | ||
|
||
:root { | ||
--resources_card_spacing: 0.75rem; | ||
} | ||
|
||
.resources_page { | ||
padding: 1.5rem; | ||
font-size: var(--fs-body-1); | ||
} | ||
|
||
.row { | ||
width: 100%; | ||
margin-bottom: var(--resources_card_spacing); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// @flow | ||
// view info about the app and update | ||
import React from 'react' | ||
import {connect} from 'react-redux' | ||
import {Route, Switch, Redirect, type ContextRouter} from 'react-router' | ||
import {push} from 'react-router-redux' | ||
|
||
import type {State} from '../../types' | ||
import type {ShellUpdate} from '../../shell' | ||
import { | ||
getShellUpdate, | ||
checkForShellUpdates, | ||
downloadShellUpdate, | ||
quitAndInstallShellUpdate, | ||
setUpdateSeen | ||
} from '../../shell' | ||
|
||
import Page from '../../components/Page' | ||
import AppSettings, {AppUpdateModal} from '../../components/AppSettings' | ||
|
||
type OP = ContextRouter | ||
|
||
type SP = { | ||
update: ShellUpdate, | ||
} | ||
|
||
type DP = { | ||
checkForUpdates: () => mixed, | ||
downloadUpdate: () => mixed, | ||
quitAndInstall: () => mixed, | ||
closeUpdateModal: () => mixed, | ||
} | ||
|
||
type Props = OP & SP & DP | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(AppSettingsPage) | ||
|
||
function AppSettingsPage (props: Props) { | ||
const {update, match: {path}} = props | ||
|
||
return ( | ||
<Page> | ||
<AppSettings {...props} /> | ||
<Switch> | ||
<Route path={`${path}/update`} render={() => ( | ||
<AppUpdateModal {...props} close={props.closeUpdateModal} /> | ||
)} /> | ||
<Route render={() => { | ||
if (update.available && !update.seen) { | ||
return (<Redirect to='/menu/app/update' />) | ||
} | ||
|
||
return null | ||
}} /> | ||
</Switch> | ||
</Page> | ||
) | ||
} | ||
|
||
function mapStateToProps (state: State): SP { | ||
return { | ||
update: getShellUpdate(state) | ||
} | ||
} | ||
|
||
function mapDispatchToProps (dispatch: Dispatch): DP { | ||
return { | ||
checkForUpdates: () => dispatch(checkForShellUpdates()), | ||
downloadUpdate: () => dispatch(downloadShellUpdate()), | ||
quitAndInstall: () => quitAndInstallShellUpdate(), | ||
closeUpdateModal: () => { | ||
dispatch(setUpdateSeen()) | ||
dispatch(push('/menu/app')) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react' | ||
import Page from '../../components/Page' | ||
import Resources from '../../components/Resources' | ||
export default function ResourcesPage () { | ||
return ( | ||
<Page> | ||
<Resources /> | ||
</Page> | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// @flow | ||
// more nav button routes | ||
import * as React from 'react' | ||
import {Switch, Route, Redirect, type Match} from 'react-router' | ||
|
||
import AppSettings from './AppSettings' | ||
import Resources from './Resources' | ||
|
||
type Props = { | ||
match: Match | ||
} | ||
|
||
export default function More (props: Props) { | ||
const {match: {path}} = props | ||
return ( | ||
<Switch> | ||
<Redirect exact from={path} to={'/menu/app'} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
<Redirect exact from={path} to={`${path}/app`} /> |
||
<Route | ||
path={'/menu/app'} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should also use path={`${path}/app`} Given the redirect above, it might be worth doing... const appPath = `${path}/app` ...up top for the Redirect's to and the Route's path |
||
component={AppSettings} | ||
/> | ||
<Route | ||
path={'/menu/resources'} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should also use path={`${path}/resources`} |
||
component={Resources} | ||
/> | ||
</Switch> | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need separate components for KnowledgeCard and LibraryCard? Seems like we could get away with a ExternalResourceCard that takes children or a message prop and an external link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. Will change with https comment below