Update vue router version

This commit is contained in:
Ramon Wenger 2022-03-23 18:16:11 +01:00
parent 578b563b7b
commit 6cf9457dca
12 changed files with 664 additions and 585 deletions

View File

@ -25,7 +25,7 @@
"cypress:parallel:run": "cy2 run --parallel --record --config-file cypress.frontend.json --ci-build-id " "cypress:parallel:run": "cy2 run --parallel --record --config-file cypress.frontend.json --ci-build-id "
}, },
"dependencies": { "dependencies": {
"@apollo/client": "^3.5.8", "@apollo/client": "^3.5.10",
"@babel/core": "^7.16.7", "@babel/core": "^7.16.7",
"@babel/eslint-plugin": "^7.16.5", "@babel/eslint-plugin": "^7.16.5",
"@babel/plugin-transform-runtime": "^7.5.0", "@babel/plugin-transform-runtime": "^7.5.0",
@ -46,6 +46,8 @@
"@tiptap/vue-2": "^2.0.0-beta.77", "@tiptap/vue-2": "^2.0.0-beta.77",
"@typescript-eslint/eslint-plugin": "^5.10.0", "@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0", "@typescript-eslint/parser": "^5.10.0",
"@vue/apollo-option": "^4.0.0-alpha.16",
"@vue/compiler-sfc": "3.2.30",
"@vue/compat": "3.2.31", "@vue/compat": "3.2.31",
"@vue/test-utils": "^1.3.0", "@vue/test-utils": "^1.3.0",
"@vue/vue2-jest": "^27.0.0", "@vue/vue2-jest": "^27.0.0",
@ -96,12 +98,10 @@
"uploadcare-widget": "^3.6.0", "uploadcare-widget": "^3.6.0",
"url-loader": "^1.0.1", "url-loader": "^1.0.1",
"vee-validate": "^4.5.10", "vee-validate": "^4.5.10",
"@vee-validate/rules": "^4.5.10", "vue": "3.2.30",
"vue": "^3.2.31",
"vue-apollo": "^3.1.0",
"vue-loader": "^16.8.3", "vue-loader": "^16.8.3",
"vue-matomo": "^4.1.0", "vue-matomo": "^4.1.0",
"vue-router": "^3.5.3", "vue-router": "^4.0.14",
"vue-scrollto": "^2.20.0", "vue-scrollto": "^2.20.0",
"vue-style-loader": "^3.0.1", "vue-style-loader": "^3.0.1",
"vue-vimeo-player": "^0.2.2", "vue-vimeo-player": "^0.2.2",

View File

@ -1,68 +1,75 @@
<template> <template>
<router-link :to="to" data-cy="back-link" class="sub-navigation-item back-link"> <router-link
:to="to"
class="sub-navigation-item back-link"
>
<chevron-left class="back-link__icon sub-navigation-item__icon" /> <chevron-left class="back-link__icon sub-navigation-item__icon" />
{{ fullTitle }} {{ fullTitle }}
</router-link> </router-link>
</template> </template>
<script> <script>
import { MODULE_PAGE } from '@/router/module.names'; import { MODULE_PAGE } from '@/router/module.names';
import { ROOMS_PAGE } from '@/router/room.names'; import { ROOMS_PAGE } from '@/router/room.names';
import { PROJECTS_PAGE } from '@/router/portfolio.names'; import { PROJECTS_PAGE } from '@/router/portfolio.names';
const ChevronLeft = () => import(/* webpackChunkName: "icons" */ '@/components/icons/ChevronLeft'); const ChevronLeft = () => import(/* webpackChunkName: "icons" */'@/components/icons/ChevronLeft');
export default { export default {
props: { props: {
title: { title: {
type: String, type: String,
default: '', default: '',
},
type: {
type: String,
default: 'topic',
},
slug: {
type: String,
default: '',
},
}, },
type: {
type: String,
default: 'topic',
},
slug: {
type: String,
default: '',
},
},
components: { components: {
ChevronLeft, ChevronLeft,
}, },
computed: { computed: {
to() { to() {
switch (this.type) { switch (this.type) {
case 'topic': case 'topic':
return { name: 'topic', params: { topicSlug: this.slug } }; if (this.slug) {
case 'module': return {name: 'topic', params: {topicSlug: this.slug}};
return { name: MODULE_PAGE }; } else {
case 'portfolio': return {};
return { name: PROJECTS_PAGE }; }
default: case 'module':
return { name: ROOMS_PAGE }; return {name: MODULE_PAGE};
} case 'portfolio':
return {name: PROJECTS_PAGE};
default:
return {name: ROOMS_PAGE};
}
},
fullTitle() {
switch (this.type) {
case 'topic':
return `${this.$flavor.textTopic}: ${this.title}`;
case 'module':
return `${this.$flavor.textModule}: ${this.title}`;
default:
return this.title;
}
},
}, },
fullTitle() { };
switch (this.type) {
case 'topic':
return `${this.$flavor.textTopic}: ${this.title}`;
case 'module':
return `${this.$flavor.textModule}: ${this.title}`;
default:
return this.title;
}
},
},
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '~styles/helpers'; @import '~styles/helpers';
.back-link { .back-link {
@include regular-text; @include regular-text;
} }
</style> </style>

View File

@ -1,73 +1,78 @@
<template> <template>
<transition name="fade"> <transition name="fade">
<a class="scroll-up" v-if="scroll > 200" @click="scrollTop"> <a
class="scroll-up"
v-if="scroll>200"
@click="scrollTop"
>
<arrow-up class="scroll-up__icon" /> <arrow-up class="scroll-up__icon" />
</a> </a>
</transition> </transition>
</template> </template>
<script> <script>
const ArrowUp = () => import(/* webpackChunkName: "icons" */ '@/components/icons/ArrowUp'); const ArrowUp = () => import(/* webpackChunkName: "icons" */'@/components/icons/ArrowUp');
export default { export default {
components: { components: {
ArrowUp, ArrowUp
},
data() {
return {
scroll: 0,
};
},
mounted() {
let html = document.scrollingElement;
document.body.onscroll = () => {
this.scroll = html.scrollTop;
};
},
unmounted() {
document.body.onscroll = null;
},
methods: {
scrollTop() {
document.scrollingElement.scrollTop = 0;
}, },
},
}; data() {
return {
scroll: 0
};
},
mounted() {
let html = document.scrollingElement;
document.body.onscroll = () => {
this.scroll = html.scrollTop;
};
},
unmounted() {
document.body.onscroll = null;
},
methods: {
scrollTop() {
document.scrollingElement.scrollTop = 0;
}
},
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '@/styles/_variables.scss'; @import '@/styles/_variables.scss';
@import '@/styles/_mixins.scss'; @import '@/styles/_mixins.scss';
.scroll-up { .scroll-up {
position: fixed; position: fixed;
right: $large-spacing; right: $large-spacing;
bottom: $large-spacing; bottom: $large-spacing;
padding: $medium-spacing; padding: $medium-spacing;
border-radius: 100px; border-radius: 100px;
@include default-box-shadow; @include default-box-shadow;
cursor: pointer; cursor: pointer;
background-color: $color-white; background-color: $color-white;
border: 1px solid $color-silver; border: 1px solid $color-silver;
z-index: 2; z-index: 2;
&__icon {
width: 50px;
height: 50px;
fill: $color-brand;
}
&__icon {
width: 50px;
height: 50px;
fill: $color-brand;
} }
}
.fade-enter-active, .fade-enter-active, .fade-leave-active {
.fade-leave-active { transition: opacity .3s;
transition: opacity 0.3s; }
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ { .fade-enter-from, .fade-leave-to /* .fade-leave-active below version 2.1.8 */
opacity: 0; {
} opacity: 0;
}
</style> </style>

View File

@ -1,8 +1,18 @@
<template> <template>
<transition name="slide"> <transition name="slide">
<div class="navigation-sidebar" v-if="sidebar.navigation" v-click-outside="close"> <div
<content-navigation :is-sidebar="true" class="navigation-sidebar__main" /> class="navigation-sidebar"
<div class="navigation-sidebar__close-button" @click="close"> v-if="sidebar.navigation"
v-click-outside="close"
>
<content-navigation
:is-sidebar="true"
class="navigation-sidebar__main"
/>
<div
class="navigation-sidebar__close-button"
@click="close"
>
<cross class="navigation-sidebar__close-icon" /> <cross class="navigation-sidebar__close-icon" />
</div> </div>
</div> </div>
@ -10,94 +20,93 @@
</template> </template>
<script> <script>
import ContentNavigation from '@/components/book-navigation/ContentNavigation'; import ContentNavigation from '@/components/book-navigation/ContentNavigation';
import sidebarMixin from '@/mixins/sidebar'; import sidebarMixin from '@/mixins/sidebar';
const Cross = () => import(/* webpackChunkName: "icons" */ '@/components/icons/CrossIcon'); const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/CrossIcon');
export default { export default {
mixins: [sidebarMixin], mixins: [sidebarMixin],
components: { components: {
ContentNavigation, ContentNavigation,
Cross, Cross
},
methods: {
close() {
this.closeSidebar('navigation');
}, },
},
}; methods: {
close() {
this.closeSidebar('navigation');
}
},
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '@/styles/_variables.scss'; @import "@/styles/_variables.scss";
@import '@/styles/_mixins.scss'; @import "@/styles/_mixins.scss";
$desktop-width: 285px; $desktop-width: 285px;
.navigation-sidebar { .navigation-sidebar {
position: fixed; position: fixed;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
top: 0; top: 0;
background-color: white; background-color: white;
z-index: 20; z-index: 20;
@include desktop {
box-shadow: 0px 2px 9px rgba(0, 0, 0, 0.12);
}
display: grid;
grid-template-columns: 1fr 50px;
grid-template-rows: 50px max-content auto 100px;
grid-template-areas: 'm m' 'm m' 's s' 's s';
&--with-subnavigation {
grid-template-areas: 'm m' 'm m' 'sub sub' 's s';
}
height: 100vh;
overflow-y: auto;
@include desktop {
width: $desktop-width;
}
&__main {
padding: $medium-spacing;
grid-area: m;
}
&__main-link {
}
&__close-button {
grid-row: 1;
grid-column: 2;
align-self: center;
justify-self: center;
cursor: pointer;
}
}
.slide {
&-enter-active,
&-leave-active {
transition: left 0.2s;
}
&-enter,
&-leave-to {
left: -100vw;
@include desktop { @include desktop {
left: -$desktop-width; box-shadow: 0px 2px 9px rgba(0, 0, 0, 0.12);
}
display: grid;
grid-template-columns: 1fr 50px;
grid-template-rows: 50px max-content auto 100px;
grid-template-areas: "m m" "m m" "s s" "s s";
&--with-subnavigation {
grid-template-areas: "m m" "m m" "sub sub" "s s";
}
height: 100vh;
overflow-y: auto;
@include desktop {
width: $desktop-width;
}
&__main {
padding: $medium-spacing;
grid-area: m;
}
&__main-link {
}
&__close-button {
grid-row: 1;
grid-column: 2;
align-self: center;
justify-self: center;
cursor: pointer;
}
}
.slide {
&-enter-active, &-leave-active {
transition: left 0.2s;
}
&-enter-from, &-leave-to {
left: -100vw;
@include desktop {
left: -$desktop-width;
}
} }
} }
}
</style> </style>

View File

@ -1,5 +1,9 @@
<template> <template>
<div :class="componentClass" :data-scrollto="component.id" data-cy="content-component"> <div
:class="componentClass"
:data-scrollto="component.id"
data-cy="content-component"
>
<bookmark-actions <bookmark-actions
:bookmarked="bookmarked" :bookmarked="bookmarked"
:note="note" :note="note"
@ -9,105 +13,97 @@
@edit-note="editNote" @edit-note="editNote"
@bookmark="bookmarkContent(component.id, !bookmarked)" @bookmark="bookmarkContent(component.id, !bookmarked)"
/> />
<component v-bind="component" :parent="parent" :is="component.type" /> <component
v-bind="component"
:parent="parent"
:is="component.type"
/>
</div> </div>
</template> </template>
<script> <script>
import { constructContentComponentBookmarkMutation } from '@/helpers/update-content-bookmark-mutation'; import {constructContentComponentBookmarkMutation} from '@/helpers/update-content-bookmark-mutation';
import {defineAsyncComponent} from 'vue';
const TextBlock = () => import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/TextBlock'); const TextBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/TextBlock'));
const InstrumentWidget = () => const InstrumentWidget = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/InstrumentWidget'));
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/InstrumentWidget'); const ImageBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/ImageBlock'));
const ImageBlock = () => import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/ImageBlock'); const ImageUrlBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/ImageUrlBlock'));
const ImageUrlBlock = () => const VideoBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/VideoBlock'));
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/ImageUrlBlock'); const LinkBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/LinkBlock'));
const VideoBlock = () => import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/VideoBlock'); const DocumentBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/DocumentBlock'));
const LinkBlock = () => import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/LinkBlock'); const CmsDocumentBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/CmsDocumentBlock'));
const DocumentBlock = () => const InfogramBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/InfogramBlock'));
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/DocumentBlock'); const ThinglinkBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/ThinglinkBlock'));
const CmsDocumentBlock = () => const GeniallyBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/GeniallyBlock'));
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/CmsDocumentBlock'); const SubtitleBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/SubtitleBlock'));
const InfogramBlock = () => const SectionTitleBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/SectionTitleBlock'));
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/InfogramBlock'); const ContentListBlock = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/ContentListBlock'));
const ThinglinkBlock = () => const ModuleRoomSlug = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/ModuleRoomSlug'));
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/ThinglinkBlock'); const Assignment = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/assignment/Assignment'));
const GeniallyBlock = () => const Survey = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/SurveyBlock'));
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/GeniallyBlock'); const Solution = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/Solution'));
const SubtitleBlock = () => const Instruction = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/content-blocks/Instruction'));
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/SubtitleBlock'); const BookmarkActions = defineAsyncComponent(() => import(/* webpackChunkName: "content-components" */'@/components/notes/BookmarkActions'));
const SectionTitleBlock = () =>
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/SectionTitleBlock');
const ContentListBlock = () =>
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/ContentListBlock');
const ModuleRoomSlug = () =>
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/ModuleRoomSlug');
const Assignment = () =>
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/assignment/Assignment');
const Survey = () => import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/SurveyBlock');
const Solution = () => import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/Solution');
const Instruction = () =>
import(/* webpackChunkName: "content-components" */ '@/components/content-blocks/Instruction');
const BookmarkActions = () => import(/* webpackChunkName: "content-components" */ '@/components/notes/BookmarkActions');
export default { export default {
props: { props: {
component: { component: {
type: Object, type: Object,
default: () => ({}), default: () => ({})
}, },
parent: { parent: {
type: Object, type: Object,
default: () => ({}), default: () => ({})
}, },
bookmarks: { bookmarks: {
type: Array, type: Array,
default: () => [], default: () => ([])
}, },
notes: { notes: {
type: Array, type: Array,
default: () => [], default: () => ([])
}, },
root: { root: {
type: String, type: String,
default: '', default: ''
}, },
editMode: { editMode: {
type: Boolean, type: Boolean,
default: false, default: false
}, }
}, },
components: { components: {
text_block: TextBlock, 'text_block': TextBlock,
basic_knowledge: InstrumentWidget, // for legacy 'basic_knowledge': InstrumentWidget, // for legacy
instrument: InstrumentWidget, 'instrument': InstrumentWidget,
image_block: ImageBlock, 'image_block': ImageBlock,
image_url_block: ImageUrlBlock, 'image_url_block': ImageUrlBlock,
video_block: VideoBlock, 'video_block': VideoBlock,
link_block: LinkBlock, 'link_block': LinkBlock,
document_block: DocumentBlock, 'document_block': DocumentBlock,
infogram_block: InfogramBlock, 'infogram_block': InfogramBlock,
genially_block: GeniallyBlock, 'genially_block': GeniallyBlock,
subtitle: SubtitleBlock, 'subtitle': SubtitleBlock,
section_title: SectionTitleBlock, 'section_title': SectionTitleBlock,
content_list: ContentListBlock, 'content_list': ContentListBlock,
module_room_slug: ModuleRoomSlug, 'module_room_slug': ModuleRoomSlug,
thinglink_block: ThinglinkBlock, 'thinglink_block': ThinglinkBlock,
cms_document_block: CmsDocumentBlock, 'cms_document_block': CmsDocumentBlock,
Survey, Survey,
Solution, Solution,
Instruction, Instruction,
Assignment, Assignment,
BookmarkActions, BookmarkActions
}, },
computed: { computed: {
bookmarked() { bookmarked() {
return this.bookmarks && !!this.bookmarks.find((bookmark) => bookmark.uuid === this.component.id); return this.bookmarks && !!this.bookmarks.find(bookmark => bookmark.uuid === this.component.id);
}, },
note() { note() {
const bookmark = this.bookmarks && this.bookmarks.find((bookmark) => bookmark.uuid === this.component.id); const bookmark = this.bookmarks && this.bookmarks.find(bookmark => bookmark.uuid === this.component.id);
return bookmark && bookmark.note; return bookmark && bookmark.note;
}, },
showBookmarkActions() { showBookmarkActions() {
@ -119,19 +115,18 @@ export default {
classes.push('content-component--bookmarked'); classes.push('content-component--bookmarked');
} }
return classes; return classes;
}, }
}, },
methods: { methods: {
addNote(id) { addNote(id) {
const type = Object.prototype.hasOwnProperty.call(this.parent, '__typename') const type = Object.prototype.hasOwnProperty.call(this.parent, '__typename')
? this.parent.__typename ? this.parent.__typename : 'ContentBlockNode';
: 'ContentBlockNode';
this.$store.dispatch('addNote', { this.$store.dispatch('addNote', {
content: id, content: id,
type, type,
block: this.root, block: this.root
}); });
}, },
editNote() { editNote() {
@ -139,36 +134,37 @@ export default {
}, },
bookmarkContent(uuid, bookmarked) { bookmarkContent(uuid, bookmarked) {
this.$apollo.mutate(constructContentComponentBookmarkMutation(uuid, bookmarked, this.parent, this.root)); this.$apollo.mutate(constructContentComponentBookmarkMutation(uuid, bookmarked, this.parent, this.root));
}, }
}, }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '~styles/helpers'; @import "~styles/helpers";
.content-component { .content-component {
position: relative; position: relative;
&--bookmarked { &--bookmarked {
}
&--subtitle {
margin-top: $section-spacing;
margin-bottom: $large-spacing;
}
&--section_title {
margin-top: $section-spacing;
margin-bottom: $large-spacing;
}
&--text_block {
margin-bottom: $large-spacing;
}
&--document_block {
margin-bottom: $large-spacing;
}
} }
&--subtitle {
margin-top: $section-spacing;
margin-bottom: $large-spacing;
}
&--section_title {
margin-top: $section-spacing;
margin-bottom: $large-spacing;
}
&--text_block {
margin-bottom: $large-spacing;
}
&--document_block {
margin-bottom: $large-spacing;
}
}
</style> </style>

View File

@ -1,95 +1,114 @@
<template> <template>
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<div class="solution" data-cy="solution"> <div
<a class="solution__toggle" data-cy="show-solution" @click="toggle" class="solution"
>Lösung data-cy="solution"
>
<a
class="solution__toggle"
data-cy="show-solution"
@click="toggle"
>Lösung
<template v-if="!visible">anzeigen</template> <template v-if="!visible">anzeigen</template>
<template v-else>ausblenden</template> <template v-else>ausblenden</template>
</a> </a>
<transition name="fade"> <transition name="fade">
<div class="solution__hidden fade" v-if="visible"> <div
<p class="solution__text solution-text" data-cy="solution-text" v-html="sanitizedText" /> class="solution__hidden fade"
<cms-document-block :solution="true" class="solution__document" :value="value.document" v-if="value.document" /> v-if="visible"
>
<p
class="solution__text solution-text"
data-cy="solution-text"
v-html="sanitizedText"
/>
<cms-document-block
:solution="true"
class="solution__document"
:value="value.document"
v-if="value.document"
/>
</div> </div>
</transition> </transition>
</div> </div>
</template> </template>
<script> <script>
import { sanitizeAsHtml } from '@/helpers/text'; import {sanitizeAsHtml} from '@/helpers/text';
import CmsDocumentBlock from '@/components/content-blocks/CmsDocumentBlock'; import CmsDocumentBlock from '@/components/content-blocks/CmsDocumentBlock';
export default { export default {
props: ['value'], props: ['value'],
components: { CmsDocumentBlock }, components: {CmsDocumentBlock},
data() { data() {
return { return {
visible: false, visible: false,
}; };
},
computed: {
sanitizedText() {
return sanitizeAsHtml(this.value.text);
}, },
},
methods: { computed: {
toggle() { sanitizedText() {
this.visible = !this.visible; return sanitizeAsHtml(this.value.text);
},
}, },
},
}; methods: {
toggle() {
this.visible = !this.visible;
},
},
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '~styles/helpers'; @import "~styles/helpers";
.solution { .solution {
display: grid; display: grid;
grid-auto-rows: auto; grid-auto-rows: auto;
grid-row-gap: 15px; grid-row-gap: 15px;
margin-bottom: 1rem; margin-bottom: 1rem;
&__toggle { &__toggle {
font-family: $sans-serif-font-family; font-family: $sans-serif-font-family;
color: $color-silver-dark;
font-size: toRem(15px);
/*margin-bottom: 15px;*/
display: block;
cursor: pointer;
font-weight: $font-weight-regular;
}
&__text {
font-size: toRem(18px);
color: $color-silver-dark;
:deep(p) {
font-size: toRem(18px);
color: $color-silver-dark; color: $color-silver-dark;
font-size: toRem(15px);
/*margin-bottom: 15px;*/
display: block;
cursor: pointer;
font-weight: $font-weight-regular;
} }
:deep(ul) { &__text {
padding-left: $medium-spacing; font-size: toRem(18px);
color: $color-silver-dark;
> li { /deep/ p {
list-style: disc outside none; font-size: toRem(18px);
color: $color-silver-dark; color: $color-silver-dark;
} }
/deep/ ul {
padding-left: $medium-spacing;
> li {
list-style: disc outside none;
color: $color-silver-dark;
}
}
} }
} }
}
.fade-enter-active, .fade-enter-active,
.fade-leave-active { .fade-leave-active {
transition: opacity 0.3s; transition: opacity .3s;
} }
.fade-enter, .fade-enter-from,
.fade-leave-active { .fade-leave-active {
opacity: 0; opacity: 0;
} }
</style> </style>

View File

@ -5,6 +5,7 @@
:slug="module.topic.slug" :slug="module.topic.slug"
class="module-navigation__topic-link" class="module-navigation__topic-link"
type="topic" type="topic"
v-if="module.topic"
/> />
<div class="module-navigation__module-content" v-if="false"> <div class="module-navigation__module-content" v-if="false">
<!-- Do not display this for now, might be used later again though --> <!-- Do not display this for now, might be used later again though -->

View File

@ -2,23 +2,31 @@
<div class="avatar"> <div class="avatar">
<transition name="fade"> <transition name="fade">
<default-avatar <default-avatar
:class="{ 'avatar__placeholder--highlighted': iconHighlighted }" :class="{'avatar__placeholder--highlighted': iconHighlighted}"
class="avatar__placeholder" class="avatar__placeholder"
v-show="!isAvatarLoaded" v-show="!isAvatarLoaded"
/> />
</transition> </transition>
<transition name="show"> <transition name="show">
<div <div
:style="{ 'background-image': `url(${avatarUrl})` }" :style="{'background-image': `url(${avatarUrl})`}"
class="avatar__image" class="avatar__image"
v-show="isAvatarLoaded" v-show="isAvatarLoaded"
ref="avatarImage" ref="avatarImage"
/> />
</transition> </transition>
<img :src="avatarUrl" class="avatar__fake-image" ref="fakeImage" /> <img
:src="avatarUrl"
class="avatar__fake-image"
ref="fakeImage"
>
<div class="avatar__edit" v-if="editable" @click="closeSidebar"> <div
<router-link :to="{ name: 'profile' }"> class="avatar__edit"
v-if="editable"
@click="closeSidebar"
>
<router-link :to="{name: 'profile'}">
<pen-icon /> <pen-icon />
</router-link> </router-link>
</div> </div>
@ -26,121 +34,119 @@
</template> </template>
<script> <script>
import TOGGLE_SIDEBAR from '@/graphql/gql/local/mutations/toggleSidebar.gql'; import TOGGLE_SIDEBAR from '@/graphql/gql/local/mutations/toggleSidebar.gql';
const DefaultAvatar = () => import(/* webpackChunkName: "icons" */ '@/components/icons/DefaultAvatar'); const DefaultAvatar = () => import(/* webpackChunkName: "icons" */'@/components/icons/DefaultAvatar');
const PenIcon = () => import(/* webpackChunkName: "icons" */ '@/components/icons/PenIcon'); const PenIcon = () => import(/* webpackChunkName: "icons" */'@/components/icons/PenIcon');
export default { export default {
props: { props: {
avatarUrl: { avatarUrl: {
type: String, type: String
},
iconHighlighted: {},
editable: {
default: false
}
}, },
iconHighlighted: {}, components: {
editable: { DefaultAvatar,
default: false, PenIcon
}, },
}, data() {
components: { return {
DefaultAvatar, isAvatarLoaded: false
PenIcon, };
}, },
data() { mounted() {
return { if (this.avatarUrl !== '') {
isAvatarLoaded: false, this.$refs.fakeImage.addEventListener('load', () => {
}; if (this.$refs.fakeImage) {
}, this.$refs.fakeImage.remove();
mounted() { this.isAvatarLoaded = true;
if (this.avatarUrl !== '') { }
this.$refs.fakeImage.addEventListener('load', () => { });
if (this.$refs.fakeImage) { }
this.$refs.fakeImage.remove(); },
this.isAvatarLoaded = true; methods: {
} closeSidebar() {
}); this.$apollo.mutate({
mutation: TOGGLE_SIDEBAR,
variables: {
sidebar: {
profile: false
}
}
});
}
} }
}, };
methods: {
closeSidebar() {
this.$apollo.mutate({
mutation: TOGGLE_SIDEBAR,
variables: {
sidebar: {
profile: false,
},
},
});
},
},
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '~styles/helpers'; @import "~styles/helpers";
$max-width: 100%; $max-width: 100%;
.avatar { .avatar {
height: $max-width;
width: $max-width;
overflow: hidden;
text-align: center;
&__placeholder {
height: $max-width; height: $max-width;
fill: $color-silver-dark; width: $max-width;
border-radius: 50%; overflow: hidden;
text-align: center;
&--highlighted { &__placeholder {
fill: $color-brand;
}
}
&__image {
background-size: cover;
background-position: center center;
height: 100%;
width: 100%;
border: 0;
border-radius: 50%;
&--landscape {
width: auto;
height: $max-width; height: $max-width;
fill: $color-silver-dark;
border-radius: 50%;
&--highlighted {
fill: $color-brand;
}
}
&__image {
background-size: cover;
background-position: center center;
height: 100%;
width: 100%;
border: 0;
border-radius: 50%;
&--landscape {
width: auto;
height: $max-width;
}
}
&__fake-image {
width: 0;
height: 0;
}
&__edit {
position: absolute;
box-sizing: border-box;
width: 34px;
height: 34px;
display: block;
left: 50%;
bottom: -3px;
transform: translateX(80%);
background-color: $color-white;
border-radius: 50%;
padding: 6px;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}
.fade-leave-active, .show-enter-active {
transition: opacity .5s;
}
.fade-leave-to, .show-enter-from {
opacity: 0;
}
.show-enter-to {
opacity: 1;
} }
} }
&__fake-image {
width: 0;
height: 0;
}
&__edit {
position: absolute;
box-sizing: border-box;
width: 34px;
height: 34px;
display: block;
left: 50%;
bottom: -3px;
transform: translateX(80%);
background-color: $color-white;
border-radius: 50%;
padding: 6px;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}
.fade-leave-active,
.show-enter-active {
transition: opacity 0.5s;
}
.fade-leave-to,
.show-enter {
opacity: 0;
}
.show-enter-to {
opacity: 1;
}
}
</style> </style>

View File

@ -1,31 +1,69 @@
<template> <template>
<transition name="slide"> <transition name="slide">
<div class="profile-sidebar" data-cy="sidebar" v-if="sidebar.profile" v-click-outside="close"> <div
<a class="profile-sidebar__close-link" data-cy="close-profile-sidebar-link" @click="close"> class="profile-sidebar"
data-cy="sidebar"
v-if="sidebar.profile"
v-click-outside="close"
>
<a
class="profile-sidebar__close-link"
data-cy="close-profile-sidebar-link"
@click="close"
>
<cross class="profile-sidebar__close-icon" /> <cross class="profile-sidebar__close-icon" />
</a> </a>
<div class="profile-sidebar__section"> <div class="profile-sidebar__section">
<profile-widget class="profile-sidebar__item" /> <profile-widget class="profile-sidebar__item" />
<div class="profile-sidebar__item" @click="close"> <div
<router-link to="/me/activity" class="profile-sidebar__link"> Meine Aktivitäten </router-link> class="profile-sidebar__item"
@click="close"
>
<router-link
to="/me/activity"
class="profile-sidebar__link"
>
Meine Aktivitäten
</router-link>
</div> </div>
<div class="profile-sidebar__item" v-if="me.isTeacher && !me.readOnly" @click="close"> <div
<router-link :to="myTeamPage" data-cy="my-team-link" class="profile-sidebar__link"> Mein Team </router-link> class="profile-sidebar__item"
v-if="me.isTeacher && !me.readOnly"
@click="close"
>
<router-link
:to="myTeamPage"
data-cy="my-team-link"
class="profile-sidebar__link"
>
Mein Team
</router-link>
</div> </div>
</div> </div>
<div class="profile-sidebar__section"> <div class="profile-sidebar__section">
<div class="profile-sidebar__item"> <div class="profile-sidebar__item">
<class-selection-widget /> <class-selection-widget />
<div @click="close"> <div @click="close">
<router-link :to="{ name: 'my-class' }" data-cy="class-list-link" class="profile-sidebar__link"> <router-link
:to="{name: 'my-class'}"
data-cy="class-list-link"
class="profile-sidebar__link"
>
Klassenliste Klassenliste
</router-link> </router-link>
</div> </div>
</div> </div>
</div> </div>
<div class="profile-sidebar__section"> <div class="profile-sidebar__section">
<div class="profile-sidebar__item" @click="close"> <div
<router-link :to="{ name: 'join-class' }" data-cy="join-class-link" class="profile-sidebar__link"> class="profile-sidebar__item"
@click="close"
>
<router-link
:to="{name:'join-class'}"
data-cy="join-class-link"
class="profile-sidebar__link"
>
Zugangscode Zugangscode
</router-link> </router-link>
</div> </div>
@ -38,112 +76,111 @@
</template> </template>
<script> <script>
import ProfileWidget from '@/components/profile/ProfileWidget'; import ProfileWidget from '@/components/profile/ProfileWidget';
import ClassSelectionWidget from '@/components/school-class/ClassSelectionWidget'; import ClassSelectionWidget from '@/components/school-class/ClassSelectionWidget';
import sidebar from '@/mixins/sidebar'; import sidebar from '@/mixins/sidebar';
import me from '@/mixins/me'; import me from '@/mixins/me';
import LogoutWidget from '@/components/LogoutWidget'; import LogoutWidget from '@/components/LogoutWidget';
import { MY_TEAM } from '@/router/me.names'; import {MY_TEAM} from '@/router/me.names';
const Cross = () => import(/* webpackChunkName: "icons" */ '@/components/icons/CrossIcon'); const Cross = () => import(/* webpackChunkName: "icons" */'@/components/icons/CrossIcon');
export default { export default {
mixins: [sidebar, me],
components: { mixins: [sidebar, me],
LogoutWidget,
ClassSelectionWidget,
ProfileWidget,
Cross,
},
computed: { components: {
myTeamPage() { LogoutWidget,
return { ClassSelectionWidget,
name: MY_TEAM, ProfileWidget,
}; Cross,
}, },
},
methods: { computed: {
close() { myTeamPage() {
this.closeSidebar('profile'); return {
name: MY_TEAM,
};
},
}, },
},
}; methods: {
close() {
this.closeSidebar('profile');
},
},
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@import '~styles/helpers'; @import "~styles/helpers";
$desktop-width: 333px; $desktop-width: 333px;
.profile-sidebar { .profile-sidebar {
padding: $large-spacing 0; padding: $large-spacing 0;
box-sizing: border-box; box-sizing: border-box;
position: fixed; position: fixed;
right: 0; right: 0;
top: 0; top: 0;
bottom: 0; bottom: 0;
height: 100vh; height: 100vh;
background-color: $color-white; background-color: $color-white;
z-index: 15; z-index: 15;
box-shadow: 0 3px 9px 0 rgba(0, 0, 0, 0.12); box-shadow: 0 3px 9px 0 rgba(0, 0, 0, 0.12);
overflow-y: scroll; overflow-y: scroll;
width: 100%; width: 100%;
@include desktop {
width: $desktop-width;
}
display: flex;
flex-direction: column;
justify-content: flex-start;
&__section {
margin-bottom: $large-spacing;
&:last-of-type {
margin-top: auto;
}
}
&__item {
padding: $small-spacing $medium-spacing;
}
&__subtitle {
@include small-text;
margin: 0;
margin-bottom: $small-spacing;
}
&__link {
@include default-link;
display: block;
}
&__close-link {
position: absolute;
right: $small-spacing;
top: $small-spacing;
cursor: pointer;
}
}
.slide {
&-enter-active,
&-leave-active {
transition: right 0.2s;
}
&-enter,
&-leave-to {
right: -100vw;
@include desktop { @include desktop {
right: -$desktop-width; width: $desktop-width;
}
display: flex;
flex-direction: column;
justify-content: flex-start;
&__section {
margin-bottom: $large-spacing;
&:last-of-type {
margin-top: auto;
}
}
&__item {
padding: $small-spacing $medium-spacing;
}
&__subtitle {
@include small-text;
margin: 0;
margin-bottom: $small-spacing;
}
&__link {
@include default-link;
display: block;
}
&__close-link {
position: absolute;
right: $small-spacing;
top: $small-spacing;
cursor: pointer;
}
}
.slide {
&-enter-active, &-leave-active {
transition: right 0.2s;
}
&-enter-from, &-leave-to {
right: -100vw;
@include desktop {
right: -$desktop-width;
}
} }
} }
}
</style> </style>

View File

@ -1,8 +1,7 @@
import '@babel/polyfill'; import '@babel/polyfill';
import {createApp, inject} from 'vue'; import {createApp} from 'vue';
import VueVimeoPlayer from 'vue-vimeo-player'; import VueVimeoPlayer from 'vue-vimeo-player';
import apolloClientFactory from './graphql/client'; import apolloClientFactory from './graphql/client';
import VueApollo from 'vue-apollo';
import App from './App.vue'; import App from './App.vue';
import { postLoginRedirectUrlKey, router } from './router'; import { postLoginRedirectUrlKey, router } from './router';
import store from '@/store/index'; import store from '@/store/index';
@ -14,13 +13,14 @@ import VueModal from '@/plugins/modal';
import VueRemoveEdges from '@/plugins/edges'; import VueRemoveEdges from '@/plugins/edges';
import VueMatomo from 'vue-matomo'; import VueMatomo from 'vue-matomo';
import VueLogger from 'vuejs3-logger'; import VueLogger from 'vuejs3-logger';
import { createApolloProvider } from '@vue/apollo-option';
import { joiningClass, loginRequired, unauthorizedAccess } from '@/router/guards'; import { joiningClass, loginRequired, unauthorizedAccess } from '@/router/guards';
import flavorPlugin from '@/plugins/flavor'; import flavorPlugin from '@/plugins/flavor';
const publicApolloClient = apolloClientFactory('/api/graphql-public/', null); const publicApolloClient = apolloClientFactory('/api/graphql-public/', null);
const privateApolloClient = apolloClientFactory('/api/graphql/', networkErrorCallback); const privateApolloClient = apolloClientFactory('/api/graphql/', networkErrorCallback);
const apolloProvider = new VueApollo({ const apolloProvider = createApolloProvider({
clients: { clients: {
publicClient: publicApolloClient, publicClient: publicApolloClient,
}, },
@ -39,7 +39,6 @@ const isProduction = process.env.NODE_ENV === 'production';
app.use(VueModal); app.use(VueModal);
app.use(VueRemoveEdges); app.use(VueRemoveEdges);
app.use(VueApollo);
app.use(VueVimeoPlayer); app.use(VueVimeoPlayer);
app.use(VueLogger, { app.use(VueLogger, {
isEnabled: true, isEnabled: true,
@ -47,6 +46,8 @@ app.use(VueLogger, {
stringifyArguments: false, stringifyArguments: false,
showConsoleColors: true, showConsoleColors: true,
}); });
app.use(apolloProvider);
app.use(router);
// VueScrollTo.setDefaults({ // VueScrollTo.setDefaults({
// duration: 500, // duration: 500,

View File

@ -1,4 +1,4 @@
import { Route } from 'vue-router'; import {RouteLocationNormalized} from "vue-router";
function getCookieValue(cookieName: string) { function getCookieValue(cookieName: string) {
// https://stackoverflow.com/questions/5639346/what-is-the-shortest-function-for-reading-a-cookie-by-name-in-javascript // https://stackoverflow.com/questions/5639346/what-is-the-shortest-function-for-reading-a-cookie-by-name-in-javascript
@ -6,16 +6,16 @@ function getCookieValue(cookieName: string) {
return cookieValue ? cookieValue.pop() : ''; return cookieValue ? cookieValue.pop() : '';
} }
export function loginRequired(to: Route) { export function loginRequired(to: RouteLocationNormalized) {
// public pages have the meta.public property set to true // public pages have the meta.public property set to true
const isPublic = to.meta && to.meta.public; const isPublic = to.meta && to.meta.public;
return !isPublic; return !isPublic;
} }
export function unauthorizedAccess(to: Route) { export function unauthorizedAccess(to: RouteLocationNormalized) {
return loginRequired(to) && getCookieValue('loginStatus') !== 'true'; return loginRequired(to) && getCookieValue('loginStatus') !== 'true';
} }
export function joiningClass(to: Route) { export function joiningClass(to: RouteLocationNormalized) {
return to.name && (to.name === 'join-class' || to.name === 'licenseActivation'); return to.name && (to.name === 'join-class' || to.name === 'licenseActivation');
} }

View File

@ -1,6 +1,4 @@
import Vue from 'vue'; import {createRouter, createWebHistory} from 'vue-router';
import Router from 'vue-router';
import moduleRoutes from './module.routes'; import moduleRoutes from './module.routes';
import portfolioRoutes from './portfolio.routes'; import portfolioRoutes from './portfolio.routes';
@ -10,26 +8,26 @@ import authRoutes from './auth.routes';
import roomRoutes from './room.routes'; import roomRoutes from './room.routes';
import store from '@/store/index'; import store from '@/store/index';
import { LAYOUT_SIMPLE } from '@/router/core.constants'; import {LAYOUT_SIMPLE} from '@/router/core.constants';
import { EMAIL_NOT_VERIFIED_STATE, NO_VALID_LICENSE_STATE, SUCCESS_STATE } from './oauth.names'; import {EMAIL_NOT_VERIFIED_STATE, NO_VALID_LICENSE_STATE, SUCCESS_STATE} from './oauth.names';
import start from '@/pages/start'; import start from '@/pages/start';
const instrument = () => import(/* webpackChunkName: "instruments" */ '@/pages/instrument'); const instrument = () => import(/* webpackChunkName: "instruments" */'@/pages/instrument');
const instrumentOverview = () => import(/* webpackChunkName: "instruments" */ '@/pages/instrumentOverview'); const instrumentOverview = () => import(/* webpackChunkName: "instruments" */'@/pages/instrumentOverview');
const article = () => import(/* webpackChunkName: "news" */ '@/pages/article'); const article = () => import(/* webpackChunkName: "news" */'@/pages/article');
const news = () => import(/* webpackChunkName: "news" */ '@/pages/news'); const news = () => import(/* webpackChunkName: "news" */'@/pages/news');
const surveyPage = () => import(/* webpackChunkName: "survey" */ '@/pages/survey'); const surveyPage = () => import(/* webpackChunkName: "survey" */'@/pages/survey');
const styleGuidePage = () => import('@/pages/styleguide.vue'); const styleGuidePage = () => import('@/pages/styleguide');
const joinClass = () => import('@/pages/joinClass.vue'); const joinClass = () => import('@/pages/joinClass');
const topic = () => import('@/pages/topic-page.vue'); const topic = () => import('@/pages/topic-page');
const p404 = () => import('@/pages/p404.vue'); const p404 = () => import('@/pages/p404');
const submission = () => import('@/pages/studentSubmission.vue'); const submission = () => import('@/pages/studentSubmission');
const postLoginRedirectUrlKey = 'postLoginRedirectionUrl'; const postLoginRedirectUrlKey = 'postLoginRedirectionUrl';
@ -52,22 +50,22 @@ const routes = [
...onboardingRoutes, ...onboardingRoutes,
...portfolioRoutes, ...portfolioRoutes,
...meRoutes, ...meRoutes,
{ path: '/article/:slug', name: 'article', component: article, meta: { layout: LAYOUT_SIMPLE } }, {path: '/article/:slug', name: 'article', component: article, meta: {layout: LAYOUT_SIMPLE}},
{ {
path: '/instruments/', path: '/instruments/',
name: 'instrument-overview', name: 'instrument-overview',
component: instrumentOverview, component: instrumentOverview,
}, },
{ path: '/instrument/:slug', name: 'instrument', component: instrument, meta: { layout: LAYOUT_SIMPLE } }, {path: '/instrument/:slug', name: 'instrument', component: instrument, meta: {layout: LAYOUT_SIMPLE}},
{ path: '/submission/:id', name: 'submission', component: submission, meta: { layout: LAYOUT_SIMPLE } }, {path: '/submission/:id', name: 'submission', component: submission, meta: {layout: LAYOUT_SIMPLE}},
{ path: '/topic/:topicSlug', name: 'topic', component: topic, alias: '/book/topic/:topicSlug' }, {path: '/topic/:topicSlug', name: 'topic', component: topic, alias: '/book/topic/:topicSlug'},
{ path: '/join-class', name: 'join-class', component: joinClass, meta: { layout: LAYOUT_SIMPLE } }, {path: '/join-class', name: 'join-class', component: joinClass, meta: {layout: LAYOUT_SIMPLE}},
{ {
path: '/survey/:id', path: '/survey/:id',
component: surveyPage, component: surveyPage,
name: 'survey', name: 'survey',
props: true, props: true,
meta: { layout: LAYOUT_SIMPLE }, meta: {layout: LAYOUT_SIMPLE},
}, },
{ {
path: '/news', path: '/news',
@ -76,7 +74,7 @@ const routes = [
}, },
{ {
path: '/oauth-redirect', path: '/oauth-redirect',
redirect: (to) => { redirect: to => {
switch (to.query.state) { switch (to.query.state) {
case EMAIL_NOT_VERIFIED_STATE: case EMAIL_NOT_VERIFIED_STATE:
return '/verify-email'; return '/verify-email';
@ -94,28 +92,28 @@ const routes = [
} }
}, },
}, },
{ path: '/styleguide', component: styleGuidePage }, {path: '/styleguide', component: styleGuidePage},
{ {
path: '/not-found', path: '/not-found',
name: 'not-found', name: 'not-found',
...notFoundRoute, ...notFoundRoute
}, },
{ {
path: '*', path: '/:pathMatch(.*)*',
...notFoundRoute, ...notFoundRoute
}, },
]; ];
Vue.use(Router);
const router = new Router({ const router = createRouter({
routes, routes,
history: createWebHistory(),
mode: 'history', mode: 'history',
scrollBehavior(to, from, savedPosition) { scrollBehavior(to, from, savedPosition) {
if (savedPosition) { if (savedPosition) {
return savedPosition; return savedPosition;
} }
return { x: 0, y: 0 }; return {left: 0, top: 0};
}, },
}); });
@ -124,4 +122,4 @@ router.afterEach(() => {
store.dispatch('showMobileNavigation', false); store.dispatch('showMobileNavigation', false);
}); });
export { router, postLoginRedirectUrlKey }; export {router, postLoginRedirectUrlKey};