diff --git a/src/pages/library/CardList.vue b/src/pages/library/CardList.vue
index a11ea33..178256d 100644
--- a/src/pages/library/CardList.vue
+++ b/src/pages/library/CardList.vue
@@ -1,12 +1,54 @@
-
+
diff --git a/src/store/modules/texts.js b/src/store/modules/texts.js
index e3c2918..3d72216 100644
--- a/src/store/modules/texts.js
+++ b/src/store/modules/texts.js
@@ -58,6 +58,23 @@ export default {
value: id,
text: `(${id}) ${title}`
}))
+ },
+
+ orderedParents: state => {
+ // FIXME duplicates references if multiple authors ?
+ if (!state.textsDepart) return undefined
+ return state.textsDepart.sort((a, b) => {
+ if (!b.authors) return -1
+ if (!a.authors) return +1
+ if (a.authors[0].name < b.authors[0].name) return -1
+ if (a.authors[0].name > b.authors[0].name) return 1
+ return 0
+ }).reduce((dict, text) => {
+ const firstChar = text.authors ? text.authors[0].name[0] : '&'
+ if (!(firstChar in dict)) dict[firstChar] = []
+ dict[firstChar].push(text)
+ return dict
+ }, {})
}
}
}