forked from jsnbuchanan/crowd-funder-for-time-pwa
Fix: added context for ContactGiftingView
This commit is contained in:
@@ -151,10 +151,28 @@
|
||||
:to="{
|
||||
name: 'contact-gift',
|
||||
query: {
|
||||
recipientProjectId: toProjectId,
|
||||
recipientProjectName: giver?.name,
|
||||
recipientProjectImage: giver?.image,
|
||||
recipientProjectHandleId: giver?.handleId,
|
||||
stepType: stepType,
|
||||
giverEntityType: giverEntityType,
|
||||
recipientEntityType: recipientEntityType,
|
||||
...(stepType === 'giver'
|
||||
? {
|
||||
recipientProjectId: toProjectId,
|
||||
recipientProjectName: receiver?.name,
|
||||
recipientProjectImage: receiver?.image,
|
||||
recipientProjectHandleId: receiver?.handleId,
|
||||
recipientDid: receiver?.did,
|
||||
}
|
||||
: {
|
||||
giverProjectId: fromProjectId,
|
||||
giverProjectName: giver?.name,
|
||||
giverProjectImage: giver?.image,
|
||||
giverProjectHandleId: giver?.handleId,
|
||||
giverDid: giver?.did,
|
||||
}),
|
||||
fromProjectId: fromProjectId,
|
||||
toProjectId: toProjectId,
|
||||
showProjects: (showProjects || false).toString(),
|
||||
isFromProjectView: (isFromProjectView || false).toString(),
|
||||
},
|
||||
}"
|
||||
>
|
||||
@@ -185,7 +203,10 @@
|
||||
<div class="grid grid-cols-2 gap-2 mb-4">
|
||||
<!-- Giver Button -->
|
||||
<button
|
||||
v-if="(giverEntityType === 'person' || giverEntityType === 'project') && !(isFromProjectView && giverEntityType === 'project')"
|
||||
v-if="
|
||||
(giverEntityType === 'person' || giverEntityType === 'project') &&
|
||||
!(isFromProjectView && giverEntityType === 'project')
|
||||
"
|
||||
class="flex-1 flex items-center gap-2 bg-slate-100 border border-slate-300 rounded-md p-2"
|
||||
@click="goBackToStep1('giver')"
|
||||
>
|
||||
@@ -283,36 +304,21 @@
|
||||
@click="goBackToStep1('recipient')"
|
||||
>
|
||||
<div>
|
||||
<template v-if="recipientEntityType === 'project'">
|
||||
<ProjectIcon
|
||||
v-if="receiver?.handleId"
|
||||
:entity-id="receiver.handleId"
|
||||
:icon-size="32"
|
||||
:image-url="receiver.image"
|
||||
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<EntityIcon
|
||||
v-if="receiver?.did"
|
||||
:contact="receiver"
|
||||
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
|
||||
/>
|
||||
<font-awesome
|
||||
v-else
|
||||
icon="circle-question"
|
||||
class="text-slate-400 text-3xl"
|
||||
/>
|
||||
</template>
|
||||
<EntityIcon
|
||||
v-if="receiver?.did"
|
||||
:contact="receiver"
|
||||
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
|
||||
/>
|
||||
<font-awesome
|
||||
v-else
|
||||
icon="circle-question"
|
||||
class="text-slate-400 text-3xl"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="text-start min-w-0">
|
||||
<p class="text-xs text-slate-500 leading-1 -mb-1 uppercase">
|
||||
{{
|
||||
recipientEntityType === "project"
|
||||
? "Given to project:"
|
||||
: "Given to:"
|
||||
}}
|
||||
Given to:
|
||||
</p>
|
||||
<h3 class="font-semibold truncate">
|
||||
{{ receiver?.name || "Unnamed" }}
|
||||
@@ -324,40 +330,22 @@
|
||||
</p>
|
||||
</button>
|
||||
<div
|
||||
v-else
|
||||
v-else-if="recipientEntityType === 'project'"
|
||||
class="flex-1 flex items-center gap-2 bg-slate-100 border border-slate-300 rounded-md p-2"
|
||||
>
|
||||
<div>
|
||||
<template v-if="recipientEntityType === 'project'">
|
||||
<ProjectIcon
|
||||
v-if="receiver?.handleId"
|
||||
:entity-id="receiver.handleId"
|
||||
:icon-size="32"
|
||||
:image-url="receiver.image"
|
||||
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<EntityIcon
|
||||
v-if="receiver?.did"
|
||||
:contact="receiver"
|
||||
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
|
||||
/>
|
||||
<font-awesome
|
||||
v-else
|
||||
icon="circle-question"
|
||||
class="text-slate-400 text-3xl"
|
||||
/>
|
||||
</template>
|
||||
<ProjectIcon
|
||||
v-if="receiver?.handleId"
|
||||
:entity-id="receiver.handleId"
|
||||
:icon-size="32"
|
||||
:image-url="receiver.image"
|
||||
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="text-start min-w-0">
|
||||
<p class="text-xs text-slate-500 leading-1 -mb-1 uppercase">
|
||||
{{
|
||||
recipientEntityType === "project"
|
||||
? "Given to project:"
|
||||
: "Given to:"
|
||||
}}
|
||||
Given to project:
|
||||
</p>
|
||||
<h3 class="font-semibold truncate">
|
||||
{{ receiver?.name || "Unnamed" }}
|
||||
@@ -491,17 +479,17 @@ export default class GiftedDialog extends Vue {
|
||||
@Prop({ default: false }) showProjects = false;
|
||||
@Prop() isFromProjectView = false;
|
||||
|
||||
@Watch('showProjects')
|
||||
@Watch("showProjects")
|
||||
onShowProjectsChange() {
|
||||
this.updateEntityTypes();
|
||||
}
|
||||
|
||||
@Watch('fromProjectId')
|
||||
@Watch("fromProjectId")
|
||||
onFromProjectIdChange() {
|
||||
this.updateEntityTypes();
|
||||
}
|
||||
|
||||
@Watch('toProjectId')
|
||||
@Watch("toProjectId")
|
||||
onToProjectIdChange() {
|
||||
this.updateEntityTypes();
|
||||
}
|
||||
@@ -531,8 +519,9 @@ export default class GiftedDialog extends Vue {
|
||||
|
||||
// Computed property to help debug template logic
|
||||
get shouldShowProjects() {
|
||||
const result = (this.stepType === 'giver' && this.giverEntityType === 'project') ||
|
||||
(this.stepType === 'recipient' && this.recipientEntityType === 'project');
|
||||
const result =
|
||||
(this.stepType === "giver" && this.giverEntityType === "project") ||
|
||||
(this.stepType === "recipient" && this.recipientEntityType === "project");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -544,7 +533,7 @@ export default class GiftedDialog extends Vue {
|
||||
// Reset and set entity types based on current context
|
||||
this.giverEntityType = "person";
|
||||
this.recipientEntityType = "person";
|
||||
|
||||
|
||||
// Determine entity types based on current context
|
||||
if (this.showProjects) {
|
||||
// HomeView "Project" button or ProjectViewView "Given by This"
|
||||
|
||||
Reference in New Issue
Block a user