|
|
@@ -1,12 +1,16 @@
|
|
1
|
1
|
import { sortTypes } from '../../utils/helpers'
|
|
2
|
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))
|
|
|
3
|
+const _insertInBetweens = bySort => {
|
|
|
4
|
+ const postListWithInBetweens = []
|
|
|
5
|
+ Object.keys(bySort).forEach(term => {
|
|
|
6
|
+ postListWithInBetweens.push({
|
|
|
7
|
+ slug: term,
|
|
|
8
|
+ title: term,
|
|
|
9
|
+ inbetween: true
|
|
|
10
|
+ })
|
|
|
11
|
+ bySort[term].forEach(post => postListWithInBetweens.push(post))
|
|
8
|
12
|
})
|
|
9
|
|
- return flatPacked
|
|
|
13
|
+ return postListWithInBetweens
|
|
10
|
14
|
}
|
|
11
|
15
|
|
|
12
|
16
|
const _arrangeByMaterial = postsList => {
|
|
|
@@ -19,7 +23,7 @@ const _arrangeByMaterial = postsList => {
|
|
19
|
23
|
byMaterial[mat].push(post)
|
|
20
|
24
|
})
|
|
21
|
25
|
})
|
|
22
|
|
- const flatPacked = _makeFlatpack(byMaterial)
|
|
|
26
|
+ const flatPacked = _insertInBetweens(byMaterial)
|
|
23
|
27
|
return flatPacked
|
|
24
|
28
|
}
|
|
25
|
29
|
|
|
|
@@ -32,7 +36,7 @@ const _arrangeByType = postsList => {
|
|
32
|
36
|
byType[type].push(post)
|
|
33
|
37
|
})
|
|
34
|
38
|
})
|
|
35
|
|
- const flatPacked = _makeFlatpack(byType)
|
|
|
39
|
+ const flatPacked = _insertInBetweens(byType)
|
|
36
|
40
|
return flatPacked
|
|
37
|
41
|
}
|
|
38
|
42
|
|
|
|
@@ -65,7 +69,7 @@ const _arrangeByEpisode = postsList => {
|
|
65
|
69
|
if(!byEpisode[relatedEpisode]) byEpisode[relatedEpisode] = []
|
|
66
|
70
|
byEpisode[relatedEpisode].push(post)
|
|
67
|
71
|
})
|
|
68
|
|
- const flatPacked = _makeFlatpack(byEpisode)
|
|
|
72
|
+ const flatPacked = _insertInBetweens(byEpisode)
|
|
69
|
73
|
return flatPacked
|
|
70
|
74
|
}
|
|
71
|
75
|
|