Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/firstrunwizard.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2022-04-15 18:29:12 +0300
committerJohn Molakvoæ <skjnldsv@protonmail.com>2022-04-15 18:31:20 +0300
commitfaa1a2ad5a8519c84a87ca24bc2e5ca5fb15d56b (patch)
treef7f2fc5759aa303c75a24017092a46271d7d7d0e /src
parent292175ec812ea7adae46c5ec653afc56b64ccb97 (diff)
Bump @nextcloud/eslint-config from 6.1.2 to 7.0.2
Bumps [@nextcloud/eslint-config](https://github.com/nextcloud/eslint-config) from 6.1.2 to 7.0.2. - [Release notes](https://github.com/nextcloud/eslint-config/releases) - [Changelog](https://github.com/nextcloud/eslint-config/blob/master/CHANGELOG.md) - [Commits](https://github.com/nextcloud/eslint-config/compare/v6.1.2...v7.0.2) --- updated-dependencies: - dependency-name: "@nextcloud/eslint-config" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Diffstat (limited to 'src')
-rw-r--r--src/App.vue195
1 files changed, 97 insertions, 98 deletions
diff --git a/src/App.vue b/src/App.vue
index e1b5e415..5c24f805 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,6 +1,5 @@
<template>
- <Modal
- v-if="showModal && slideList.length > 0"
+ <Modal v-if="showModal && slideList.length > 0"
id="firstrunwizard"
size="large"
:has-previous="hasPrevious"
@@ -38,6 +37,102 @@
</div>
</Modal>
</template>
+<script>
+import Modal from '@nextcloud/vue/dist/Components/Modal'
+import axios from '@nextcloud/axios'
+import { generateUrl } from '@nextcloud/router'
+import IntroVideo from './components/IntroVideo'
+
+export default {
+ name: 'App',
+ components: {
+ Modal,
+ },
+ data() {
+ return {
+ showModal: false,
+ withIntro: true,
+ slides: [],
+ currentSlide: 0,
+ fadeDirection: 'next',
+ slidesLoaded: false,
+ }
+ },
+ computed: {
+ slideList() {
+ if (this.withIntro) {
+ return this.slides
+ }
+ const slides = this.slides
+ return slides.slice(1)
+ },
+ hasNext() {
+ return this.currentSlide < this.slideList.length - 1
+ },
+ hasPrevious() {
+ return this.currentSlide > 0
+ },
+ isLast() {
+ return this.currentSlide === this.slideList.length - 1
+ },
+ isFirst() {
+ return this.currentSlide === 0
+ },
+ startButtonText() {
+ return t('firstrunwizard', 'Start using {cloudName}', { cloudName: window.OC.theme.name })
+ },
+ },
+ async created() {
+ this.slides = [IntroVideo]
+ window.addEventListener('resize', this.onResize)
+ },
+ beforeDestroy() {
+ window.removeEventListener('resize', this.onResize)
+ },
+ methods: {
+ async loadStaticSlides() {
+ if (this.slidesLoaded) {
+ return
+ }
+
+ try {
+ const response = await axios.get(generateUrl('/apps/firstrunwizard/wizard'))
+ this.slides.push(...response.data.slides)
+ this.withIntro = response.data.hasVideo
+ this.slidesLoaded = true
+ } catch (e) {
+ console.error('Failed to load slides')
+ }
+ },
+ async open(withIntro = true) {
+ await this.loadStaticSlides()
+ this.withIntro = this.withIntro & withIntro
+ this.showModal = true
+ this.currentSlide = 0
+ },
+ close() {
+ this.showModal = false
+ axios.delete(generateUrl('/apps/firstrunwizard/wizard'))
+ },
+ next() {
+ this.fadeDirection = 'next'
+ if (this.isLast) {
+ this.close()
+ return
+ }
+ this.currentSlide += 1
+ },
+ previous() {
+ this.fadeDirection = 'previous'
+ if (this.isFirst) {
+ return
+ }
+ this.currentSlide -= 1
+ },
+ },
+}
+</script>
+
<style lang="scss">
/* Page styling needs to be unscoped, since we load it separately from the server */
#firstrunwizard {
@@ -243,7 +338,6 @@
}
}
</style>
-
<style lang="scss" scoped>
.modal-mask {
background-color: rgba(0, 0, 0, 0.7);
@@ -343,98 +437,3 @@
opacity: 0;
}
</style>
-<script>
-import Modal from '@nextcloud/vue/dist/Components/Modal'
-import axios from '@nextcloud/axios'
-import { generateUrl } from '@nextcloud/router'
-import IntroVideo from './components/IntroVideo'
-
-export default {
- name: 'App',
- components: {
- Modal,
- },
- data() {
- return {
- showModal: false,
- withIntro: true,
- slides: [],
- currentSlide: 0,
- fadeDirection: 'next',
- slidesLoaded: false,
- }
- },
- computed: {
- slideList() {
- if (this.withIntro) {
- return this.slides
- }
- const slides = this.slides
- return slides.slice(1)
- },
- hasNext() {
- return this.currentSlide < this.slideList.length - 1
- },
- hasPrevious() {
- return this.currentSlide > 0
- },
- isLast() {
- return this.currentSlide === this.slideList.length - 1
- },
- isFirst() {
- return this.currentSlide === 0
- },
- startButtonText() {
- return t('firstrunwizard', 'Start using {cloudName}', { cloudName: window.OC.theme.name })
- },
- },
- async created() {
- this.slides = [IntroVideo]
- window.addEventListener('resize', this.onResize)
- },
- beforeDestroy() {
- window.removeEventListener('resize', this.onResize)
- },
- methods: {
- async loadStaticSlides() {
- if (this.slidesLoaded) {
- return
- }
-
- try {
- const response = await axios.get(generateUrl('/apps/firstrunwizard/wizard'))
- this.slides.push(...response.data.slides)
- this.withIntro = response.data.hasVideo
- this.slidesLoaded = true
- } catch (e) {
- console.error('Failed to load slides')
- }
- },
- async open(withIntro = true) {
- await this.loadStaticSlides()
- this.withIntro = this.withIntro & withIntro
- this.showModal = true
- this.currentSlide = 0
- },
- close() {
- this.showModal = false
- axios.delete(generateUrl('/apps/firstrunwizard/wizard'))
- },
- next() {
- this.fadeDirection = 'next'
- if (this.isLast) {
- this.close()
- return
- }
- this.currentSlide += 1
- },
- previous() {
- this.fadeDirection = 'previous'
- if (this.isFirst) {
- return
- }
- this.currentSlide -= 1
- },
- },
-}
-</script>