Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion kolibri/plugins/learn/assets/src/views/ChannelCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,19 @@
:value="numCoachContents"
:isTopic="true"
/>

<div
v-if="version"
class="version-wrapper"
:style="versionStyle"
>
<p>{{ $tr('version', { version: version }) }}</p>
</div>
<div
v-if="isPinnedDevice"
class="wifi-icon"
>
<KIcon icon="wifi" />
</div>

</router-link>

Expand Down Expand Up @@ -113,6 +118,11 @@
required: false,
default: null,
},
isPinnedDevice: {
type: Boolean,
required: false,
default: false,
},
},
computed: {
...mapGetters(['isLearner', 'isUserLoggedIn']),
Expand Down Expand Up @@ -212,4 +222,11 @@
}
}

.wifi-icon {
position: absolute;
right: 0;
bottom: 0;
padding: 10px;
}

</style>
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
:tagline="getTagLine(content)"
:numCoachContents="content.num_coach_contents"
:link="genContentLinkBackLinkCurrentPage(content.id, false)"
:isRemote="isRemote"
/>
</KGridItem>
<slot></slot>

</KGrid>

Expand Down Expand Up @@ -42,6 +44,10 @@
type: Array,
required: true,
},
isRemote: {
type: Boolean,
default: false,
},
},
computed: {
cardColumnSpan() {
Expand Down
88 changes: 0 additions & 88 deletions kolibri/plugins/learn/assets/src/views/LibraryPage/CardContent.vue

This file was deleted.

81 changes: 81 additions & 0 deletions kolibri/plugins/learn/assets/src/views/LibraryPage/ExploreCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<template>

<router-link
:to="exploreLibraries"
class="card-main-wrapper"
>
<div class="cards" style="height:270px;">
<div>
<div class="card-title">
<h1>
{{ coreString('explore') }}
</h1>
</div>
</div>
</div>
</router-link>

</template>


<script>

import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import { PageNames } from './../../constants';

export default {
name: 'ExploreCard',
mixins: [commonCoreStrings],
computed: {
exploreLibraries() {
return { name: PageNames.EXPLORE_LIBRARIES };
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 you may want to use a link that goes directly to the library of this device, similar to what @akolson uses within the LibraryItem

      libraryPageRoute() {
        return {
          name: PageNames.LIBRARY,
          params: {
            deviceId: this.deviceId,
          },
        };
      },

To me, if the user is clicking on the explore within a particular library, it seems helpful to bring them to that specific library, rather than the entire "explore libraries" page.

Copy link
Member Author

Choose a reason for hiding this comment

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

That was my initial thought. But when I was chatting with @akolson about this. He suggested that we should route to explore Library page. If I got him right. we could make a follow up issue to address this in a different PR. As this PR is just to display the remote content on the library page?

Copy link
Member

@akolson akolson Apr 3, 2023

Choose a reason for hiding this comment

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

Hi @AllanOXDi, I think I didn't understand the context of your question, my apologies, but Marcella is right about how this should be implemented and swapping out the current exploreLibraries property for the libraryPageRoute property as suggested Marcella should do the trick without having to open a different PR as i think we already have a devivcId prop within LibraryPage component. Please confirm this if you get to proceed with this :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Great! Thanks, I have updated it.

},
},
created() {},
methods: {},
};

</script>


<style lang="scss" scoped>

@import '~kolibri-design-system/lib/styles/definitions';

$margin: 16px;

.card-main-wrapper {
@extend %dropshadow-1dp;

position: relative;
display: inline-block;
width: 100%;
max-height: 270px;
padding-bottom: $margin;
text-decoration: none;
vertical-align: top;
border-radius: $radius;
transition: box-shadow $core-time ease;

&:hover {
@extend %dropshadow-8dp;
}

&:focus {
outline-width: 4px;
outline-offset: 6px;
}
}

.cards {
margin: auto;
text-align: center;
}

.card-title {
margin: auto;
margin-top: 100px;
letter-spacing: normal;
}

</style>
Original file line number Diff line number Diff line change
@@ -1,48 +1,53 @@
<template>

<KGrid>
<KGridItem
v-for="device in devices"
:key="device.id"
:layout="{ span: cardColumnSpan, alignment: 'auto' }"
>
<UnPinnedDevices
:deviceName="device.device_name"
:channels="device.channels"
/>
</KGridItem>
</KGrid>
<div>
<KGrid>
<KGridItem
v-for="device in devices"
:key="device.id"
:layout="{ span: cardColumnSpan, alignment: 'auto' }"
>
<UnPinnedDevices
:deviceName="device.device_name"
:channels="device.channels.length"
:allDevices="device"
:operatingSystem="device.operatingSystem"
/>
</KGridItem>
<slot></slot>
</KGrid>
</div>

</template>


<script>

import useKResponsiveWindow from 'kolibri.coreVue.composables.useKResponsiveWindow';
import useDevices from '../../composables/useDevices';
import useChannels from '../../composables/useChannels';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import UnPinnedDevices from './UnPinnedDevices';

export default {
name: 'MoreNetworkDevices',
components: {
UnPinnedDevices,
},
mixins: [commonCoreStrings],
setup() {
const { windowBreakpoint } = useKResponsiveWindow();
const { fetchChannels } = useChannels();
const { baseurl, fetchDevices } = useDevices();
const { windowBreakpoint, windowGutter } = useKResponsiveWindow();
return {
baseurl,
fetchDevices,
fetchChannels,
windowBreakpoint,
windowGutter,
};
},
props: {
devices: {
type: Array,
required: true,
},
},
data() {
return {
devices: [],
};
return {};
},
computed: {
cardColumnSpan() {
Expand All @@ -52,16 +57,14 @@
return 3;
},
},
created() {
this.fetchDevices().then(devices => {
const device = devices.filter(d => d.available);
device.forEach(element => {
this.fetchChannels({ baseurl: element.baseurl }).then(channel => {
element['channels'] = channel.length;
});
this.devices.push(element);
});
});
mounted() {
this.setNetworkDeviceChannels(this.devices, this.devices, this.devices.length);
},
methods: {
setNetworkDeviceChannels(device, channels, total) {
this.$set(device, 'channels', channels.slice(0, 4));
this.$set(device, 'total_channels', total);
},
},
};

Expand Down
Loading