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

This commit is contained in:
2024-01-17 20:18:01 -07:00
parent a5b1b97012
commit e1cffcda2d
4 changed files with 51 additions and 39 deletions

View File

@@ -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);
}

View File

@@ -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"
>

View File

@@ -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),