Skip to content
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 attached modules card UI to instrument settings page #1854

Merged
merged 4 commits into from
Jul 11, 2018

Conversation

Kadee80
Copy link
Contributor

@Kadee80 Kadee80 commented Jul 10, 2018

overview

This PR closes #1735 (assuming wiring up to API endpoint is its own ticket once the endpoint exists)

screen shot 2018-07-11 at 1 46 50 pm

changelog

  • feat(app): Add attached modules card UI to instrument settings page

review requests

Keeping this as a WIP while waiting for pending modules image assets. ModuleItems currently just uses a placehold.it image. Once we have those, another styling pass before ready for review.

I pulled ModuleItem and its atoms along with NoModulesMessage into a /ModuleItem directory because instrumentSettings was getting a little cluttered.

Also worth noting, since the endpoint does not exist and is not wired mapStateToProps is rendering mock data.

Modules is still behind a feature flag so run OT_APP_MODULES=1 make dev to view it in InstrumentSettings

@Kadee80 Kadee80 added feature Ticket is a feature request / PR introduces a feature app Affects the `app` project WIP labels Jul 10, 2018
@Kadee80 Kadee80 requested a review from mcous July 10, 2018 20:34
return (
<React.Fragment>
{props.modules.map((mod) => (
<ModuleItem {...mod} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need key={index}?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes good catch. saw the warning and then forgot to slug it in


// TODO (ka 2018-7-10): replace with design assets onces available
const MODULE_IMGS = {
'Temperature Module': 'http://via.placeholder.com/100x75',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will placecage in a pinch

return (
<div className={styles.module_update}>
<OutlineButton
disabled={!!availableUpdate}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This disabled logic should be switched

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch reversing now

@codecov
Copy link

codecov bot commented Jul 10, 2018

Codecov Report

Merging #1854 into edge will increase coverage by 0.09%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##             edge    #1854      +/-   ##
==========================================
+ Coverage   33.76%   33.85%   +0.09%     
==========================================
  Files         391      396       +5     
  Lines        6380     6428      +48     
==========================================
+ Hits         2154     2176      +22     
- Misses       4226     4252      +26
Impacted Files Coverage Δ
app/src/http-api-client/modules.js 100% <ø> (ø) ⬆️
app/src/components/ModuleItem/ModuleUpdate.js 0% <0%> (ø)
app/src/components/layout/CardColumn.js 0% <0%> (ø) ⬆️
...mponents/InstrumentSettings/AttachedModulesCard.js 0% <0%> (ø) ⬆️
app/src/components/ModuleItem/index.js 0% <0%> (ø)
app/src/components/ModuleItem/ModuleImage.js 0% <0%> (ø)
...mponents/InstrumentSettings/ModulesCardContents.js 0% <0%> (ø) ⬆️
app/src/components/ModuleItem/NoModulesMessage.js 0% <0%> (ø)
app/src/components/ModuleItem/ModuleInfo.js 0% <0%> (ø)
...rotocol-designer/src/step-generation/distribute.js 100% <0%> (ø) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9cdd66f...9698504. Read the comment docs.

Copy link
Contributor

@b-cooper b-cooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍 I just had a couple of small comments

fetchModules?: () => mixed
}

type Props = SP

const TITLE = 'Modules'

const MODULE_DATA = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this name forecast that it is temporary stub data more? e.g. STUBBED_MODULE_DATA. especially next to TITLE it looks like a permanent constant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

export default function ModuleItem (props: Module) {
return (
<div className={styles.module_item}>
<ModuleImage {...props}/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it true that these child components are receiving a lot of extra props because of these spreads? Is there any reason you're not explicitly passing down the props that they'll need. e.g. <ModuleUpdate availableUpdate={props.availableUpdate} />

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

happy to be more specific. will change now

import styles from './styles.css'

type Props = {
availableUpdate?: ?string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see availableUpdate in the stubbed modules. Is it a version string in the case that there is an available update and undefined if not? If that's the case, could it be called availableUpdateVersion?

Copy link
Contributor Author

@Kadee80 Kadee80 Jul 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, everything is just stubbed out. Not sure where the firmware update will come from yet. In robot it was a ?string with the version if a new one is available

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

availableUpdate will likely come from a selector based on whatever firmware files we have bundled in that version of the app

Copy link
Contributor

@mcous mcous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐧

import styles from './styles.css'

type Props = {
availableUpdate?: ?string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

availableUpdate will likely come from a selector based on whatever firmware files we have bundled in that version of the app

@Kadee80 Kadee80 merged commit 3a57807 into edge Jul 11, 2018
@Kadee80 Kadee80 deleted the app_modules-card-ui branch July 11, 2018 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app Affects the `app` project feature Ticket is a feature request / PR introduces a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modules: 'Modules' Information Card
3 participants