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

Fix no resources available" instead of the available libraries #13184

Merged

Conversation

AllanOXDi
Copy link
Member

@AllanOXDi AllanOXDi commented Mar 11, 2025

Summary

Fixes the showing of "No resources available" instead of the available other libraries.

Before

image

After

Library0.17.5.mp4

closes #13071

References

#13071

@github-actions github-actions bot added APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: frontend labels Mar 11, 2025
@LianaHarris360
Copy link
Member

Tagging @radinamatic @pcenov for QA review

@radinamatic
Copy link
Member

Assets from this PR were tested on both Ubuntu and Windows 11, and the originally reported issue is indeed corrected.

learn-library

However, in the scenario that we were discussing on Slack with @rtibbles, when there are no resources in the library and no peers in the local network:

  • admin would (eventually) see the channels on Kolibri Studio (as in the screenshot), but
  • non-admin users would see a rather empty page, which is not ideal

For that reason @rtibbles suggested we would want that page to be more dynamic based on whether there are local libraries available, and preserve the messaging from the content unavailable page for the empty state.

So the idea is for the non-admin users to keep the current change from this PR IF there are other peers in the local network (and something does appear under the Other libraries). And in case there are no other peers around, and the class server has no channels, display the No resources available heading and Ask your coach or administrator for assistance below.

cc @marcellamaki @jtamiace

Copy link
Member

@LianaHarris360 LianaHarris360 left a comment

Choose a reason for hiding this comment

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

I’m seeing the CONTENT_UNAVAILABLE page as an admin when I should be able to browse channels on Kolibri Studio.
Screenshot 2025-03-19 at 11 37 36 AM

Based on Radina’s comment, I believe the CONTENT_UNAVAILABLE page should only displayed for non-admin users if there are no peers in the local network and no channels.

When there are no channels and no other libraries for the learner to browse, I currently see the LibraryPage:
learnerNoChannels

But in this case, a learner should see the ContentUnavailablePage with the message Ask your coach or administrator for assistance instead:
LearnerNoContent2

@radinamatic
Copy link
Member

Thank you @LianaHarris360 for including the screenhots of what @rtibbles was suggesting. I thought of trying to mock that alongside my description, but it would have certainly taken me much more time! 🙏🏽

@rtibbles
Copy link
Member

I think let's pull the body of this component out into a separate component: https://github.com/learningequality/kolibri/blob/develop/kolibri/plugins/learn/assets/src/views/ContentUnavailablePage.vue - reuse it in the page there, and then also display it within the context of the LibraryPage.vue? That will allow us to continue to have the Content Unavailable page when we need to - but also mean we can show the appropriate language if there are no channels available, but also still display any locally available libraries (or Studio in the case of a super admin).

@AllanOXDi @LianaHarris360 does that make sense as an approach here?

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Still not quite cleanly handling this empty state without side effects. I trust you are testing this with a clean Kolibri home directory to see how this renders?

The goal here is to retain our previous messaging in the case of a truly empty state, while also not blocking browsing of remote or local libraries when they are available.

@@ -0,0 +1,90 @@
<template>

<LearnAppBarPage :appBarTitle="learnString('learnLabel')">
Copy link
Member

Choose a reason for hiding this comment

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

Rather than duplicating the component completely - my suggestion was to make a component that represented the body of the ContentUnavailablePage component (everything but the LearnAppBarPage component) and then reuse it in the LibraryPage and the ContentUnavailablePage.

Doing this has caused us to have two LearnAppBarPage components, one nested inside the other:

image

@@ -77,7 +81,7 @@
/>
<!-- Other Libraries -->
<OtherLibraries
v-if="showOtherLibraries"
v-if="showOtherLibraries && !isLearner"
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why we're now hiding the other libraries from learners?

This basically creates no change from the previous experience for learners, even though there are browsable libraries on the network:

image

