From 9317b59231ec155c883da2b45f12e792e3e3688c Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Fri, 24 Mar 2023 22:04:53 -0600 Subject: [PATCH] feat: add a page for details about contact transactions (which I'll fill in soon) --- src/router/index.ts | 34 +++++++------- src/views/CommitmentsView.vue | 3 -- src/views/ContactAmountsView.vue | 70 ++++++++++++++++++++++++++++ src/views/ContactsView.vue | 80 +++++++++++++++++++++----------- 4 files changed, 140 insertions(+), 47 deletions(-) delete mode 100644 src/views/CommitmentsView.vue create mode 100644 src/views/ContactAmountsView.vue diff --git a/src/router/index.ts b/src/router/index.ts index bc4b683..f9f5f82 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -23,12 +23,6 @@ const routes: Array = [ component: () => import(/* webpackChunkName: "about" */ "../views/AboutView.vue"), }, - { - path: "/start", - name: "start", - component: () => - import(/* webpackChunkName: "start" */ "../views/StartView.vue"), - }, { path: "/account", name: "account", @@ -43,6 +37,14 @@ const routes: Array = [ /* webpackChunkName: "confirm-contact" */ "../views/ConfirmContactView.vue" ), }, + { + path: "/contact-amounts", + name: "contact-amounts", + component: () => + import( + /* webpackChunkName: "contact-amounts" */ "../views/ContactAmountsView.vue" + ), + }, { path: "/contacts", name: "contacts", @@ -93,12 +95,6 @@ const routes: Array = [ /* webpackChunkName: "new-edit-commitment" */ "../views/NewEditCommitmentView.vue" ), }, - { - path: "/project", - name: "project", - component: () => - import(/* webpackChunkName: "project" */ "../views/ProjectViewView.vue"), - }, { path: "/new-edit-project", name: "new-edit-project", @@ -107,6 +103,12 @@ const routes: Array = [ /* webpackChunkName: "new-edit-project" */ "../views/NewEditProjectView.vue" ), }, + { + path: "/project", + name: "project", + component: () => + import(/* webpackChunkName: "project" */ "../views/ProjectViewView.vue"), + }, { path: "/projects", name: "projects", @@ -114,12 +116,10 @@ const routes: Array = [ import(/* webpackChunkName: "projects" */ "../views/ProjectsView.vue"), }, { - path: "/commitments", - name: "commitments", + path: "/start", + name: "start", component: () => - import( - /* webpackChunkName: "commitments" */ "../views/CommitmentsView.vue" - ), + import(/* webpackChunkName: "start" */ "../views/StartView.vue"), }, ]; diff --git a/src/views/CommitmentsView.vue b/src/views/CommitmentsView.vue deleted file mode 100644 index afa8167..0000000 --- a/src/views/CommitmentsView.vue +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/src/views/ContactAmountsView.vue b/src/views/ContactAmountsView.vue new file mode 100644 index 0000000..9ee06fb --- /dev/null +++ b/src/views/ContactAmountsView.vue @@ -0,0 +1,70 @@ + + + diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index d02d793..80ecc90 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -661,35 +661,61 @@ export default class ContactsView extends Vue { this.alertMessage = "No identity is available."; this.isAlertVisible = true; } else { - let toFrom; - if (fromDid == this.identity?.did) { - toFrom = "from you to " + this.nameForDid(this.contacts, toDid); - } else { - toFrom = "from " + this.nameForDid(this.contacts, fromDid) + " to you"; - } - let description; - if (this.hourDescriptionInput) { - description = " with description '" + this.hourDescriptionInput + "'"; - } else { - description = " with no description"; - } + // if they have unconfirmed amounts, ask to confirm those first + let wantsToConfirm = false; if ( - confirm( - "Are you sure you want to record " + - this.hourInput + - " hours " + - toFrom + - description + - "?" - ) + toDid == this.identity?.did && + this.givenToMeUnconfirmed[fromDid] > 0 ) { - this.createAndSubmitGive( - this.identity, - fromDid, - toDid, - parseFloat(this.hourInput), - this.hourDescriptionInput - ); + if ( + confirm( + "There are " + + this.givenToMeUnconfirmed[fromDid] + + " unconfirmed hours from them." + + " Would you like to confirm some of those hours?" + ) + ) { + wantsToConfirm = true; + } + } + if (wantsToConfirm) { + this.$router.push({ + name: "contact-amounts", + query: { contactDid: fromDid }, + }); + } else { + // ask to confirm amount + let toFrom; + if (fromDid == this.identity?.did) { + toFrom = "from you to " + this.nameForDid(this.contacts, toDid); + } else { + toFrom = + "from " + this.nameForDid(this.contacts, fromDid) + " to you"; + } + let description; + if (this.hourDescriptionInput) { + description = " with description '" + this.hourDescriptionInput + "'"; + } else { + description = " with no description"; + } + if ( + confirm( + "Are you sure you want to record " + + this.hourInput + + " hours " + + toFrom + + description + + "?" + ) + ) { + this.createAndSubmitGive( + this.identity, + fromDid, + toDid, + parseFloat(this.hourInput), + this.hourDescriptionInput + ); + } } } }