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

Add plots error message below ribbon #5165

Merged
merged 10 commits into from
Jan 9, 2024
Merged

Conversation

julieg18
Copy link
Contributor

@julieg18 julieg18 commented Jan 3, 2024

@julieg18 julieg18 added the product PR that affects product label Jan 3, 2024
@julieg18 julieg18 self-assigned this Jan 3, 2024
@@ -43,15 +44,7 @@ export const ZoomedInPlot: React.FC<ZoomedInPlotProps> = ({
openActionsMenu
}: ZoomedInPlotProps) => {
const zoomedInPlotRef = useRef<HTMLDivElement>(null)

useEffect(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this useEffect into a hook so we could use it in both ZoomedInPlot and ErrorsModal

@@ -95,6 +96,7 @@ export const Ribbon: React.FC = () => {
onClear={() => removeRevision(revision.id)}
/>
))}
<Errors />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As always, any comments/ideas for improving the design are welcome!

@@ -83,6 +86,29 @@ const Template: StoryFn<{
export const WithData = Template.bind({})
WithData.parameters = CHROMATIC_VIEWPORTS_WITH_DELAY

export const WithPlotsErrors = Template.bind({})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a storybook for both revision and plot errors.

@julieg18 julieg18 marked this pull request as ready for review January 5, 2024 15:08
@julieg18 julieg18 requested a review from shcheklein January 5, 2024 15:09
@shcheklein
Copy link
Member

@julieg18 what happens when you scroll it? can you show on a demo please? also it seems it jumps a bit when you show the popup / close it.

@julieg18
Copy link
Contributor Author

julieg18 commented Jan 5, 2024

@julieg18 what happens when you scroll it? can you show on a demo please?

It's currently fixed to the ribbon:

Screen.Recording.2024-01-05.at.9.41.20.AM.mov

Though looking at it when we're scrolling, I think we can decrease its height a bit. It's currently feels taller than the ribbon 🤔

also it seems it jumps a bit when you show the popup / close it.

Yes, I believe it's due to the fact that we are removing the scroll bar when a popup opens. Our plot modals work the same:

Screen.Recording.2024-01-05.at.9.43.49.AM.mov

@shcheklein
Copy link
Member

Thanks @julieg18 , I think it looks good. One suggestion - get rid of the Errors Found and just move "Show 2 errors" there instead. I don't think we need both in this case.

@@ -81,6 +82,9 @@ export const feedStore = (
case PlotsDataKeys.HAS_UNSELECTED_PLOTS:
dispatch(updateHasUnselectedPlots(!!data.data[key]))
continue
case PlotsDataKeys.PLOT_ERRORS:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a note to self, we should reduce the number of branches in this switch/case by having an enum instead:

const actionToDispatch = {
  ...
  [PlotsDataKeys.PLOT_ERRORS]: updatePlotErrors
  [PlotsDataKeys.SELECTED_REVISIONS]: updateSelectedRevisions
  ...
}

and a simple dispatch(actionToDispatch[key](data.data.key))

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll open an issue for that. And don't worry, it's totally out of scope and has nothing to do with your PR.

webview/src/plots/components/ErrorsModal.tsx Outdated Show resolved Hide resolved
}

return (
<li className={styles.errors}>
Copy link
Contributor

Choose a reason for hiding this comment

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

It does not make much sense for this to be an <li/> element. I know that it is inside of the ribbon, but it does not fit with the rest of the list. The ribbon should be a wrapper that wraps the list and the errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense! I'll take care of this in a followup since the CSS will need to be adjusted and I don't want to accidentally break the ribbon.

@julieg18 julieg18 enabled auto-merge (squash) January 9, 2024 16:41
</th>
</tr>
{revs.map(({ rev, msg }) => (
<tr key={`${rev}-${msg}`}>
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 2 locations. Consider refactoring.

Copy link

codeclimate bot commented Jan 9, 2024

Code Climate has analyzed commit 780f737 and detected 5 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1
Duplication 4

The test coverage on the diff in this pull request is 98.4% (85% is the threshold).

This pull request will bring the total coverage in the repository to 95.3% (0.0% change).

View more on Code Climate.

@julieg18 julieg18 merged commit 2da53ae into main Jan 9, 2024
7 of 8 checks passed
@julieg18 julieg18 deleted the add-error-message-below-ribbon branch January 9, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants