Add loading message to activities and refactor the module and intrument activities
This commit is contained in:
parent
595332825a
commit
bc715a937f
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="content-bookmark module-activity-entry">
|
<div class="content-bookmark module-activity-entry" v-if="content">
|
||||||
<!-- eslint-disable vue/no-v-html -->
|
<!-- eslint-disable vue/no-v-html -->
|
||||||
<div
|
<div
|
||||||
v-if="content.type === 'text_block'"
|
v-if="content.type === 'text_block'"
|
||||||
|
|
@ -30,7 +30,7 @@ export default {
|
||||||
content() {
|
content() {
|
||||||
return this.bookmark.contentBlock
|
return this.bookmark.contentBlock
|
||||||
? this.bookmark.contentBlock.contents.find((e) => e.id === this.bookmark.uuid)
|
? this.bookmark.contentBlock.contents.find((e) => e.id === this.bookmark.uuid)
|
||||||
: this.bookmark.instrument.contents.find((e) => e.id === this.bookmark.uuid);
|
: this.bookmark.instrument?.find((e) => e.id === this.bookmark.uuid);
|
||||||
},
|
},
|
||||||
text() {
|
text() {
|
||||||
return this.content.value.text ? this.content.value.text : 'TO BE DEFINED';
|
return this.content.value.text ? this.content.value.text : 'TO BE DEFINED';
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
{{ type }}
|
{{ type }}
|
||||||
</h3>
|
</h3>
|
||||||
<h2 class="instrument-activity__title">
|
<h2 class="instrument-activity__title">
|
||||||
{{ instrument.title }}
|
{{ instrument.title }}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="instrument-activity__tasks activity-tasks">
|
<div class="instrument-activity__tasks activity-tasks">
|
||||||
<activity-entry
|
<activity-entry
|
||||||
|
|
@ -22,11 +22,11 @@
|
||||||
<activity-entry
|
<activity-entry
|
||||||
title="Notiz"
|
title="Notiz"
|
||||||
class="instrument-activity__entry"
|
class="instrument-activity__entry"
|
||||||
v-for="note in notes"
|
v-for="noteBookmark in notes"
|
||||||
:key="note.id"
|
:key="noteBookmark.id"
|
||||||
@link="goTo(note.id)"
|
@link="goTo(noteBookmark.note.id)"
|
||||||
>
|
>
|
||||||
{{ note.text }}
|
{{ noteBookmark.note.text }}
|
||||||
</activity-entry>
|
</activity-entry>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -48,10 +48,10 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
empty() {
|
empty() {
|
||||||
return !this.instrument.bookmarks.length;
|
return !(this.bookmarks.length || this.notes.length);
|
||||||
},
|
},
|
||||||
notes() {
|
notes() {
|
||||||
return this.applyFilter('notes') ? this.instrument.bookmarks.filter((b) => b.note).map((b) => b.note) : [];
|
return this.applyFilter('notes') ? this.instrument.bookmarks.filter((b) => b.note) : [];
|
||||||
},
|
},
|
||||||
bookmarks() {
|
bookmarks() {
|
||||||
return this.applyFilter('bookmarks') ? this.instrument.bookmarks : [];
|
return this.applyFilter('bookmarks') ? this.instrument.bookmarks : [];
|
||||||
|
|
@ -63,6 +63,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['scrollToAssignmentId']),
|
...mapActions(['scrollToAssignmentId']),
|
||||||
goTo(scrollTo) {
|
goTo(scrollTo) {
|
||||||
|
// TODO: fix this part, with instruments it does not navigate to the bookmark itself. (added in support case 6.9.2023)
|
||||||
const url = `/instrument/${this.instrument.slug}/`;
|
const url = `/instrument/${this.instrument.slug}/`;
|
||||||
this.$apollo.mutate({
|
this.$apollo.mutate({
|
||||||
mutation: SCROLL_TO_MUTATION,
|
mutation: SCROLL_TO_MUTATION,
|
||||||
|
|
|
||||||
|
|
@ -23,17 +23,17 @@
|
||||||
class="module-activity__entry"
|
class="module-activity__entry"
|
||||||
v-for="answer in answers"
|
v-for="answer in answers"
|
||||||
:key="answer.id"
|
:key="answer.id"
|
||||||
@link="goTo(answer.survey.id)"
|
@link="goTo('module', this.module.slug)"
|
||||||
>
|
>
|
||||||
{{ answer.survey.title }}
|
{{ answer.survey.title }}
|
||||||
</activity-entry>
|
</activity-entry>
|
||||||
<activity-entry
|
<activity-entry
|
||||||
title="Lesezeichen ContentBlock"
|
title="Lesezeichen"
|
||||||
class="module-activity__entry"
|
class="module-activity__entry"
|
||||||
:bookmark="bookmark"
|
:bookmark="bookmark"
|
||||||
v-for="bookmark in contentBookmarks"
|
v-for="bookmark in contentBookmarks"
|
||||||
:key="bookmark.id"
|
:key="bookmark.id"
|
||||||
@link="goTo(bookmark.contentBlock.id)"
|
@link="goTo('content', bookmark.contentBlock.id)"
|
||||||
>
|
>
|
||||||
<content-bookmark :bookmark="bookmark" />
|
<content-bookmark :bookmark="bookmark" />
|
||||||
</activity-entry>
|
</activity-entry>
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
class="module-activity__entry"
|
class="module-activity__entry"
|
||||||
v-for="bookmark in chapterBookmarks"
|
v-for="bookmark in chapterBookmarks"
|
||||||
:key="bookmark.id"
|
:key="bookmark.id"
|
||||||
@link="goTo(bookmark.chapter.id)"
|
@link="goTo('content', bookmark.chapter.id)"
|
||||||
>
|
>
|
||||||
{{ bookmark.chapter.description }}
|
{{ bookmark.chapter.description }}
|
||||||
</activity-entry>
|
</activity-entry>
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
:bookmark="noteBookmark"
|
:bookmark="noteBookmark"
|
||||||
v-for="noteBookmark in notes"
|
v-for="noteBookmark in notes"
|
||||||
:key="noteBookmark.note.id"
|
:key="noteBookmark.note.id"
|
||||||
@link="goTo(noteBookmark.contentBlock.id)"
|
@link="goTo('content', noteBookmark.contentBlock ? noteBookmark.contentBlock.id : noteBookmark.chapter.id)"
|
||||||
>
|
>
|
||||||
{{ noteBookmark.note.text }}
|
{{ noteBookmark.note.text }}
|
||||||
</activity-entry>
|
</activity-entry>
|
||||||
|
|
@ -101,13 +101,13 @@ export default {
|
||||||
return this.applyFilter('bookmarks') ? this.module.myContentBookmarks : [];
|
return this.applyFilter('bookmarks') ? this.module.myContentBookmarks : [];
|
||||||
},
|
},
|
||||||
chapterBookmarks() {
|
chapterBookmarks() {
|
||||||
return this.applyFilter('bookmarks') ? this.module.myChapterBookmarks : [];
|
return this.applyFilter('bookmarks') ? this.module.myChapterBookmarks : []
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['scrollToAssignmentId']),
|
...mapActions(['scrollToAssignmentId']),
|
||||||
goTo(scrollTo) {
|
goTo(contentType, scrollTo) {
|
||||||
const url = `/module/${this.module.slug}/`;
|
const url = `/${contentType}/${scrollTo}/`;
|
||||||
this.$apollo.mutate({
|
this.$apollo.mutate({
|
||||||
mutation: SCROLL_TO_MUTATION,
|
mutation: SCROLL_TO_MUTATION,
|
||||||
variables: {
|
variables: {
|
||||||
|
|
@ -116,6 +116,7 @@ export default {
|
||||||
});
|
});
|
||||||
this.$router.push(url);
|
this.$router.push(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
applyFilter(filterCriteria) {
|
applyFilter(filterCriteria) {
|
||||||
return !this.filter || this.filter === filterCriteria;
|
return !this.filter || this.filter === filterCriteria;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<template>
|
||||||
|
<div class="info-message">
|
||||||
|
<info-icon class="info-message__icon" />
|
||||||
|
<span class="info-message__text"><slot></slot> </span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import InfoIcon from '@/components/icons/InfoIcon.vue';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import 'styles/helpers';
|
||||||
|
|
||||||
|
.info-message {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&__icon {
|
||||||
|
width: $large-icon-dimension;
|
||||||
|
height: $large-icon-dimension;
|
||||||
|
fill: $color-brand;
|
||||||
|
margin-right: $small-spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__text {
|
||||||
|
@include regular-text;
|
||||||
|
color: $color-brand;
|
||||||
|
margin-right: $medium-spacing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="loading-message">
|
<div class="loading-message">
|
||||||
<loading-spinner class="loading-message__spinner" />
|
<loading-spinner class="loading-message__spinner" style="
|
||||||
|
--spinner-size: 40px; "/>
|
||||||
<span class="loading-message__text"><slot></slot> </span>
|
<span class="loading-message__text"><slot></slot> </span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -18,15 +19,13 @@ import LoadingSpinner from "@/components/ui/loadingSpinner.vue";
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
&__icon {
|
&__icon {
|
||||||
width: $large-icon-dimension;
|
|
||||||
height: $large-icon-dimension;
|
|
||||||
fill: $color-brand;
|
|
||||||
margin-right: $large-spacing;
|
margin-right: $large-spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__text {
|
&__text {
|
||||||
@include regular-text;
|
@include regular-text;
|
||||||
color: $color-brand;
|
color: $color-brand;
|
||||||
|
margin-left: $medium-spacing;
|
||||||
margin-right: $medium-spacing;
|
margin-right: $medium-spacing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,26 +6,29 @@
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import 'styles/helpers';
|
@import 'styles/helpers';
|
||||||
|
|
||||||
|
// copied from https://loading.io/css/ updated for scalability
|
||||||
|
|
||||||
.loading-spinner {
|
.loading-spinner {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 80px;
|
width: var(--spinner-size, 80px);
|
||||||
height: 80px;
|
height: var(--spinner-size, 80px);
|
||||||
|
--calculated-dot-size: calc(var(--spinner-size, 80px) * 0.0875); // 7px is 8.75% of 80px
|
||||||
|
|
||||||
div {
|
div {
|
||||||
animation: loading-spinner 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
animation: loading-spinner 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
||||||
transform-origin: 40px 40px;
|
transform-origin: calc(var(--spinner-size, 80px) / 2) calc(var(--spinner-size, 80px) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
div:after {
|
div:after {
|
||||||
content: " ";
|
content: " ";
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 7px;
|
width: var(--calculated-dot-size);
|
||||||
height: 7px;
|
height: var(--calculated-dot-size);
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: $color-brand;
|
background: var(--spinner-color, $color-brand);
|
||||||
margin: -4px 0 0 -4px;
|
margin: calc(var(--calculated-dot-size) / -2) 0 0 calc(var(--calculated-dot-size) / -2);
|
||||||
}
|
}
|
||||||
|
|
||||||
div:nth-child(1) {
|
div:nth-child(1) {
|
||||||
|
|
@ -50,54 +53,71 @@
|
||||||
animation-delay: -0.108s;
|
animation-delay: -0.108s;
|
||||||
}
|
}
|
||||||
|
|
||||||
div:nth-child(3):after {
|
|
||||||
top: 71px;
|
|
||||||
left: 48px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div:nth-child(4) {
|
div:nth-child(4) {
|
||||||
animation-delay: -0.144s;
|
animation-delay: -0.144s;
|
||||||
}
|
}
|
||||||
|
|
||||||
div:nth-child(4):after {
|
|
||||||
top: 72px;
|
|
||||||
left: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div:nth-child(5) {
|
div:nth-child(5) {
|
||||||
animation-delay: -0.18s;
|
animation-delay: -0.18s;
|
||||||
}
|
}
|
||||||
|
|
||||||
div:nth-child(5):after {
|
|
||||||
top: 71px;
|
|
||||||
left: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div:nth-child(6) {
|
div:nth-child(6) {
|
||||||
animation-delay: -0.216s;
|
animation-delay: -0.216s;
|
||||||
}
|
}
|
||||||
|
|
||||||
div:nth-child(6):after {
|
|
||||||
top: 68px;
|
|
||||||
left: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div:nth-child(7) {
|
div:nth-child(7) {
|
||||||
animation-delay: -0.252s;
|
animation-delay: -0.252s;
|
||||||
}
|
}
|
||||||
|
|
||||||
div:nth-child(7):after {
|
|
||||||
top: 63px;
|
|
||||||
left: 17px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div:nth-child(8) {
|
div:nth-child(8) {
|
||||||
animation-delay: -0.288s;
|
animation-delay: -0.288s;
|
||||||
}
|
}
|
||||||
|
|
||||||
div:nth-child(8):after {
|
|
||||||
top: 56px;
|
div:nth-child(1):after {
|
||||||
left: 12px;
|
top: calc(var(--spinner-size, 80px) * 0.7875);
|
||||||
|
left: calc(var(--spinner-size, 80px) * 0.7875);
|
||||||
|
}
|
||||||
|
|
||||||
|
div:nth-child(2):after {
|
||||||
|
top: calc(var(--spinner-size, 80px) * 0.85);
|
||||||
|
left: calc(var(--spinner-size, 80px) * 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
div:nth-child(3):after {
|
||||||
|
top: calc(var(--spinner-size, 80px) * 0.8875);
|
||||||
|
left: calc(var(--spinner-size, 80px) * 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
div:nth-child(4):after {
|
||||||
|
top: calc(var(--spinner-size, 80px) * 0.9);
|
||||||
|
left: calc(var(--spinner-size, 80px) * 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
div:nth-child(5):after {
|
||||||
|
top: calc(var(--spinner-size, 80px) * 0.8875);
|
||||||
|
left: calc(var(--spinner-size, 80px) * 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
div:nth-child(6):after {
|
||||||
|
top: calc(var(--spinner-size, 80px) * 0.85);
|
||||||
|
left: calc(var(--spinner-size, 80px) * 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
div:nth-child(7):after {
|
||||||
|
top: calc(var(--spinner-size, 80px) * 0.7875);
|
||||||
|
left: calc(var(--spinner-size, 80px) * 0.2125);
|
||||||
|
}
|
||||||
|
|
||||||
|
div:nth-child(8):after {
|
||||||
|
top: calc(var(--spinner-size, 80px) * 0.7);
|
||||||
|
left: calc(var(--spinner-size, 80px) * 0.15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@keyframes loading-spinner {
|
@keyframes loading-spinner {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,9 @@ query MyActivityQuery {
|
||||||
slug
|
slug
|
||||||
metaTitle
|
metaTitle
|
||||||
topic {
|
topic {
|
||||||
|
id
|
||||||
title
|
title
|
||||||
|
slug
|
||||||
}
|
}
|
||||||
mySubmissions {
|
mySubmissions {
|
||||||
edges {
|
edges {
|
||||||
|
|
|
||||||
|
|
@ -87,3 +87,4 @@ $screen-width: 1200px;
|
||||||
|
|
||||||
$default-icon-dimension: 25px;
|
$default-icon-dimension: 25px;
|
||||||
$small-icon-dimension: 14px;
|
$small-icon-dimension: 14px;
|
||||||
|
$large-icon-dimension: 40px;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue