-
Notifications
You must be signed in to change notification settings - Fork 713
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 hybrid learning card grid #9063
Refactor hybrid learning card grid #9063
Conversation
9fd63b6
to
a0038fd
Compare
@pcenov Let's give this a walk-through with built assets (EXE, DEB & APK), thank you! |
Thanks so much @pcenov -- will address these today! |
@pcenov -- the first three errors seemed to all be due to me accidentally passing a wrong piece of data, so I think I've solved that and will update shortly 🎉 For
one question: is this issue present on all pages, or is it just the bookmarks page? i.e. is it broken on the Library page too? Thank you! |
Yup, it's persistent on all pages. |
Hi @pcenov and @radinamatic -- I've pushed the changes to fix the first 3 issues. I tested the fourth issue in a virtual IE browser and was able to replicate it. I checked out the current version of 0.15.x and it seems to exist there too. So, @pcenov I think you might have found an existing bug. At first I thought perhaps it was from the card refactor Devon and I worked on that was just recently merged, but it seems to be existing on both the bookmarks cards (which were refactored) and the library page (which was not).... At some point, could one of you double check to see if this is a problem on 0.15.x? I want to make sure, just since I am testing this not on an actual windows machine with IE. But, with my virtual browser, I am getting some weirdness with buttons in general (see below -- I clicked on each button that I hover over, but none of those clicks caused anything to happen 🤪), so I'm not sure quite what is going on. It's not urgent, since this won't be merged right away. |
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.
Things look good here to me. Just a note on a way to make the tests a bit more robust. Let me know if you run into issues with it.each
if you end up taking that route.
kolibri/plugins/learn/assets/src/views/LibraryAndChannelBrowserMainContent.vue
Show resolved
Hide resolved
expect(wrapper.find('[data-test="non-mobile-card-grid"]').element).toBeTruthy(); | ||
expect(wrapper.find('[data-test="content-card"]').element).toBeTruthy(); | ||
}); | ||
it('does not display a `CardGrid` with a `ResourceCard` for each content node in a single, full-width column', () => { |
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 and some of the other tests like it doesn't test that "each content node" is rendered rather it only tests that the one in your propsData.contents does. Testing two would better cover the condition and wouldn't be too hard to do manually - you could try making each card's data-test dynamically generated :data-test="'content-card-' + idx"
and then assert that they both show up. If you want to test more than two to be even safer, then it.each
might help.
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.
@nucleogenesis -- thanks for the help here. I've updated the tests now that we're ready to merge into develop again. Let me know if they are similar to what you were thinking. Thanks!
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.
Yup this is great! Thanks Marcella!
Hi @marcellamaki retested with the latest builds on Windows, Ubuntu and Android and I confirm that the search issues are now fixed and there are no other issues. Awesome! |
… since no grid is used on the page
…r and replaces the HybridLearningCardGrid for these pages
…ince no grid is used on the page
… there is a single card
6fa3db3
to
83dfbaf
Compare
Does this need any further testing review @marcellamaki or did you re-request my review re: the tests only? |
Just for the tests! Thanks @nucleogenesis ! |
Summary
Removes
HybridLearningCardGrid
Fixes #9004
Fixes #8983
HybridLearningCardGrid
was clearly doing too much, and not doing any of it especially well. I approached refactoring by "unabstracting" to hopefully make things simpler.For the Library and Topics pages, which continued to have very similar layouts and variation only in the number of columns, I created a new component called
LibraryAndChannelBrowserMainContent
with just the elements fromHybridLearningCardGrid
that were needed for these two pages. This new component uses the existingCardGrid
component for grid displays as needed. It also has associated tests 🎉(Separately, I've gotten extremely reasonable/helpful feedback from @sairina that the mismatch between channel cards and
TopicsPage
is confusing. This is a first step in moving towards more consistent naming.)For the Bookmarks page and lessons playlist page, there was no need for grids at all, as the content is displayed in "list" style cards. The relevant cards were added directly to their pages.
This approach I think remedies my previous poor decision of
HybridLearningCardGrid
having to keep track of which page it was on, to know what to display, and overall makes the card displays less brittle. It also reduces the number of levels which props and events need to traverse on some pages, which is nice! I do not think this makes the code any shorter, but hopefully this is a step in the right direction towards readability and maintainability.Suggestions for other improvements, and whether they are blocking or follow-up, would be welcome and helpful!
…
Reviewer guidance
Because this refactor touched a lot of the learn pages, I have done my best to layout what would need to be reviewed for manual QA.
Lesson page
(Home Page > Your Classes > Your lessons > [Lesson]
Library Page
Topics/Channel Browsing Page
Bookmarks page
Overall
tl;dr --manual QA should elicit a response somewhat like "Why has Marcella spent several days on this code? nothing is different??"
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)