Browse Source

:fire: bring back computed checks

tags/0.9.0
J 4 years ago
parent
commit
3789370da5
1 changed files with 16 additions and 12 deletions
  1. 16
    12
      vue-theme/src/pages/list.vue

+ 16
- 12
vue-theme/src/pages/list.vue View File

@@ -30,16 +30,11 @@ import featuredImage from '@/components/featured-image'
30 30
 import card from '@/components/card'
31 31
 import sidebar from '@/components/sidebars/sidebar'
32 32
 import { postTypeGetters, scrollTop, heroUtils } from './mixin-post-types'
33
-
34 33
 import { postTypes, sortTypes, convertTitleCase } from '@/utils/helpers'
35 34
 
36 35
 const TIMEOUT = 1
37 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 38
 export default {
44 39
     components: { sidebar, featuredImage, card },
45 40
     mixins: [postTypeGetters, scrollTop, heroUtils],
@@ -53,15 +48,24 @@ export default {
53 48
         }
54 49
     },
55 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 54
         type: () => this.$route.params.type,
60 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 70
     methods: {
67 71
         async loadMorePosts(shouldClear) {

Loading…
Cancel
Save