router.replace({ name: PageNames.CONTENT_UNAVAILABLE });
return;
if (!channels.length) {
set(isChannelEmpty, true);
Copy link
Member

Choose a reason for hiding this comment

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

Don't need to add this, we're already tracking this with isLocalLibraryEmpty.

>
{{ coreString('nothingInLibraryLearner') }}
</p>
<NoResourcePage v-if="isChannelEmpty && isLearner" />
Copy link
Member

Choose a reason for hiding this comment

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

I think we probably want to conditionally show this based on whether there are any libraries around you or not. If there are, we should show the existing message below, if not, then we should show this component.

This will require us to communicate something out of the OtherLibraries component to dynamically update this based on whether any libraries are being shown.

Copy link
Member

Choose a reason for hiding this comment

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

Conditionalizing this on being a learner means that in the completely empty state, we're not showing proper messaging to an admin to prompt them to add resources to the device:

image

@rtibbles rtibbles added the P0 - critical Priority: Release blocker or regression label Mar 24, 2025
@AllanOXDi
Copy link
Member Author

Hi @rtibbles I'm not sure, do we update the view as soon as we discover a library, learner initially doesn't have local libraries on the network but then one joins?

@rtibbles
Copy link
Member

Yes, the OtherLibraries component is checking for other libraries on the network, so we would need a mechanism for it to communicate out when it is displaying libraries or not (probably by emitting an event and having the LibraryPage listening to that).

import commonLearnStrings from '../commonLearnStrings';
export default {
name: 'NoResourcePage',
Copy link
Member

Choose a reason for hiding this comment

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

This is more like "NoResourceComponent" now, I think? And then we could import this into the ContentUnavailablePage to act as the body and avoid the duplication here.

};
},
components: {
LearnAppBarPage,
Copy link
Member

Choose a reason for hiding this comment

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

This component is no longer used here, hence the linting errors.

@AllanOXDi AllanOXDi requested a review from rtibbles March 26, 2025 17:01
Copy link
Member

@LianaHarris360 LianaHarris360 left a comment

Choose a reason for hiding this comment

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

This might not be blocking or could be fixed in a follow-up, but another thing I noticed is that the NoResources component and the OtherLibraries message 'No other libraries around you right now' are displayed before the correct components load, with no indication that the page is still loading. This is more noticeable at slower data speeds.

LibraryPageLoad.mov

@@ -427,6 +429,7 @@
metadataSidePanelContent: null,
mobileSidePanelIsOpen: false,
usingMeteredConnection: true,
isNetworkLibraryAvailable: false,
Copy link
Member

Choose a reason for hiding this comment

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

I think maybe we could address part of @LianaHarris360's concern by defaulting this to true? Then once we've tried to load the network devices, the event you're emitting will then set this to false?

deep: true,
},
},
mounted() {
Copy link
Member

Choose a reason for hiding this comment

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

I suspect using mounted here might be a little flaky, as we don't actually know that the initial data has been loaded at the point of the component being mounted?

Maybe we can use the isLoadingChannels value from the useDevices composable to do an initial trigger here rather than mounted? So the first time that goes from true to false we can then trigger this method.

@rtibbles
Copy link
Member

This is much closer - one other slight issue, when there are resources available on my device, I am seeing this.
image

I think a little bit more cleanup to take care of this, and the "not quite loaded" state that @LianaHarris360 flagged and we should be good to go.

@LianaHarris360 LianaHarris360 dismissed their stale review March 27, 2025 19:17

The initially requested changes have been addressed.

@LianaHarris360
Copy link
Member

@radinamatic Tagging for a QA re-review

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Issues I was seeing previously appear to be resolved - will leave for QA to give the final thumbs up here!

@pcenov
Copy link
Member

pcenov commented Mar 28, 2025

I'll probably have to revisit this on Monday as it is getting late here but so far the only issues I am observing are on slow internet connection where if there are other libraries and I refresh the page I am seeing first the search panel, then "There's nothing in your library yet..." and "No other libraries around you right now", then "No resources available" and after that the correct state:

slow.connection.mp4

Similarly if there are no libraries:

slow.connection.-.no.libraries.mp4

@rtibbles
Copy link
Member

I suspect that these loading state problems have probably been better surfaced by @AllanOXDi's work here, rather than created by it. We'll wait for the rest of @pcenov's review on Monday, but unless there are other significant issues we've not yet encountered, I'd rather put the loading state concerns into a follow up issue rather than block this PR any further.

@pcenov
Copy link
Member

pcenov commented Mar 31, 2025

@rtibbles I have filled a follow-up for the loading state problems. I didn't observe any other issues.

@pcenov
Copy link
Member

pcenov commented Mar 31, 2025

Actually, I had it in my notes to double check how are we proceeding with the following issue where we are now not showing the "No resources available" page to a learner without resources or other libraries:

no resources available

@pcenov
Copy link
Member

pcenov commented Mar 31, 2025

OK - sorry for the confusion, this scenario is also handled correctly now by showing a modified text under "No resources available" which reads: "Ask your coach or administrator for assistance"

2025-03-31_16-11-39

@AllanOXDi AllanOXDi merged commit 02df77a into learningequality:develop Mar 31, 2025
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: frontend P0 - critical Priority: Release blocker or regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Learn > Library - Seeing "No resources available" instead of the available libraries
5 participants