Browse Source

fix didInfo logic, and add to project lists

pull/49/head
Trent Larson 1 year ago
parent
commit
4866416aae
  1. 11
      src/libs/endorserServer.ts
  2. 8
      src/views/DiscoverView.vue
  3. 12
      src/views/ProjectViewView.vue

11
src/libs/endorserServer.ts

@ -82,10 +82,15 @@ export function isHiddenDid(did) {
/** /**
always returns text, maybe UNNAMED_VISIBLE or UNKNOWN_ENTITY always returns text, maybe UNNAMED_VISIBLE or UNKNOWN_ENTITY
**/ **/
export function didInfo(did, activeDid, allMyDids, contacts) { export function didInfo(
const myId: string | undefined = R.find(R.identity, allMyDids); did: string,
activeDid: string,
allMyDids: Array<string>,
contacts: Array<Contact>,
): string {
const myId: string | undefined = R.find(R.equals(did), allMyDids, did);
if (myId) { if (myId) {
return "You" + (myId.did !== activeDid ? " (Alt ID)" : ""); return "You" + (myId !== activeDid ? " (Alt ID)" : "");
} else { } else {
const contact: Contact | undefined = R.find((c) => c.did === did, contacts); const contact: Contact | undefined = R.find((c) => c.did === did, contacts);
if (contact) { if (contact) {

8
src/views/DiscoverView.vue

@ -93,7 +93,9 @@
<h2 class="text-base font-semibold">{{ project.name }}</h2> <h2 class="text-base font-semibold">{{ project.name }}</h2>
<div class="text-sm"> <div class="text-sm">
<fa icon="user" class="fa-fw text-slate-400"></fa> <fa icon="user" class="fa-fw text-slate-400"></fa>
{{ didInfo(project.issuer, activeDid, allMyDids, allContacts) }} {{
didInfo(project.issuerDid, activeDid, allMyDids, allContacts)
}}
</div> </div>
</div> </div>
</a> </a>
@ -206,8 +208,8 @@ export default class DiscoverView extends Vue {
const plans: ProjectData[] = results.data; const plans: ProjectData[] = results.data;
if (plans) { if (plans) {
for (const plan of plans) { for (const plan of plans) {
const { name, description, handleId = plan.handleId, rowid } = plan; const { name, description, handleId, rowid, issuerDid } = plan;
this.projects.push({ name, description, handleId, rowid }); this.projects.push({ name, description, handleId, rowid, issuerDid });
} }
this.remoteCount = this.projects.length; this.remoteCount = this.projects.length;
} else { } else {

12
src/views/ProjectViewView.vue

@ -108,7 +108,11 @@
}}</span> }}</span>
</div> </div>
<div class="flex gap-2" v-if="give.amount"> <div class="flex gap-2" v-if="give.amount">
<fa icon="clock" v-if="give.unit === 'HUR'" class="fa-fw text-slate-400"></fa> <fa
icon="clock"
v-if="give.unit === 'HUR'"
class="fa-fw text-slate-400"
></fa>
<fa icon="coins" v-else class="fa-fw text-slate-400"></fa> <fa icon="coins" v-else class="fa-fw text-slate-400"></fa>
<span>{{ give.amount }}</span> <span>{{ give.amount }}</span>
</div> </div>
@ -131,7 +135,11 @@
}}</span> }}</span>
</div> </div>
<div class="flex gap-2" v-if="give.amount"> <div class="flex gap-2" v-if="give.amount">
<fa icon="clock" v-if="give.unit === 'HUR'" class="fa-fw text-slate-400"></fa> <fa
icon="clock"
v-if="give.unit === 'HUR'"
class="fa-fw text-slate-400"
></fa>
<fa icon="coins" v-else class="fa-fw text-slate-400"></fa> <fa icon="coins" v-else class="fa-fw text-slate-400"></fa>
<span>{{ give.amount }}</span> <span>{{ give.amount }}</span>
</div> </div>

Loading…
Cancel
Save