From b3e3b4b3e2bf17d7e3f893b01d163d41575961ca Mon Sep 17 00:00:00 2001
From: Adam Procter <adamprocter@researchnot.es>
Date: Sun, 15 Mar 2020 16:30:17 +0000
Subject: [PATCH] made delete work

fixed up a few other minor typos too
---
 CHANGELOG.md                      | 26 +++++++++++++++++---------
 app/package.json                  |  2 +-
 app/src/components/NodesLayer.vue | 11 ++++-------
 app/src/store/index.js            | 30 ++++++++++++++++++++----------
 app/src/views/About.vue           | 21 +++++++++------------
 5 files changed, 51 insertions(+), 39 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 88598c2..01c0214 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,15 +1,23 @@
+# 0.1.7
+
+_15th March 2020_
+
+### Changed
+
+- Delete will now remove the node from view.
+
 # 0.1.6
 
 _14th March 2020_
 
 ### Changed
 
-- Changed to HTML History mode, removing Hash from URL
+- Changed to HTML History mode, removing Hash from URL.
 
 ### Fixed
 
-- Safari reload bug on initial creation of microcosms
-- Pressing Enter allows quick onboard aswell, also no reload
+- Safari reload bug on initial creation of microcosms.
+- Pressing Enter allows quick onboard aswell, also no reload.
 
 # 0.1.5
 
@@ -17,9 +25,9 @@ _14th March 2020_
 
 ### Changed
 
-- Added BaseButton Component to use for all buttons
-- removed CanvasLayer. and DeBug.vue no longer necessary as CanvasLayer is being rebuilt and Debug buttons all moved to ControlsLayer.vue
-- Minor CSS changes as well
+- Added BaseButton Component to use for all buttons.
+- removed CanvasLayer. and DeBug.vue no longer necessary as CanvasLayer is being rebuilt and Debug buttons all moved to ControlsLayer.vue.
+- Minor CSS changes as well.
 
 # 0.1.4
 
@@ -27,11 +35,11 @@ _11th March 2020_
 
 ### Added
 
-- Added a SCHEMA.md document to the repo to outline the way to call to the data in PouchDB/ CouchDB
+- Added a SCHEMA.md document to the repo to outline the way to call to the data in PouchDB/ CouchDB.
 
 ### Changed
 
-- Changed store/index.js, Home.vue, NodesLayer.vue and OtherNodeslayer.vue to work with new Schema structure
+- Changed store/index.js, Home.vue, NodesLayer.vue and OtherNodeslayer.vue to work with new Schema structure.
 
 # 0.1.3
 
@@ -44,7 +52,7 @@ _4th March 2020_
 ### Changed
 
 - Version stated in package.json is pulled into About.vue. Meaning version can now be updated in one place.
-- Added link to this CHANGELOG.md on About.vue
+- Added link to this CHANGELOG.md on About.vue.
 
 ### Fixed
 
