Skip to content

My Saved Decks#2117

Draft
jacbn wants to merge 32 commits into
mainfrom
feature/my-saved-decks
Draft

My Saved Decks#2117
jacbn wants to merge 32 commits into
mainfrom
feature/my-saved-decks

Conversation

@jacbn
Copy link
Copy Markdown
Contributor

@jacbn jacbn commented Apr 27, 2026

Reworks My Question Decks so that only decks that are created or manually saved get saved to that page; no longer save decks that were simply attempted. Adds a save button (I used a star because this (will) appear on a different page to bookmarks – please disagree if you don't like it) to all decks to achieve this. Also renames the page to My Saved Decks to better reflect these changes.

Anyone should be able to save and view their saved decks, but teachers should also have the ability to set decks from anywhere without having to redirect to the Set Assignments page. To better enable this, a refactor of GameboardCards was undertaken.

Note that both Isaac and Ada have both requested the changes from automatic saving on attempt to manual saving only, but that the pages in which these are displayed are different; Ada does not have a My Saved Decks page or equivalent.

This is the first part of the wider changes to managing assignments; this does not rework Set Assignments in any meaningful way (though the cards do look slightly different).


Known issues:

  • Book pages' gameboard API response does not include the required savedToCurrentUser, so they do not appear saved when loading the page;
  • As above for My Assignments;

jacbn and others added 11 commits April 22, 2026 17:30
This allows us to set an assignment from anywhere a card is displayed, rather than requiring a redirect to the set assignments page
I have refactored the Ada "Remove board" button for consistency, but I'd really like to remove it in favour of the Sci approach. Decision on this pending from Ada team.

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@jacbn jacbn marked this pull request as draft April 27, 2026 13:49
Comment thread src/app/components/elements/SaveBoardButton.tsx Fixed
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

❌ Patch coverage is 53.78151% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.81%. Comparing base (a42c1c3) to head (fd52424).

Files with missing lines Patch % Lines
...rc/app/components/elements/cards/GameboardCard.tsx 21.42% 22 Missing ⚠️
src/app/components/elements/SaveBoardButton.tsx 48.57% 18 Missing ⚠️
src/app/state/slices/api/gameboards.ts 0.00% 4 Missing ⚠️
...ents/elements/list-groups/AbstractListViewItem.tsx 66.66% 3 Missing ⚠️
src/app/components/elements/PageMetadata.tsx 66.66% 2 Missing ⚠️
src/test/pages/MyGameboards.cy.tsx 0.00% 2 Missing ⚠️
src/app/components/elements/cards/BoardCard.tsx 90.00% 1 Missing ⚠️
src/app/components/pages/Gameboard.tsx 50.00% 1 Missing ⚠️
src/test/pages/MyAssignments.cy.tsx 0.00% 1 Missing ⚠️
src/test/pages/SetAssignments.cy.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2117      +/-   ##
==========================================
+ Coverage   43.76%   43.81%   +0.05%     
==========================================
  Files         591      593       +2     
  Lines       24944    24970      +26     
  Branches     7389     8295     +906     
==========================================
+ Hits        10916    10940      +24     
+ Misses      13978    13972       -6     
- Partials       50       58       +8     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@sjd210 sjd210 left a comment

Choose a reason for hiding this comment

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

There's a lot here and most of it still seems to be working as I expect, but there are a few things to look at/discuss.

Love the spinning star animation btw :)

<ShareLink linkUrl={boardLink} reducedWidthLink clickAwayClose size="sm" buttonProps={{color: "keyline"}} />
</div>}
{isTutorOrAbove(user) && <Button className="flex-grow-1" color="keyline" onClick={(e) => {e.preventDefault(); openAssignModal?.();}}>
{isSetAssignments ? "Assign / Unassign" : "Assign"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is missing the previous logic of also only using "Assign" when there are 0 groups that the gameboard is currently set to. It feels clearer to me that we keep this (and also it still has this behaviour on the table view, so even if we did want to change it, this is inconsistent with that)

Copy link
Copy Markdown
Contributor Author

@jacbn jacbn May 7, 2026

Choose a reason for hiding this comment

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

Ah, sorry, there's additional context here – Set Assignments (soon to be Manage Assignments) will only show assigned decks, so there'll never be a case where there are 0 groups assigned and isSetAssignments is true. You'll also need to go to Manage Assignments to _un_set an assignment, so Unassign won't be an option outside of it.

I'll update table view to match!

Comment thread src/app/components/elements/Gameboards.tsx Outdated
Comment thread src/app/components/pages/SetAssignments.tsx Outdated
const confirmMessage = board.ownerUserId === user.id && !board.tags?.includes("ISAAC_BOARD")
? `Are you sure you want to unlink your board '${board.title}' from your account? You'll only be able to find it again if you've set it as an assignment.`
: `Are you sure you want to unlink '${board.title}' from your account?`;
if (confirm(confirmMessage)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This has strange interactions with the existing deck deletion code at https://github.com/isaacphysics/isaac-react-app/blob/main/src/app/state/slices/api/gameboards.ts#L162.

  • An admin may get two popups in a row when unlinking a deck that has been assigned - it feels like we can combine these into one.
  • A non-admin gets an error after they have confirmed unlinking in this same scenario. If we want to maintain requiring a teacher to be linked to a deck while it is assigned, we shouldn't have that confirmation box appear in the scenario and should just fail early.
    • That said, maybe we shouldn't be enforcing it in this new system anyway? It was already inconsistent for groups with multiple managers (since only one manager would need to be linked to and set the assignment for it to apply to that whole group), and since saving is now a much more separate/manually controlled action, it seems more consistent to give them full control over saving.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agree with your last point; to me, the spirit of these changes are to make saving a completely separate interaction to creating, assigning, etc. You should be free to unsave a deck if you're done with it, regardless of whether it is assigned, so long as it is still accessible from somewhere. Right now, this last point is not met, since I have not yet done the changes to Set Assignments; but when that shows all assigned decks, this should work as expected.

I've removed the whole chunk of code around stopping this; it's obviously a little weird right now with not being able to access assigned ones, but this should be resolved soon.

const user = useAppSelector(selectors.user.loggedInOrNull);

const [justLinked, setJustLinked] = useState(false);
const isLinked = useMemo(() => board.savedToCurrentUser || justLinked, [board, justLinked]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems to be an API issue, but I'll leave a comment here while it's on my mind and it can be worked on later like the other known issues. This board.savedToCurrentUser is not behaving as it should for gameboard pages themselves. The board appears as saved if and only if the user has attempted any questions on it (as would've previously created a link).

Using the button does successfully save/unsave boards if in the right state to do so, but that state does not reflect the actual saved-ness of the board and whether it shows up in "My saved decks".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, thanks for spotting this. There's a card for savedToCurrentUser not working for My Assignments and book pages, but this seems to be a third case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants