Pārlūkot izejas kodu

:fire: bring back computed checks

tags/0.9.0
J 4 gadus atpakaļ
vecāks
revīzija
3789370da5
1 mainītis faili ar 16 papildinājumiem un 12 dzēšanām
  1. 16
    12
      vue-theme/src/pages/list.vue

+ 16
- 12
vue-theme/src/pages/list.vue Parādīt failu

30
 import card from '@/components/card'
30
 import card from '@/components/card'
31
 import sidebar from '@/components/sidebars/sidebar'
31
 import sidebar from '@/components/sidebars/sidebar'
32
 import { postTypeGetters, scrollTop, heroUtils } from './mixin-post-types'
32
 import { postTypeGetters, scrollTop, heroUtils } from './mixin-post-types'
33
-
34
 import { postTypes, sortTypes, convertTitleCase } from '@/utils/helpers'
33
 import { postTypes, sortTypes, convertTitleCase } from '@/utils/helpers'
35
 
34
 
36
 const TIMEOUT = 1
35
 const TIMEOUT = 1
37
 const INTERSECT_SELECTOR = '.page--list > article footer'
36
 const INTERSECT_SELECTOR = '.page--list > article footer'
38
 
37
 
39
-const wideTypes = ['event', 'exhibition']
40
-const gridTypes = ['episode', 'artist']
41
-const sansSidebarTypes = ['episode']
42
-
43
 export default {
38
 export default {
44
     components: { sidebar, featuredImage, card },
39
     components: { sidebar, featuredImage, card },
45
     mixins: [postTypeGetters, scrollTop, heroUtils],
40
     mixins: [postTypeGetters, scrollTop, heroUtils],
53
         }
48
         }
54
     },
49
     },
55
     computed: {
50
     computed: {
56
-        grid: () => gridTypes.includes(this.type),
57
-        isWide: () => wideTypes.includes(this.type),
58
-        sidebar: () => !sansSidebarTypes.includes(this.type),
51
+        grid: () => ['episode', 'artist'].includes(this.type),
52
+        isWide: () => ['event', 'exhibition'].includes(this.type),
53
+        sidebar: () => !['episode'].includes(this.type),
59
         type: () => this.$route.params.type,
54
         type: () => this.$route.params.type,
60
         sortBy: () => this.$route.params.sortBy,
55
         sortBy: () => this.$route.params.sortBy,
61
-        pType: () => `${convertTitleCase(this.type)}s`,
62
-        loaded: () => this[`all${this.pType}Loaded`],
63
-        posts: () => this[`all${this.pType}`],
64
-        shouldLoadAllAtOnce: () => this.type == 'episode' || this.type == 'artist' && this.sortBy == sortTypes.material
56
+        shouldLoadAllAtOnce: () => this.type == 'episode' || this.type == 'artist' && this.sortBy == sortTypes.material,
57
+        pType: () => {
58
+            if(!this.type) return
59
+            return `${convertTitleCase(this.type)}s`
60
+        },
61
+        loaded: () => {
62
+            if (!this.pType) return
63
+            return this[`all${this.pType}Loaded`]
64
+        },
65
+        posts: () => {
66
+            if (!this.pType) return
67
+            return this[`all${this.pType}`]
68
+        }
65
     },
69
     },
66
     methods: {
70
     methods: {
67
         async loadMorePosts(shouldClear) {
71
         async loadMorePosts(shouldClear) {

Notiek ielāde…
Atcelt
Saglabāt