update library views

This commit is contained in:
axolotle
2021-06-04 10:41:47 +02:00
parent df7f47f718
commit 248837e8a1
6 changed files with 45 additions and 41 deletions
+9
View File
@@ -9,6 +9,15 @@
"gallery": "Créations numériques", "gallery": "Créations numériques",
"blog": "Blog" "blog": "Blog"
}, },
"variants": {
"depart": "Texte de départ",
"critique": "Texte critique",
"echo": "Constellation en écho",
"reflexion": "Réflexion théorique",
"lecture": "Lecture rapprochée",
"sensible": "Expérience sensible",
"kit": "Fiche-outil de désapprentisage"
},
"options": { "options": {
"display": { "display": {
"title": "Gestion de l'affichage", "title": "Gestion de l'affichage",
-1
View File
@@ -28,7 +28,6 @@
@close="closeText(parent.id, $event)" @close="closeText(parent.id, $event)"
@click.native="onSubTextClick(i, j)" @click.native="onSubTextClick(i, j)"
/> />
<!-- :class="{ 'text-blur': i !== parents.length - 1 || j !== parent.children.length - 1 }" -->
</section> </section>
</section> </section>
</div> </div>
+6 -2
View File
@@ -1,7 +1,7 @@
<template> <template>
<div class="card-list"> <div class="card-list">
<div class="card-list-container"> <div class="card-list-container">
<div v-for="(parents, char) in orderedParents" :key="char"> <div v-for="(parents, char) in orderedTextsDepart" :key="char">
<h3>{{ char }}</h3> <h3>{{ char }}</h3>
<div class="text-group"> <div class="text-group">
<text-mini-card <text-mini-card
@@ -31,7 +31,11 @@ export default {
}, },
computed: { computed: {
...mapGetters(['orderedParents']) ...mapGetters(['orderedTextsDepart'])
},
created () {
this.$store.dispatch('INIT_LIBRARY_LIST')
} }
} }
</script> </script>
+11 -9
View File
@@ -1,9 +1,8 @@
<template> <template>
<b-overlay :show="loading" class="h-100"> <b-overlay :show="texts === undefined" class="h-100">
<svg <svg
width="100%" height="100%" width="100%" height="100%"
ref="svg" id="vis" ref="svg" id="vis"
v-if="textsDepart"
:view-box.camel="viewBox" :view-box.camel="viewBox"
> >
<g id="cards"> <g id="cards">
@@ -14,8 +13,8 @@
:transform="`rotate(${node.rotate})`" :transform="`rotate(${node.rotate})`"
> >
<text-mini-card <text-mini-card
:id="textsDepart[i].id" :id="texts[i].id"
:text-data="textsDepart[i]" :text-data="texts[i]"
/> />
</foreignObject> </foreignObject>
</g> </g>
@@ -44,12 +43,12 @@ export default {
data () { data () {
return { return {
loading: true,
width: 100, width: 100,
height: 100, height: 100,
nodes: new Array(20).fill().map((_, i) => ({ x: i, rotate: randomUniform(-25, 25)() })), nodes: undefined,
simulation: forceSimulation(), simulation: forceSimulation(),
viewBox: null viewBox: null,
texts: undefined
} }
}, },
@@ -65,8 +64,11 @@ export default {
}, },
created () { created () {
this.$store.dispatch('GET_TEXTS_DEPART').then(() => { this.$store.dispatch('INIT_LIBRARY_MAP').then(data => {
this.loading = false this.texts = data
this.nodes = data.map((node, i) => {
return { x: i, rotate: randomUniform(-25, 25)() }
})
this.$nextTick(() => { this.$nextTick(() => {
this.updateSize() this.updateSize()
+13 -14
View File
@@ -40,14 +40,15 @@
</b-form-group> </b-form-group>
</b-form-group> </b-form-group>
<b-form-group <b-form-group
v-else
label="Texte de départ :" label="Texte de départ :"
label-for="text-depart-select" label-for="text-depart-select"
class="w-25" class="w-25"
> >
<b-form-select <b-form-select
id="text-depart-select" id="text-depart-select"
v-model="textDepartId" v-model="nodeDepartId"
:options="textsDepartOptions" :options="nodesDepartsOptions"
class="border" class="border"
/> />
</b-form-group> </b-form-group>
@@ -101,24 +102,22 @@ export default {
}, },
computed: { computed: {
...mapGetters(['textsDepartOptions']) ...mapGetters(['nodesDepartsOptions']),
nodeDepartId: {
get () {
return this.$store.state.library.nodeDepartId
},
set (value) {
this.$store.dispatch('SET_NODE_DEPART_ID', value)
}
}
}, },
watch: { watch: {
currentMode (mode) { currentMode (mode) {
this.$router.push({ query: { mode } }) this.$router.push({ query: { mode } })
},
textDepartId (id) {
console.log('textDepartId changed', id)
this.$store.dispatch('GET_TREE_WITH_DEPTH', { id })
} }
},
created () {
this.$store.dispatch('GET_TEXTS_DEPART').then(data => {
this.textDepartId = data[0].id
})
} }
} }
</script> </script>
+6 -15
View File
@@ -1,8 +1,8 @@
<template> <template>
<b-overlay :show="loading" class="h-100"> <b-overlay :show="nodeTree === undefined" class="h-100">
<node-map <node-map
v-if="!loading" v-if="nodeTree !== undefined"
v-bind="mapData" v-bind="nodeTree"
v-on="$listeners" v-on="$listeners"
/> />
</b-overlay> </b-overlay>
@@ -12,7 +12,6 @@
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import NodeMap from '@/components/NodeMap' import NodeMap from '@/components/NodeMap'
import { toManyManyData } from '@/helpers/d3Data'
export default { export default {
@@ -30,19 +29,11 @@ export default {
}, },
computed: { computed: {
...mapGetters(['textDepart']) ...mapGetters(['nodeTree'])
}, },
watch: { created () {
textDepart (text) { this.$store.dispatch('INIT_LIBRARY_TREE')
if (text) {
this.mapData = toManyManyData(this.textDepart)
this.loading = false
} else {
this.mapData = undefined
this.loading = true
}
}
} }
} }
</script> </script>