WikiEduDashboard icon indicating copy to clipboard operation
WikiEduDashboard copied to clipboard

refactor training pages to allow rendering on client-side instead of …

Open sharon-odhiambo opened this issue 2 years ago • 9 comments

What this PR does

Whenever a user is logged in wiki-education mode, they are able to access the get help button. The button is however not available when the user launches the training modules from the course page. This PR solves that problem: Refactoring the training libraries page from the server side rendering by refactoring the index.html.erb to a React component Refactoring a single library page from the server side to the client side

This PR addresses issue https://github.com/WikiEducationFoundation/WikiEduDashboard/issues/5486

Screenshots

After: This video shows the affected pages functionalities and visual appearance. Screencast from 10-24-2023 02:09:35 AM.webm

sharon-odhiambo avatar Oct 24 '23 00:10 sharon-odhiambo

Hi @ragesoss . This PR is ready for review.

sharon-odhiambo avatar Oct 25 '23 09:10 sharon-odhiambo

Thanks! This is a deeper React conversion than what I was suggesting — it converts the entire Training and Module views, rather than just implementing the nav in React and leaving the rest as server-rendered.

This is potentially good, and it looks like you've basically got it working!

One thing I notice as I try it out is that the 'No Libraries' message flashes briefly whenever you load the training index. The first render of any of these pages should avoid flashing any temporary messages like that.

ragesoss avatar Oct 26 '23 16:10 ragesoss

Thanks! This is a deeper React conversion than what I was suggesting — it converts the entire Training and Module views, rather than just implementing the nav in React and leaving the rest as server-rendered.

This is potentially good, and it looks like you've basically got it working!

One thing I notice as I try it out is that the 'No Libraries' message flashes briefly whenever you load the training index. The first render of any of these pages should avoid flashing any temporary messages like that.

Hi @ragesoss . Sure, lemme check this out. And thank you for the feedback.

sharon-odhiambo avatar Oct 27 '23 18:10 sharon-odhiambo

Hi @ragesoss, so I was working on getting the module progress and I think this is ready now. However, I have 3 specs failing, in relation to the flashing messages. Initially the messages were only showing when @libraries.empty? is truthy. Currently though, that also seems to be truthy while the data is loading. Can you kindly assist on how I can counter that? I've moved the messages rendering to the controller as before but the specs are still failing.

sharon-odhiambo avatar Nov 02 '23 20:11 sharon-odhiambo

Hmm... I'm not sure. On the server, @libraries ought to be set by the time it renders, as Rails will wait until the data is loaded in that controller code before moving on. However, I think it would be ideal to move the message to React, and just not show it until after the data has been fetched and received... then only show it at that point if an empty array was received for Libraries.

ragesoss avatar Nov 02 '23 22:11 ragesoss

Hi @ragesoss . So after updating this as advised, there are 2 specs that are failing from the training _tool_spec. However when I try to clear the libraries list using my rails console I get the no libraries message so I'm not entirely sure why it's still failing. I've worked on all the features for rendering the training pages on the client-side and this PR is ready. I would appreciate any help on anything else I need to do.

sharon-odhiambo avatar Nov 06 '23 16:11 sharon-odhiambo

Hmm... I'm not sure what is going wrong. I suggest running the failing test locally with headless mode turned off (by removing the headless arg in rails_helper.rb).

ragesoss avatar Nov 07 '23 20:11 ragesoss

@sharon-odhiambo what's the status of this? it looks like some of the training-specific tests are still failing; were they passing for you locally? anything you are stuck with that i can try to get you unstuck with?

ragesoss avatar Dec 04 '23 20:12 ragesoss

Hi @ragesoss , the tests weren't passing locally when I run them but when I check the page when my database is empty the messages appear for both wiki edu and non-wiki edu mode. I'm not sure how to go about it from here. I'll appreciate any help.

sharon-odhiambo avatar Dec 05 '23 16:12 sharon-odhiambo

Sorry, I didn't get a chance to dive into this to provide advice to get you unstuck. I'm going to close this now, as it overlaps with some work we're doing with the trainings currently, so it will be best to start fresh if/when someone returns to it.

ragesoss avatar Jun 20 '24 19:06 ragesoss