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: drawing tile navigator panel (PT-185987214) #2416

Merged
merged 26 commits into from
Oct 8, 2024

Conversation

emcelroy
Copy link
Contributor

@emcelroy emcelroy commented Sep 30, 2024

#185987214

The tile navigator panel is a scaled-down clone of the tile content area. The panel can be added or removed using a new toolbar button.

For now the panel is only an option for the drawing tile, and it only shows the content of the tile. Panning buttons will be added to the navigator in a separate piece of work.

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 95.57522% with 5 lines in your changes missing coverage. Please review.

Project coverage is 86.29%. Comparing base (8bef86c) to head (e50c2a4).
Report is 27 commits behind head on master.

Files with missing lines Patch % Lines
src/models/tiles/navigatable-tile-model.ts 84.21% 3 Missing ⚠️
src/components/tiles/tile-navigator.tsx 98.36% 1 Missing ⚠️
src/components/toolbar/navigator-button.tsx 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2416      +/-   ##
==========================================
+ Coverage   85.38%   86.29%   +0.91%     
==========================================
  Files         742      745       +3     
  Lines       38379    38485     +106     
  Branches     9801     9823      +22     
==========================================
+ Hits        32769    33212     +443     
+ Misses       5304     4972     -332     
+ Partials      306      301       -5     
Flag Coverage Δ
cypress-regression 78.14% <95.65%> (+1.48%) ⬆️
cypress-smoke 28.08% <73.91%> (+0.12%) ⬆️
jest 48.81% <35.39%> (-0.06%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

cypress bot commented Sep 30, 2024

collaborative-learning    Run #13981

Run Properties:  status check passed Passed #13981  •  git commit e50c2a4810: chore: remove IDrawingTileProps import
Project collaborative-learning
Run status status check passed Passed #13981
Run duration 14m 47s
Commit git commit e50c2a4810: chore: remove IDrawingTileProps import
Committer Ethan McElroy
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 3
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 115

@emcelroy emcelroy marked this pull request as ready for review September 30, 2024 15:48
Copy link
Contributor

@bgoldowsky bgoldowsky left a comment

Choose a reason for hiding this comment

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

The current implementation shows a rendundant duplicate of whatever portion of the drawing canvas is currently visible in the main tile. The spec is rather unclear, but I do not think that is what we want.

I think we want to make this work like the Diagram tile, where the navigator panel always shows all the content, even if the main tile is zoomed in so that some content is invisible. In that case, a box is drawn within the navigator to show what portion of the content is visible. Here is a screenshot of the diagram tile showing what I mean. It's not super obvious because of the low contrast grey-on-grey, but you can see the two full "variable" boxes in the navigator panel, even though they are not fully visible in the main tile.
image

cypress/e2e/functional/tile_tests/tile_navigator_spec.js Outdated Show resolved Hide resolved
cypress/support/elements/tile/TileNavigator.js Outdated Show resolved Hide resolved
src/components/tiles/tile-navigator.tsx Outdated Show resolved Hide resolved
src/components/tiles/tile-navigator.tsx Show resolved Hide resolved
src/components/tiles/tile-navigator.tsx Outdated Show resolved Hide resolved
src/components/toolbar/navigator-button.tsx Show resolved Hide resolved
src/components/toolbar/navigator-button.tsx Outdated Show resolved Hide resolved
src/plugins/drawing/model/drawing-content.ts Outdated Show resolved Hide resolved
src/components/tiles/tile-navigator.tsx Outdated Show resolved Hide resolved
@emcelroy
Copy link
Contributor Author

emcelroy commented Oct 1, 2024

The current implementation shows a rendundant duplicate of whatever portion of the drawing canvas is currently visible in the main tile. The spec is rather unclear, but I do not think that is what we want.

I think we want to make this work like the Diagram tile, where the navigator panel always shows all the content, even if the main tile is zoomed in so that some content is invisible. In that case, a box is drawn within the navigator to show what portion of the content is visible. Here is a screenshot of the diagram tile showing what I mean. It's not super obvious because of the low contrast grey-on-grey, but you can see the two full "variable" boxes in the navigator panel, even though they are not fully visible in the main tile. image

Thanks. I thought I got approval on the current arrangement, but now I'm not so sure. Let me double check.

@scytacki scytacki removed their request for review October 2, 2024 13:07
emcelroy and others added 10 commits October 4, 2024 12:06
This uses applySnapshot to update the class users in place.
This will make code using these users more efficient since they can just observer the user properties for changes.
Original the MST environment was avoided because I was planning to
switch this store to just be MobX. However the group store needs to
be synced with the data from the database, and it is easier to do that
using MST than MobX.
This uses applySnapshot to sync the changes from the DB. This way the existing objects are updated instead of creating new ones.

I also missed a change in stores when committing the last set of changes.
This will allow us to update the users later and have the group views automatically update without having to also update the group user objects.

This also removes the option to skip unknown students. They are part of the group so we should show them even if we don't know who they are yet.
We use a timestamp for when the class information is retrieved from the portal. And compare this to the timestamp in the groupUser to figure out if this groupUser is older than the class info or newer than the class info.
The portal service object provides a place to store portal info like JWTs, and methods that use and update this info.

This new object is used to refresh the class info if necessary after updating the group info from Firebase.
Copy link
Contributor

@bgoldowsky bgoldowsky left a comment

Choose a reason for hiding this comment

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

This looks good!
The only thing that's important to fix is that there shouldn't be any imports that cause plugin code to be loaded from non-plugin code, see specific comments below.


cy.log("Move tile navigator to the top of the drawing tile in a quick animation");
tileNavigator.getTileNavigatorPlacementButton().click();
cy.wait(300);
Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't need the explicit wait here (or in line 70), since Cypress will automatically wait up to its timeout for a condition to become true.

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 know that's true generally, but found these were required to make the test pass consistently. I believe it has something to do with how the component waits for the animation to complete before updating the model which is what causes the class name to change. I'm not sure why explicitly setting a wait makes it always work. I did spend some time looking into it but wasn't able to figure out a way to make them unnecessary. For now at least I'd like to leave them so I can complete the main task.

@@ -6,10 +6,11 @@ class DrawToolTile{
return cy.get(`${workspaceClass || ".primary-workspace"} .editable-tile-title-text`);
}
getDrawTileComponent(){
return cy.get('.primary-workspace [data-testid=drawing-tool]');
return cy.get('.primary-workspace [data-testid=drawing-tool]')
.not('[data-testid="tile-navigator"] [data-testid=drawing-tool]');
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why some use quotes inside the brackets and some don't?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, that was just me being a bit inconsistent. Since they're not needed, I've removed them. Thanks for catching that.

Comment on lines 8 to 9
import { BoundingBox } from "../../plugins/drawing/model/drawing-basic-types";
import { IDrawingTileProps } from "../../plugins/drawing/components/drawing-tile";
Copy link
Contributor

Choose a reason for hiding this comment

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

There should be no dependencies from core (non-plugin) code into plugins, this will cause plugins to be loaded when they are not needed.

@@ -0,0 +1,45 @@
import { types, Instance, SnapshotIn } from "mobx-state-tree";

import { BoundingBox } from "../../plugins/drawing/model/drawing-basic-types";
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this dependency on a plugin.


import { ITileProps } from "./tile-component";
import { BoundingBox, NavigatableTileModelType } from "../../models/tiles/navigatable-tile-model";
import { IDrawingTileProps } from "../../plugins/drawing/components/drawing-tile";
Copy link
Contributor

Choose a reason for hiding this comment

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

One plugin dependency still to remove.

Copy link
Contributor

@bgoldowsky bgoldowsky left a comment

Choose a reason for hiding this comment

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

Changes look good 👍

@emcelroy emcelroy merged commit c078302 into master Oct 8, 2024
17 checks passed
@emcelroy emcelroy deleted the 185987214-drawing-tile-navigator-panel branch October 8, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants