Browse Source

fix problem where extended screen of contacts didn't pass project

starred-projects
Trent Larson 8 months ago
parent
commit
e1cffcda2d
  1. 1
      project.task.yaml
  2. 67
      src/views/ContactGiftingView.vue
  3. 4
      src/views/HomeView.vue
  4. 18
      src/views/ProjectViewView.vue

1
project.task.yaml

@ -2,7 +2,6 @@
tasks:
- Jason reported that turning notifications on from the help screen did not stay. iPhone
- check that 'show more contacts' from the contact-give-list on the project screen includes project ID
- supply the projectId to the OfferDialog just like we do with the offerId
- the confirm button on each give on the ProjectViewView page doesn't have all the context of the ClaimView page, so it can show sometimes inappropriately; consider consolidation

67
src/views/ContactGiftingView.vue

@ -20,12 +20,13 @@
<ul class="border-t border-slate-300">
<li class="border-b border-slate-300 py-3">
<h2 class="text-base flex gap-4 items-center">
<span class="grow italic text-slate-500">
<span class="grow">
<img
src="../assets/blank-square.svg"
class="mx-auto border border-slate-300 rounded-md mb-1"
width="32"
class="inline-block align-middle border border-slate-300 rounded-md mr-1"
/>
Anonymous
Anonymous/Unnamed
</span>
<span class="text-right">
<button
@ -44,12 +45,12 @@
class="border-b border-slate-300 py-3"
>
<h2 class="text-base flex gap-4 items-center">
<span class="grow font-semibold"
><EntityIcon
<span class="grow font-semibold">
<EntityIcon
:entityId="contact.did"
:iconSize="32"
class="inline-block align-middle border border-slate-300 rounded-md mr-1"
></EntityIcon>
/>
{{ contact.name || "(no name)" }}
</span>
<span class="text-right">
@ -68,7 +69,7 @@
<GiftedDialog
ref="customDialog"
message="Received from"
showGivenToUser="true"
:projectId="projectId"
/>
</section>
</template>
@ -104,12 +105,40 @@ export default class ContactGiftingView extends Vue {
apiServer = "";
accounts: typeof AccountsSchema;
numAccounts = 0;
projectId = localStorage.getItem("projectId") || "";
async beforeCreate() {
accountsDB.open();
this.numAccounts = await accountsDB.accounts.count();
}
async created() {
try {
await db.open();
const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings;
this.apiServer = settings?.apiServer || "";
this.activeDid = settings?.activeDid || "";
this.allContacts = await db.contacts.toArray();
localStorage.removeItem("projectId");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
console.log("Error retrieving settings & contacts:", err);
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text:
err.message ||
"There was an error retrieving your settings and/or contacts.",
},
-1,
);
}
}
public async getIdentity(activeDid: string) {
await accountsDB.open();
const account = (await accountsDB.accounts
@ -135,30 +164,6 @@ export default class ContactGiftingView extends Vue {
return headers;
}
async created() {
try {
await db.open();
const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings;
this.apiServer = settings?.apiServer || "";
this.activeDid = settings?.activeDid || "";
this.allContacts = await db.contacts.toArray();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
console.log("Error retrieving settings & contacts:", err);
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text:
err.message ||
"There was an error retrieving your settings and/or contacts.",
},
-1,
);
}
}
openDialog(giver: GiverInputInfo) {
(this.$refs.customDialog as GiftedDialog).open(giver);
}

4
src/views/HomeView.vue

@ -119,7 +119,7 @@
</h3>
</li>
<li
v-for="contact in allContacts"
v-for="contact in allContacts.slice(0, 7)"
:key="contact.did"
@click="openDialog(contact)"
>
@ -127,7 +127,7 @@
:entityId="contact.did"
:iconSize="64"
class="mx-auto border border-slate-300 rounded-md mb-1"
></EntityIcon>
/>
<h3
class="text-xs font-medium text-ellipsis whitespace-nowrap overflow-hidden"
>

18
src/views/ProjectViewView.vue

@ -154,7 +154,7 @@
</h3>
</li>
<li
v-for="contact in allContacts"
v-for="contact in allContacts.slice(0, 7)"
:key="contact.did"
@click="openGiftDialog(contact)"
>
@ -162,7 +162,7 @@
:entityId="contact.did"
:iconSize="64"
class="mx-auto border border-slate-300 rounded-md mb-1"
></EntityIcon>
/>
<h3
class="text-xs font-medium text-ellipsis whitespace-nowrap overflow-hidden"
>
@ -172,13 +172,13 @@
</ul>
<!-- Ideally, this button should only be visible when the active account has more than 7 or 11 contacts in their list (we want to limit the grid count above to 8 or 12 accounts to keep it compact) -->
<router-link
<a
v-if="allContacts.length >= 7"
:to="{ name: 'contact-gives' }"
@click="onClickAllContactsGifting()"
class="block text-center text-md font-bold uppercase bg-slate-500 text-white px-2 py-3 rounded-md"
>
Show More Contacts&hellip;
</router-link>
</a>
</div>
<!-- Gifts to & from this -->
@ -709,6 +709,14 @@ export default class ProjectViewView extends Vue {
(this.$refs.customOfferDialog as OfferDialog).open();
}
onClickAllContactsGifting() {
localStorage.setItem("projectId", this.projectId);
const route = {
name: "contact-gives",
};
this.$router.push(route);
}
onClickLoadClaim(jwtId: string) {
const route = {
path: "/claim/" + encodeURIComponent(jwtId),

Loading…
Cancel
Save