Procházet zdrojové kódy

:recycle: adding back sidebar | removing logs | cleaning up

tags/0.9.0
J před 4 roky
rodič
revize
4625728a6a
1 změnil soubory, kde provedl 13 přidání a 13 odebrání
  1. 13
    13
      vue-theme/src/pages/list.vue

+ 13
- 13
vue-theme/src/pages/list.vue Zobrazit soubor

@@ -23,7 +23,7 @@
23 23
             p {{ `${type} count: ${Object.values(posts).length}` }}
24 24
             p {{ `show sidebar: ${sidebar}` }}
25 25
 
26
-    //- sidebar(v-if="sidebar" :type="`${type}`" layout="list")
26
+    sidebar(v-if="sidebar" :type="`${type}`" layout="list")
27 27
 </template>
28 28
 
29 29
 <script>
@@ -35,7 +35,7 @@ import { postTypeGetters, scrollTop, heroUtils } from './mixin-post-types'
35 35
 import { postTypes, convertTitleCase, typeFromRoute } from '@/utils/helpers'
36 36
 
37 37
 const TIMEOUT = 1
38
-const INTERSECT_SELECTION = ".page--list > article footer"
38
+const INTERSECT_SELECTOR = ".page--list > article footer"
39 39
 export default {
40 40
     components: { sidebar, featuredImage, card },
41 41
     props: {
@@ -47,7 +47,7 @@ export default {
47 47
     data() {
48 48
         return {
49 49
             page: 0,
50
-            perPage: 15,
50
+            perPage: 21,
51 51
             keepFetching: true,
52 52
             loadingFetched: false,
53 53
             observer: null
@@ -85,6 +85,11 @@ export default {
85 85
 
86 86
             console.warn(`loading more ${type} posts...`)
87 87
             this.loadingFetched = true
88
+            console.warn(
89
+                `loading page ${this.page + 1} of ${type} posts: 
90
+                    ${this.page * this.perPage + 1} through 
91
+                    ${(this.page + 1) * this.perPage}`
92
+            )
88 93
             this.page++
89 94
             await this.getPosts()
90 95
         },
@@ -108,7 +113,7 @@ export default {
108 113
         async getPosts() {
109 114
             // Edge case for episodes
110 115
             await this._getAll('episode', this.$store)
111
-
116
+            
112 117
             const dispatchAction = `getMore${this.pType}`
113 118
             let res = null
114 119
             if(this.pType && dispatchAction != `getMoreEpisodes`) {
@@ -120,7 +125,7 @@ export default {
120 125
 
121 126
             // Stop trying to load more posts
122 127
             if(res && !res.length) {
123
-                console.warn('nothing left to get...')
128
+                console.warn(`empty response for ${this.type}:`, res)
124 129
                 this.keepFetching = false
125 130
             }
126 131
             this.loadingFetched = false
@@ -135,7 +140,7 @@ export default {
135 140
             // We always set a hero no matter what
136 141
             // Because the hero component will deal
137 142
             // with how to render based on hero.url
138
-            if(!this.allPages) return console.log('no pages in state', this)
143
+            if(!this.allPages) return console.warn('no pages in state', this)
139 144
             const page = this.allPages.filter(
140 145
                 page => page.slug == type + 's',
141 146
             )[0]
@@ -146,17 +151,12 @@ export default {
146 151
         setIntersectionLoader() {
147 152
             if(!this.type) return console.error('cannot setup interseciton handler for undefined type')
148 153
 
149
-            console.warn('setting up intersection handler for:', this.type)
150
-            const footerEl = document.querySelector(INTERSECT_SELECTION)
151
-            // console.warn('found el: ',footerEl)
154
+            const footerEl = document.querySelector(INTERSECT_SELECTOR)
152 155
             if(!footerEl) return
153
-            // console.warn('attach to: ',footerEl)
154 156
 
155 157
             const onIntersect = (entries, observer) => {
156
-                console.log('intersection handler fired...')
157 158
                 entries.forEach(entry => {
158 159
                     if (!entry.isIntersecting || this.loadingFetched) return
159
-                    console.log("intersected:", entry)
160 160
                     setTimeout(() => {
161 161
                         this.loadMorePosts()
162 162
                     }, TIMEOUT)
@@ -169,7 +169,7 @@ export default {
169 169
             this.observer.observe(footerEl)
170 170
         },
171 171
         unsetIntersectionLoader() {
172
-            const footerEl = document.querySelector(INTERSECT_SELECTION)
172
+            const footerEl = document.querySelector(INTERSECT_SELECTOR)
173 173
             if(!footerEl) return
174 174
 
175 175
             console.warn('unsetting intersection handler on:', footerEl)

Načítá se…
Zrušit
Uložit