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): extend SectionList component for Generic Step Screen #8513

Merged
merged 12 commits into from
Oct 13, 2021

Conversation

jerader
Copy link
Collaborator

@jerader jerader commented Oct 12, 2021

Overview

closes #8500

Changelog

  • add props to SectionList and create test
  • rename PositionCheckNav to SectionList

Review requests

  • review SectionList to make sure it has all the AC in the ticket
  • review test

Risk assessment

low, behind ff

@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #8513 (2da5499) into edge (6da1eca) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 2da5499 differs from pull request most recent head 5c8c579. Consider uploading reports for the commit 5c8c579 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             edge    #8513      +/-   ##
==========================================
+ Coverage   74.29%   74.31%   +0.01%     
==========================================
  Files        1693     1693              
  Lines       45557    45568      +11     
  Branches     4634     4639       +5     
==========================================
+ Hits        33848    33865      +17     
+ Misses      10907    10901       -6     
  Partials      802      802              
Flag Coverage Δ
app 71.53% <100.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ProtocolSetup/LabwarePositionCheck/IntroScreen.tsx 86.66% <ø> (ø)
...nisms/ProtocolSetup/LabwarePositionCheck/index.tsx 83.33% <ø> (-2.39%) ⬇️
...olSetup/LabwarePositionCheck/GenericStepScreen.tsx 100.00% <100.00%> (ø)
...ProtocolSetup/LabwarePositionCheck/SectionList.tsx 100.00% <100.00%> (ø)

@jerader jerader added the app Affects the `app` project label Oct 12, 2021
@jerader jerader marked this pull request as ready for review October 12, 2021 18:58
@jerader jerader requested a review from a team as a code owner October 12, 2021 18:58
@jerader jerader requested review from Kadee80, shlokamin and a team and removed request for a team October 12, 2021 18:58
@jerader jerader removed the request for review from a team October 13, 2021 14:08
@jerader jerader changed the title feat(app): extend PositionCheckNav component for Generic Step Screen feat(app): extend SectionList component for Generic Step Screen Oct 13, 2021
Copy link
Member

@shlokamin shlokamin left a comment

Choose a reason for hiding this comment

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

Nice @jerader, this looks great! and WOW this is 100% covered by tests, you deserve a ⭐

Just left a few nits and comments about variable naming that might make what's going on a bit clearer.

Comment on lines 5 to 6
import type { LabwarePositionCheckStep } from './types'
import { useIntroInfo } from './hooks'
Copy link
Member

Choose a reason for hiding this comment

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

nit: the type import should go last

Comment on lines 9 to 12
export const GenericStepScreen = (
export function GenericStepScreen(
Copy link
Member

Choose a reason for hiding this comment

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

how come this got changed from a function expression to a function declaration?

Copy link
Member

Choose a reason for hiding this comment

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

oh this is outdated now, ignore! 😄

completedSections != null && completedSections.includes(section)
let iconBackgroundColor = C_DISABLED
if (section === currentSection) {
iconBackgroundColor = '#00c3e6'
Copy link
Member

Choose a reason for hiding this comment

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

can we use C_SELECTED_DARK here instead of the string literal?

backgroundColor={C_NEAR_WHITE}
>
{sections.map((section, index) => {
const sectionTextOrBackgroundColor =
Copy link
Member

Choose a reason for hiding this comment

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

can we rename sectionTextOrBackgroundColor to sectionTextColor?

while it's being used to inform the Box element's backgroundColor, it's really being used by the Text element as it's color attribute

: C_DARK_GRAY
const isCompleted =
completedSections != null && completedSections.includes(section)
let iconBackgroundColor = C_DISABLED
Copy link
Member

Choose a reason for hiding this comment

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

can we rename iconBackgroundColor to backgroundColor? this variable is being used whether or not we render an icon

})
it('renders LabwarePositionCheckStepDetail component', () => {
const { getByText } = render(props)
expect(getByText('Mock Labware Position Check Step Detail')).toBeTruthy()
})
it('renders GenericStepScreenNav component', () => {
const { getByText } = render(props)
expect(getByText('Mock SectionList')).toBeTruthy()
Copy link
Member

Choose a reason for hiding this comment

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

this can be replaced with just getByText('Mock SectionList')

const PICKUP_TIP_LABWARE_ID = 'PICKUP_TIP_LABWARE_ID'
const PRIMARY_PIPETTE_ID = 'PRIMARY_PIPETTE_ID'
const mockLabwarePositionCheckStepTipRack = {
const MOCK_SECTION = ['PRIMARY_PIPETTE_TIPRACKS' as Section]
Copy link
Member

Choose a reason for hiding this comment

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

since this variable represents multiple sections, can we call it MOCK_SECTIONS (plural)?

})
it('renders a 2 step Nav with 1 pipette', () => {
const { getByText } = render(props)
expect(getByText('1')).toHaveStyle('backgroundColor: #00c3e6')
Copy link
Member

Choose a reason for hiding this comment

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

can we use the C_SELECTED_DARK variable here? that way if we ever change color palettes we wont have to update all of our tests again 😄

@jerader jerader merged commit bb5fab0 into edge Oct 13, 2021
@jerader jerader deleted the app_lpc-extend-section-list-component branch October 13, 2021 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app Affects the `app` project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Labware Position Check: Extend section list component for generic step screen
2 participants