Remote Content Browsing: Clean the library page when displaying other available libraries#10216
Remote Content Browsing: Clean the library page when displaying other available libraries#10216AllanOXDi wants to merge 13 commits intolearningequality:developfrom AllanOXDi:remote_content_browsing_functionality
Conversation
Build Artifacts
|
nucleogenesis
left a comment
There was a problem hiding this comment.
Overall code looks good.
I think that making the allDevices prop a bit safer or required would help a bit. Note that making it required will just mean that Vue will complain to you in the devtools whenever you don't pass a value to the prop - so it may just be worth doing null checks before reading into the object in any case.
| allDevices: { | ||
| type: Object, | ||
| required: false, | ||
| default: null, | ||
| }, |
There was a problem hiding this comment.
With default: null here you can run into an issue where if the prop is not provided at all it can result in a Error: Cannot read properties of null/undefined in any code that tries to read into allDevices, which they assume is an object.
It doesn't look like you're checking for if it's nullish before you try to read from the object's value (ie, your v-if around line 7) -- so if allDevices really isn't required, then making the default value {} or checking if allDevices is null before reading from it (or maybe using the ?.) would be safer.
| if (device['operating_system'] === 'Darwin') { | ||
| return 'laptop'; |
There was a problem hiding this comment.
Since we default at the end to showing a laptop this seems unnecessary -- is there some particular reason we should check first for "Darwin" before "Android" or could we remove the first if here to the same effect?
| methods: { | ||
| getDeviceIcon(device) { | ||
| if (device['operating_system'] === 'Darwin') { | ||
| return 'laptop'; |
There was a problem hiding this comment.
Please see comment above from @nucleogenesis regarding this.
akolson
left a comment
There was a problem hiding this comment.
Hi @AllanOXDi, Great work. Code generally LGTM. I have left some comments that will help improve the code even further.
There was a problem hiding this comment.
Just a general comment on PinnedNetworkResources and PinnedNetworkResources components. It is probably better to load the devices alongside there channels in this file and just pass the results as props to the components since they are in the same file. This comes with benefits like better state management, better reloading capabilities and most importantly implementing the DRY(Don't repeat yourself) principal.
| }, | ||
| setup() { | ||
| const { windowBreakpoint } = useKResponsiveWindow(); | ||
| const { baseurl, fetchDevices } = useDevices(); |
There was a problem hiding this comment.
Please see my general comment on the LibraryPage/index.,vue file
There was a problem hiding this comment.
Please see my general comment on the LibraryPage/index.,vue file
akolson
left a comment
There was a problem hiding this comment.
Overall code looks good. Thanks @AllanOXDi. Just a final change and we should be good for merging
| </h2> | ||
| <div> | ||
| <h2>{{ $tr('moreLibraries') }}</h2> | ||
| <MoreNetworkDevices /> |
There was a problem hiding this comment.
I think applying the same concept as seen with PinnedNetworkResources would work great. Creating an unpinnedDevices data property and passing it into the PinnedNetworkResources as a prop would help with refreshing state of these devices(I think there is a refresh button somewhere). That would mean also getting rid of the fetchDevices and fetchChannels in the MoreNetworkDevices component as it would not be necessary since you are passing the content(devices and their channels) as props. For now its okay for them to display the same devices. Later we can apply filtering based on results returned from the pinning API that we co-hacked with Jacob yesterday
| return 'laptop'; | ||
| } | ||
| }, | ||
| }, |
There was a problem hiding this comment.
I had to add another } here when running locally.
|
Hi @AllanOXDi - I was doing a little bit of manual QA on this and I noticed that the channel cards that are displayed here are my channels, not the channels of the remote devices. Maybe this PR is just for the card implementation, but I just wanted to mention this because I am not sure if it was intentional, and in case we need a follow up issue for it. It looks like the Explore Libraries page that @akolson was working on has this in place, so maybe it's just a matter of a follow up issue using the pattern there. Nice work overall! Great to see this Library Page coming along so well :) |
|
@marcellamaki thanks for raising this. Based on the design spec, i think we shouldn't be having this |
| return this.coreString('channelsLabel'); | ||
| } | ||
| }, | ||
| // ...mapGetters(['isUserLoggedIn']), |
There was a problem hiding this comment.
This should be removed completely
| // this.fetchDevices().then(devices => { | ||
| // this.devices = devices.filter(d => d.available); | ||
| // }); | ||
| // } |
There was a problem hiding this comment.
All commented code should be removed completely
| refresh: { | ||
| message: 'Refresh', | ||
| context: 'Link for refreshing library', | ||
| }, |
There was a problem hiding this comment.
I think adding/moving around translations strings has been suspended for now due to the string freeze. cc @marcellamaki @radinamatic
There was a problem hiding this comment.
I think these strings were already in. Might have come due to a rebase yesterday
There was a problem hiding this comment.
I just checked and the refresh string already exists in the commonCoreStrings.js. So using this instead and deleting the new one would be an acceptable solution to this.
| required: false, | ||
| default: null, | ||
| }, | ||
| isPinned: { |
There was a problem hiding this comment.
I think this prop is misleading. I think the wifi icon is meant to specify whether the resource is available or not. @jtamiace , @marcellamaki ?
| <div | ||
| style="text-align:right;margin-right:10px;margin-top:10px" | ||
| > | ||
| <KIcon v-if="isPinned" icon="wifi" /> |
There was a problem hiding this comment.
I think the v-if="isPinned" directive should be moved to the parent(div) as hiding just the KIcon will leave additional margins that may not be desirable. Also, see my comments below regarding the isPinned prop
There was a problem hiding this comment.
This file should be deleted as its no longer used in light of the discussion here
akolson
left a comment
There was a problem hiding this comment.
Thanks @AllanOXDi! Code looks good. Just a few minor changes and we should be good to go!
|
Closing this PR again. It's giving me a nightmare updating it.Probably because I deleted a base branch. Please see #10354. Sorry! |

Summary
This PR clean the library page when displaying other available libraries.
References
Reviewer guidance
Please see the figma design
Testing checklist
PR process
Reviewer checklist
yarnandpip)