diff --git a/kolibri/plugins/learn/assets/src/views/ExploreLibrariesPage/LibraryItem.vue b/kolibri/plugins/learn/assets/src/views/ExploreLibrariesPage/LibraryItem.vue
index 569c37df1a8..10a5c510193 100644
--- a/kolibri/plugins/learn/assets/src/views/ExploreLibrariesPage/LibraryItem.vue
+++ b/kolibri/plugins/learn/assets/src/views/ExploreLibrariesPage/LibraryItem.vue
@@ -54,7 +54,7 @@
@@ -123,11 +123,6 @@
required: true,
default: null,
},
- totalChannels: {
- type: Number,
- required: false,
- default: 0,
- },
showDescription: {
type: Boolean,
required: false,
@@ -140,6 +135,18 @@
},
},
computed: {
+ cardsPerRow() {
+ if (this.windowIsSmall) {
+ return 1;
+ }
+ if (this.windowBreakpoint < 4) {
+ return 2;
+ }
+ if (this.windowBreakpoint < 6) {
+ return 3;
+ }
+ return 4;
+ },
layoutSpan() {
/**
* The breakpoints below represent the window widths
@@ -156,13 +163,16 @@
* For example, if the total number of columns is 12, and
* column span for each cards is 4, then X is 3.
*/
- let span = 3;
- if ([0, 1, 2, 6].includes(this.windowBreakpoint)) {
- span = 4;
- } else if ([3, 4, 5].includes(this.windowBreakpoint)) {
- span = 6;
+ if (this.windowBreakpoint < 2) {
+ return 4 / this.cardsPerRow;
}
- return span;
+ if (this.windowBreakpoint === 2) {
+ return 8 / this.cardsPerRow;
+ }
+ return 12 / this.cardsPerRow;
+ },
+ totalChannels() {
+ return this.channels.length;
},
},
$trs: {
diff --git a/kolibri/plugins/learn/assets/src/views/ExploreLibrariesPage/index.vue b/kolibri/plugins/learn/assets/src/views/ExploreLibrariesPage/index.vue
index 3047cf8b968..b286ce41f48 100644
--- a/kolibri/plugins/learn/assets/src/views/ExploreLibrariesPage/index.vue
+++ b/kolibri/plugins/learn/assets/src/views/ExploreLibrariesPage/index.vue
@@ -21,7 +21,7 @@
-
+
@@ -80,6 +80,7 @@
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import { crossComponentTranslator } from 'kolibri.utils.i18n';
import commonLearnStrings from '../commonLearnStrings';
+ import FadeInTransitionGroup from '../FadeInTransitionGroup';
import useContentLink from '../../composables/useContentLink';
import useDevices from '../../composables/useDevices';
import usePinnedDevices from '../../composables/usePinnedDevices';
@@ -91,6 +92,7 @@
export default {
name: 'ExploreLibrariesPage',
components: {
+ FadeInTransitionGroup,
ImmersivePage,
LibraryItem,
},
diff --git a/kolibri/plugins/learn/assets/src/views/FadeInTransitionGroup.vue b/kolibri/plugins/learn/assets/src/views/FadeInTransitionGroup.vue
new file mode 100644
index 00000000000..d3afd92a6f7
--- /dev/null
+++ b/kolibri/plugins/learn/assets/src/views/FadeInTransitionGroup.vue
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kolibri/plugins/learn/assets/src/views/LibraryPage/MoreNetworkDevices.vue b/kolibri/plugins/learn/assets/src/views/LibraryPage/MoreNetworkDevices.vue
index 176509c5947..2c2c80ad061 100644
--- a/kolibri/plugins/learn/assets/src/views/LibraryPage/MoreNetworkDevices.vue
+++ b/kolibri/plugins/learn/assets/src/views/LibraryPage/MoreNetworkDevices.vue
@@ -9,6 +9,7 @@
>
@@ -53,6 +54,13 @@
type: Array,
required: true,
},
+ deviceChannelsMap: {
+ type: Object,
+ required: true,
+ default() {
+ return {};
+ },
+ },
},
computed: {
layoutSpan() {
diff --git a/kolibri/plugins/learn/assets/src/views/LibraryPage/PinnedNetworkResources.vue b/kolibri/plugins/learn/assets/src/views/LibraryPage/PinnedNetworkResources.vue
index d1515ecc694..5fa3d05b1da 100644
--- a/kolibri/plugins/learn/assets/src/views/LibraryPage/PinnedNetworkResources.vue
+++ b/kolibri/plugins/learn/assets/src/views/LibraryPage/PinnedNetworkResources.vue
@@ -3,34 +3,36 @@
-
-
-
-
- {{ device.device_name }}
-
-
-
+
-
-
+
+
+
+ {{ device.device_name }}
+
-
+
+
+
+
+
-
+
+
@@ -41,6 +43,7 @@
import useKResponsiveWindow from 'kolibri.coreVue.composables.useKResponsiveWindow';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import useContentLink from '../../composables/useContentLink';
+ import FadeInTransitionGroup from '../FadeInTransitionGroup';
import ChannelCard from '../ChannelCard';
import ChannelCardGroupGrid from './../ChannelCardGroupGrid';
@@ -49,6 +52,7 @@
components: {
ChannelCard,
ChannelCardGroupGrid,
+ FadeInTransitionGroup,
},
mixins: [commonCoreStrings],
setup() {
@@ -67,6 +71,17 @@
return [];
},
},
+ deviceChannelsMap: {
+ type: Object,
+ required: true,
+ default() {
+ return {};
+ },
+ },
+ channelsToDisplay: {
+ type: Number,
+ required: true,
+ },
},
computed: {
layoutSpan() {
diff --git a/kolibri/plugins/learn/assets/src/views/LibraryPage/UnPinnedDevices.vue b/kolibri/plugins/learn/assets/src/views/LibraryPage/UnPinnedDevices.vue
index bceedc06490..a237db31b7f 100644
--- a/kolibri/plugins/learn/assets/src/views/LibraryPage/UnPinnedDevices.vue
+++ b/kolibri/plugins/learn/assets/src/views/LibraryPage/UnPinnedDevices.vue
@@ -71,6 +71,10 @@
type: Object,
required: true,
},
+ channelCount: {
+ type: Number,
+ default: 0,
+ },
routeTo: {
type: Object,
required: true,
@@ -90,9 +94,6 @@
textAlign: 'center',
};
},
- channelCount() {
- return this.device['total_count'] || 0;
- },
deviceName() {
return this.device.nickname || this.device.device_name;
},
diff --git a/kolibri/plugins/learn/assets/src/views/LibraryPage/index.vue b/kolibri/plugins/learn/assets/src/views/LibraryPage/index.vue
index e400a69487d..f6a0a249f5d 100644
--- a/kolibri/plugins/learn/assets/src/views/LibraryPage/index.vue
+++ b/kolibri/plugins/learn/assets/src/views/LibraryPage/index.vue
@@ -143,6 +143,8 @@
v-if="pinnedDevicesExist"
data-test="pinned-resources"
:devices="pinnedDevices"
+ :deviceChannelsMap="deviceChannelsMap"
+ :channelsToDisplay="cardsPerRow * 2 - 1"
/>
@@ -156,6 +158,7 @@
v-if="unpinnedDevicesExist"
data-test="more-devices"
:devices="unpinnedDevices"
+ :deviceChannelsMap="deviceChannelsMap"
/>
@@ -520,6 +523,18 @@
? { marginRight: `${this.sidePanelWidth + 24}px`, marginTop }
: { marginLeft: `${this.sidePanelWidth + 24}px`, marginTop };
},
+ cardsPerRow() {
+ if (this.windowIsSmall) {
+ return 1;
+ }
+ if (this.windowBreakpoint < 5) {
+ return 2;
+ }
+ if (this.windowBreakpoint < 6) {
+ return 3;
+ }
+ return 4;
+ },
layoutSpan() {
/**
* The breakpoints below represent the window widths
@@ -530,19 +545,20 @@
* 4: < 1280px | Large screen | 12 columns
* 5: < 1440px | Large screen | 12 columns
* 6: < 1600px | Large screen | 12 columns
+ * 7: > 1600px | Large screen | 12 columns
*
* On resize, display X cards per row where:
* X = total columns in grid / column span for each card.
* For example, if the total number of columns is 12, and
* column span for each cards is 4, then X is 3.
*/
- let span = 3;
- if ([0, 1, 2, 6].includes(this.windowBreakpoint)) {
- span = 4;
- } else if ([3, 4, 5].includes(this.windowBreakpoint)) {
- span = 4;
+ if (this.windowBreakpoint < 2) {
+ return 4 / this.cardsPerRow;
+ }
+ if (this.windowBreakpoint === 2) {
+ return 8 / this.cardsPerRow;
}
- return span;
+ return 12 / this.cardsPerRow;
},
pinnedDevices() {
return this.networkDevicesWithChannels.filter(device => {