diff --git a/app/package.json b/app/package.json
index 1758228..f19c71f 100644
--- a/app/package.json
+++ b/app/package.json
@@ -1,6 +1,6 @@
 {
   "name": "nodenogg.in",
-  "version": "0.1.6",
+  "version": "0.1.7",
   "private": true,
   "scripts": {
     "serve": "vue-cli-service serve",
diff --git a/app/src/components/NodesLayer.vue b/app/src/components/NodesLayer.vue
index 47cab2c..7d1eecc 100644
--- a/app/src/components/NodesLayer.vue
+++ b/app/src/components/NodesLayer.vue
@@ -29,15 +29,11 @@
           </div>
           <h3>Reactions</h3>
           <div v-for="(emojis, index) in configEmoji" :key="index">
-            <p class="allemoji" v-if="nodeid == emojis.node_id">
-              {{ emojis.emoji_text }}
-            </p>
+            <p class="allemoji" v-if="nodeid == emojis.node_id">{{ emojis.emoji_text }}</p>
           </div>
 
           <p>markdown supported</p>
-          <BaseButton buttonClass="danger" @click="deleteFlag()"
-            >Delete</BaseButton
-          >
+          <BaseButton buttonClass="danger" @click="deleteFlag()">Delete</BaseButton>
         </form>
       </vue-draggable-resizable>
     </div>
@@ -54,7 +50,8 @@ export default {
     nodeid: String,
     nodetext: String,
     nodewidth: Number,
-    nodeheight: Number
+    nodeheight: Number,
+    deleted: Boolean
   },
 
   data() {
diff --git a/app/src/store/index.js b/app/src/store/index.js
index b52e380..d2a0d61 100644
--- a/app/src/store/index.js
+++ b/app/src/store/index.js
@@ -98,6 +98,7 @@ const store = new Vuex.Store({
 
     SET_OTHER_NODES(state) {
       state.otherNodes = []
+
       var i
       var j
       for (i = 0; i < Object.keys(state.allNodes).length; i++) {
@@ -105,19 +106,22 @@ const store = new Vuex.Store({
           state.allNodes[i].id != state.myclient &&
           state.allNodes[i].id != state.global_pos_name &&
           state.allNodes[i].id != state.global_emoji_name &&
-          state.allNodes[i].id != state.global_con_name
+          state.allNodes[i].id != state.global_con_name //&&
+          //
         ) {
           for (
             j = 0;
             j < Object.keys(state.allNodes[i].doc.nodes).length;
             j++
           ) {
-            const newNode = {
-              node_id: state.allNodes[i].doc.nodes[j].node_id,
-              node_text: state.allNodes[i].doc.nodes[j].node_text
-            }
+            if (state.allNodes[i].doc.nodes[j].deleted != true) {
+              const newNode = {
+                node_id: state.allNodes[i].doc.nodes[j].node_id,
+                node_text: state.allNodes[i].doc.nodes[j].node_text
+              }
 
-            state.otherNodes.push(newNode)
+              state.otherNodes.push(newNode)
+            }
           }
         }
       }
@@ -133,7 +137,13 @@ const store = new Vuex.Store({
       pouchdb
         .get(state.myclient)
         .then(function(doc) {
-          state.myNodes = doc.nodes
+          var i
+          for (i = 0; i < Object.keys(doc.nodes).length; i++) {
+            if (doc.nodes[i].deleted == true) {
+              doc.nodes.splice(i, 1)
+            }
+            state.myNodes = doc.nodes
+          }
         })
         .catch(function(err) {
           if (err.status == 404) {
@@ -150,13 +160,13 @@ const store = new Vuex.Store({
               nodes: [
                 {
                   // FIXME: these values are here as GET_ALL_NODES cant hunt a blank
-                  // this shouldnt need to be here
+                  // this shouldnt need to be here though
 
                   node_id: uniqueid,
-                  node_text: 'Ignore this node' + state.myclient,
+                  node_text: 'Ignore this node ' + state.myclient,
                   node_owner: state.myclient,
                   content_type: 'sheet',
-                  // TEMP: this hides the first node card as its effectivly auto deleted
+                  // NOTE: first node is hidden due to no position
                   deleted: true,
                   attachment_name: ''
                 }
diff --git a/app/src/views/About.vue b/app/src/views/About.vue
index 291c5b5..3e70fd6 100644
--- a/app/src/views/About.vue
+++ b/app/src/views/About.vue
@@ -11,7 +11,10 @@
     </p>
     <p>
       Made by Adam Procter
-      <em>(+ helpers &amp; supporters)</em>
+      <em
+        >(+ many helpers &amp;
+        <a href="https://patreon.com/procterbot">supporters</a>)</em
+      >
     </p>
     <ul>
       <li>
@@ -27,21 +30,15 @@
       >
     </h3>
 
-    <h3>known issues</h3>
+    <h3>Considerations</h3>
     <ul>
       <li>&nbsp;Data is not yet encrypted.</li>
-      <li>&nbsp;Export is not turned on yet.</li>
-      <li>&nbsp;Delete only flags for deletion (aka it wont disappear yet).</li>
-
-      <li>
-        Some devices seem to have a bug when you first try to create or join an
-        microcosm, on second attempt it will work allowing device name.
-      </li>
+      <li>&nbsp;There is no Export yet.</li>
 
       <li>
-        Please consider all data as not backed up, data structures and data will
-        ocasssionaly be deleted or changed remotely which may effect and break
-        your local data.
+        Please <strong>UNDERSTAND</strong> all data as not backed up, data
+        structures and data will ocasssionaly be deleted or changed remotely
+        which may effect and break your local data.
       </li>
     </ul>
     <h2>Design-led ethical Edutech</h2>
-- 
GitLab