-
Notifications
You must be signed in to change notification settings - Fork 176
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
refactor(app): protocol Upload Empty State Recent Run Listing #8746
Conversation
Codecov Report
@@ Coverage Diff @@
## edge #8746 +/- ##
==========================================
- Coverage 75.16% 74.97% -0.19%
==========================================
Files 1841 1847 +6
Lines 48659 49140 +481
Branches 4746 4873 +127
==========================================
+ Hits 36574 36843 +269
- Misses 11272 11455 +183
- Partials 813 842 +29
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@emilywools - here is the modal + the empty state with and without previous run data. |
Hey @jerader this is looking great. can you add this line as the 3rd paragraph in the modal window (after the second paragraph)?
|
@jerader on the "launch protocol library" link, Library needs to be capitalized on the "see how x works" it needs to be title case |
const fullRunTimestamp = runQuery.data?.data.createdAt | ||
const indexToSplit = fullRunTimestamp?.indexOf('T') | ||
if (fullRunTimestamp == null) return null | ||
const date = fullRunTimestamp?.slice(0, indexToSplit) | ||
const timeAndUTC = | ||
indexToSplit != null ? fullRunTimestamp?.slice(indexToSplit + 1) : '' | ||
const timeToSplit = timeAndUTC.indexOf('.') | ||
const time = timeAndUTC.slice(0, timeToSplit) | ||
|
||
const UTC = timeAndUTC?.slice(timeToSplit + 7) |
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.
We use date-fns for manipulating date strings in our JS projects.
By using a combination of their parseIso
and format
functions we should be able to get what we want in a cleaner, and less brittle manner.
import {format, parseIso} from 'date-fns'
const fullRunTimestamp = runQuery.data?.data.createdAt
dateFns.format(parseIso(fullRunTimestamp), 'Pppp')
29d4011
to
2c357c8
Compare
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.
left some nits, but no need to hold this up if its blocking other folks. also I did not test on a robot.
"exit_modal_heading": "Confirm Close Protocol", | ||
"exit_modal_go_back": "No, go back", | ||
"exit_modal_exit": "Yes, close now", | ||
"exit_modal_body": "Are you sure you want to close this protocol?" | ||
"exit_modal_body": "Are you sure you want to close this protocol?", | ||
"robotName_last_run": "{{robot_name}}’s last run", |
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.
nit: this key is a mix of snake case and camel case, we usually stick with snake case it looks like
"rerunning_protocol_modal_header": "How Rerunning A Protocol Works", | ||
"rerunning_protocol_modal_body": "<block>Opentrons displays the connected robot’s last protocol run on on the Protocol Upload page. If you run again, Opentrons loads this protocol and applies Labware Offset data if any exists.</block><block>Clicking “Run Again” will take you directly to the Run tab. If you’d like to review the deck setup or run Labware Position Check before running the protocol, navigate to the Protocol tab.</block><block>If you recalibrate your robot, it will clear the last run from the upload page.</block>", | ||
"rerunning_protocol_modal_link": "Learn more about Labware Offset Data", | ||
"no_labware_offset_Data": "No Labware Offset data" |
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.
nit: i dont think Data
should be capitalized in this key
onCloseClick: () => unknown | ||
} | ||
|
||
const UPLOAD_PROTOCOL_URL = '#' // TODO IMMEDIATELY get actual link - Emily said this url isn't created it |
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.
can we make a ticket for this so we don't forget?
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.
just made one!
width={SIZE_4} | ||
backgroundColor={C_BLUE} | ||
name="close" | ||
id={'RobotCalModal_closeButton'} |
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.
looks like this copied from DeckCalibrationModal
, it should be prefixed with RerunningProtocolModal
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.
whoops, good catch!
color={C_BLUE} | ||
href={UPLOAD_PROTOCOL_URL} | ||
marginTop={SPACING_2} | ||
id={'RerunningProtocol_ModalLink'} |
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.
this is should be prefixed with RerunningProtocolModal
, right now theres an underscore between Protocol
and Modal
const fileInput = React.useRef<HTMLInputElement>(null) | ||
const [isFileOverDropZone, setIsFileOverDropZone] = React.useState<boolean>( | ||
false | ||
) | ||
const [rerunningProtocolModal, setRerunningProtocolModal] = React.useState( |
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.
can these state variables be prefixed with show
to indicate that they control whether or not the modal should be rendered?
const cloneMostRecentRun = useCloneRun( | ||
mostRecentRunId != null ? mostRecentRunId : '' | ||
) | ||
// If mostRecentRun is null, the CTA that uses cloneRun won't appear so this will never be reached |
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.
nit: can this comment be moved to be just above line 87?
<Trans | ||
id={'file_input'} | ||
t={t} | ||
i18nKey="upload_and_simulate" | ||
values={{ robot_name: robotName }} | ||
/> |
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.
how come this needs to be a Trans
component?
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.
can you add the robot_name
without it being a Trans
component?
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.
sure can!
opentrons/app/src/organisms/ProtocolSetup/LabwarePositionCheck/hooks/useLabwarePositionCheck.ts
Lines 68 to 70 in f0f31a9
return t('confirm_position_and_move', { | |
next_slot: slot, | |
}) |
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.
Trans components are only really necessary when you need to interpolate React elements. most of the time they're actually unnecessary:
As long you have no React/HTML nodes integrated into a cohesive sentence (text formatting like strong, em, link components, maybe others), you won't need it - most of the times you will be using the good old t function.
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.
nevermind, i see how to do it 😃
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.
whoops, replied to the comment without see your response. thanks for the info link!
Overview
closes #8464
Changelog
RerunningProtocolModal
and adds on toUploadInfo
componentReview requests
RerunningProtocolModal
is empty for now since we are still waiting on support to write the articleRisk assessment
low, behind ff