|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+import { sortTypes } from '../../utils/helpers'
|
|
|
2
|
+
|
|
|
3
|
+const _makeFlatpack = bySort => {
|
|
|
4
|
+ const flatPacked = []
|
|
|
5
|
+ Object.keys(bySort).forEach(sort => {
|
|
|
6
|
+ flatPacked.push({ slug: sort, title: sort, inbetween: true })
|
|
|
7
|
+ bySort[sort].forEach(post => flatPacked.push(post))
|
|
|
8
|
+ })
|
|
|
9
|
+ return flatPacked
|
|
|
10
|
+}
|
|
|
11
|
+
|
|
1
|
12
|
const _arrangeByMaterial = postsList => {
|
|
2
|
13
|
const byMaterial = {
|
|
3
|
14
|
clay: []
|
|
|
@@ -8,11 +19,7 @@ const _arrangeByMaterial = postsList => {
|
|
8
|
19
|
byMaterial[mat].push(post)
|
|
9
|
20
|
})
|
|
10
|
21
|
})
|
|
11
|
|
- const flatPacked = []
|
|
12
|
|
- Object.keys(byMaterial).forEach(material => {
|
|
13
|
|
- flatPacked.push({ slug: material, title: material, inbetween: true })
|
|
14
|
|
- byMaterial[material].forEach(post => flatPacked.push(post))
|
|
15
|
|
- })
|
|
|
22
|
+ const flatPacked = _makeFlatpack(byMaterial)
|
|
16
|
23
|
return flatPacked
|
|
17
|
24
|
}
|
|
18
|
25
|
|
|
|
@@ -25,11 +32,7 @@ const _arrangeByType = postsList => {
|
|
25
|
32
|
byType[type].push(post)
|
|
26
|
33
|
})
|
|
27
|
34
|
})
|
|
28
|
|
- const flatPacked = []
|
|
29
|
|
- Object.keys(byType).forEach(type => {
|
|
30
|
|
- flatPacked.push({ slug: type, title: type, inbetween: true })
|
|
31
|
|
- byType[type].forEach(post => flatPacked.push(post))
|
|
32
|
|
- })
|
|
|
35
|
+ const flatPacked = _makeFlatpack(byType)
|
|
33
|
36
|
return flatPacked
|
|
34
|
37
|
}
|
|
35
|
38
|
|
|
|
@@ -62,11 +65,7 @@ const _arrangeByEpisode = postsList => {
|
|
62
|
65
|
if(!byEpisode[relatedEpisode]) byEpisode[relatedEpisode] = []
|
|
63
|
66
|
byEpisode[relatedEpisode].push(post)
|
|
64
|
67
|
})
|
|
65
|
|
- const flatPacked = []
|
|
66
|
|
- Object.keys(byEpisode).forEach(episode => {
|
|
67
|
|
- flatPacked.push({ slug: episode, title: episode, inbetween: true })
|
|
68
|
|
- byEpisode[episode].forEach(post => flatPacked.push(post))
|
|
69
|
|
- })
|
|
|
68
|
+ const flatPacked = _makeFlatpack(byEpisode)
|
|
70
|
69
|
return flatPacked
|
|
71
|
70
|
}
|
|
72
|
71
|
|