about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-12-01 14:11:51 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2019-12-01 14:11:51 +0100
commita28d5383f973e26da70b738f4a319083c45551af (patch)
tree9728836cc5e4aa7bba987659beb00eafeab856e4
parent47df6b13e0e4d40573534c57bbcc03e880782de5 (diff)
parent070b7725be5fb0db486e9370bea5648c16c8bbfe (diff)
downloadpuszcza-a28d5383f973e26da70b738f4a319083c45551af.tar.gz
puszcza-a28d5383f973e26da70b738f4a319083c45551af.zip
Merge remote-tracking branch 'origin/develop' into storybook
-rw-r--r--components/PostList/PostList.vue15
-rw-r--r--pages/do-pobrania.vue29
-rw-r--r--pages/kronika/index.vue1
-rwxr-xr-xscripts/generateApi.js5
-rwxr-xr-xscripts/postbuild.sh1
-rw-r--r--static/files/Książeczka_sprawności.pdfbin0 -> 6080091 bytes
6 files changed, 44 insertions, 7 deletions
diff --git a/components/PostList/PostList.vue b/components/PostList/PostList.vue
index 206a73f..2d1bb2d 100644
--- a/components/PostList/PostList.vue
+++ b/components/PostList/PostList.vue
@@ -1,8 +1,9 @@
 <template>
-  <pure-post-list :posts="posts" :loading="loading" />
+  <pure-post-list v-if="rawPosts" :posts="posts" :loading="loading" />
 </template>
 
 <script>
+import k from '~/api'
 import PurePostList from './PurePostList'
 
 export default {
@@ -14,6 +15,12 @@ export default {
       required: false
     }
   },
+  async asyncData() {
+    return {
+      loading: process.client,
+      rawPosts: process.client ? undefined : k.getPosts()
+    }
+  },
   data() {
     return {
       loading: true,
@@ -21,7 +28,9 @@ export default {
     }
   },
   mounted() {
-    this.loadPostsClient()
+    if (process.client && this.rawPosts === undefined) {
+      this.loadPostsClient()
+    }
   },
   computed: {
     posts() {
@@ -46,4 +55,4 @@ export default {
     }
   }
 }
-</script>
\ No newline at end of file
+</script>
diff --git a/pages/do-pobrania.vue b/pages/do-pobrania.vue
index dd6b507..453b8d4 100644
--- a/pages/do-pobrania.vue
+++ b/pages/do-pobrania.vue
@@ -1,11 +1,34 @@
 <template>
   <div class="container">
     <h1>Do pobrania</h1>
-    <a class="link" href="/files/Karta_próby_na_sprawność.pdf">Karta próby na sprawność</a>
-    <a class="link" href="/files/Próba_Harcerza.pdf">Próba Harcerza</a>
+    <a
+      v-for="{ file, title } in files"
+      :key="file"
+      class="link"
+      :href="`/files/${file}`"
+    >
+      {{ title }}
+    </a>
   </div>
 </template>
 
+<script>
+export default {
+  data() {
+    return {
+      files: [
+        {
+          file: 'Karta_próby_na_sprawność.pdf',
+          title: 'Karta próby na sprawność'
+        },
+        { file: 'Próba_Harcerza.pdf', title: 'Próba Harcerza' },
+        { file: 'Książeczka_sprawności.pdf', title: 'Książeczka sprawności' }
+      ]
+    }
+  }
+}
+</script>
+
 <style scoped>
 .container {
   display: flex;
@@ -15,4 +38,4 @@
 .link {
   margin: 5px;
 }
-</style>
\ No newline at end of file
+</style>
diff --git a/pages/kronika/index.vue b/pages/kronika/index.vue
index d9685c1..b478a75 100644
--- a/pages/kronika/index.vue
+++ b/pages/kronika/index.vue
@@ -14,4 +14,3 @@ export default {
   }
 }
 </script>
-
diff --git a/scripts/generateApi.js b/scripts/generateApi.js
index f72745e..7635f02 100755
--- a/scripts/generateApi.js
+++ b/scripts/generateApi.js
@@ -20,4 +20,9 @@ posts.sort((a, b) => (a.route > b.route ? 1 : -1))
 fs.writeFile('./dist/api/posts.json', JSON.stringify(posts), err =>
   err ? console.log(err) : null
 )
+
+fs.writeFile('./static/api/posts.json', JSON.stringify(posts), err =>
+  err ? console.log(err) : null
+)
+
 console.log(posts)
diff --git a/scripts/postbuild.sh b/scripts/postbuild.sh
index 85e35f9..6da3659 100755
--- a/scripts/postbuild.sh
+++ b/scripts/postbuild.sh
@@ -1,6 +1,7 @@
 #!/usr/bin/env bash
 
 mkdir ./dist/api
+mkdir ./static/api
 
 node -r esm ./scripts/generateApi.js
 
diff --git a/static/files/Książeczka_sprawności.pdf b/static/files/Książeczka_sprawności.pdf
new file mode 100644
index 0000000..4768c67
--- /dev/null
+++ b/static/files/Książeczka_sprawności.pdf
Binary files differ