Added: current user in ContactGiftingView
- "You" is displayed conditionally, similar to GiftedDialog behavior - "Show All" is hidden in GiftedDialog when accessed from ContactGiftingView (redundant)
This commit is contained in:
@@ -159,6 +159,10 @@ export default class EntityGrid extends Vue {
|
|||||||
@Prop({ default: "other party" })
|
@Prop({ default: "other party" })
|
||||||
conflictContext!: string;
|
conflictContext!: string;
|
||||||
|
|
||||||
|
/** Whether to hide the "Show All" navigation */
|
||||||
|
@Prop({ default: false })
|
||||||
|
hideShowAll!: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to determine which entities to display (allows parent control)
|
* Function to determine which entities to display (allows parent control)
|
||||||
*
|
*
|
||||||
@@ -245,7 +249,9 @@ export default class EntityGrid extends Vue {
|
|||||||
* Whether to show the "Show All" navigation
|
* Whether to show the "Show All" navigation
|
||||||
*/
|
*/
|
||||||
get shouldShowAll(): boolean {
|
get shouldShowAll(): boolean {
|
||||||
return this.entities.length > 0 && this.showAllRoute !== "";
|
return (
|
||||||
|
!this.hideShowAll && this.entities.length > 0 && this.showAllRoute !== ""
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ Matthew Raymer */
|
|||||||
:show-all-query-params="showAllQueryParams"
|
:show-all-query-params="showAllQueryParams"
|
||||||
:notify="notify"
|
:notify="notify"
|
||||||
:conflict-context="conflictContext"
|
:conflict-context="conflictContext"
|
||||||
|
:hide-show-all="hideShowAll"
|
||||||
@entity-selected="handleEntitySelected"
|
@entity-selected="handleEntitySelected"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -140,6 +141,10 @@ export default class EntitySelectionStep extends Vue {
|
|||||||
@Prop()
|
@Prop()
|
||||||
notify?: (notification: NotificationIface, timeout?: number) => void;
|
notify?: (notification: NotificationIface, timeout?: number) => void;
|
||||||
|
|
||||||
|
/** Whether to hide the "Show All" navigation */
|
||||||
|
@Prop({ default: false })
|
||||||
|
hideShowAll!: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CSS classes for the cancel button
|
* CSS classes for the cancel button
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
:giver="giver"
|
:giver="giver"
|
||||||
:receiver="receiver"
|
:receiver="receiver"
|
||||||
:notify="$notify"
|
:notify="$notify"
|
||||||
|
:hide-show-all="hideShowAll"
|
||||||
@entity-selected="handleEntitySelected"
|
@entity-selected="handleEntitySelected"
|
||||||
@cancel="cancel"
|
@cancel="cancel"
|
||||||
/>
|
/>
|
||||||
@@ -99,6 +100,7 @@ export default class GiftedDialog extends Vue {
|
|||||||
@Prop() toProjectId = "";
|
@Prop() toProjectId = "";
|
||||||
@Prop({ default: false }) showProjects = false;
|
@Prop({ default: false }) showProjects = false;
|
||||||
@Prop() isFromProjectView = false;
|
@Prop() isFromProjectView = false;
|
||||||
|
@Prop({ default: false }) hideShowAll = false;
|
||||||
|
|
||||||
@Watch("showProjects")
|
@Watch("showProjects")
|
||||||
onShowProjectsChange() {
|
onShowProjectsChange() {
|
||||||
|
|||||||
@@ -17,6 +17,24 @@
|
|||||||
|
|
||||||
<!-- Results List -->
|
<!-- Results List -->
|
||||||
<ul class="border-t border-slate-300">
|
<ul class="border-t border-slate-300">
|
||||||
|
<!-- "You" entity -->
|
||||||
|
<li v-if="shouldShowYouEntity" class="border-b border-slate-300 py-3">
|
||||||
|
<h2 class="text-base flex gap-4 items-center">
|
||||||
|
<span class="grow flex gap-2 items-center font-medium">
|
||||||
|
<font-awesome icon="hand" class="text-blue-500 text-4xl" />
|
||||||
|
<span class="text-blue-500">You</span>
|
||||||
|
</span>
|
||||||
|
<span class="text-right">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="block w-full text-center text-sm uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-3 py-1.5 rounded-md"
|
||||||
|
@click="openDialog('You')"
|
||||||
|
>
|
||||||
|
<font-awesome icon="gift" class="fa-fw"></font-awesome>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</h2>
|
||||||
|
</li>
|
||||||
<li class="border-b border-slate-300 py-3">
|
<li class="border-b border-slate-300 py-3">
|
||||||
<h2 class="text-base flex gap-4 items-center">
|
<h2 class="text-base flex gap-4 items-center">
|
||||||
<span class="grow flex gap-2 items-center font-medium">
|
<span class="grow flex gap-2 items-center font-medium">
|
||||||
@@ -71,6 +89,7 @@
|
|||||||
:to-project-id="toProjectId"
|
:to-project-id="toProjectId"
|
||||||
:show-projects="showProjects"
|
:show-projects="showProjects"
|
||||||
:is-from-project-view="isFromProjectView"
|
:is-from-project-view="isFromProjectView"
|
||||||
|
:hide-show-all="true"
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -180,7 +199,7 @@ export default class ContactGiftingView extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openDialog(contact?: GiverReceiverInputInfo | "Unnamed") {
|
openDialog(contact?: GiverReceiverInputInfo | "Unnamed" | "You") {
|
||||||
if (contact === "Unnamed") {
|
if (contact === "Unnamed") {
|
||||||
// Special case: Pass undefined to trigger Step 1, but with "Unnamed" pre-selected
|
// Special case: Pass undefined to trigger Step 1, but with "Unnamed" pre-selected
|
||||||
let recipient: GiverReceiverInputInfo;
|
let recipient: GiverReceiverInputInfo;
|
||||||
@@ -230,6 +249,55 @@ export default class ContactGiftingView extends Vue {
|
|||||||
);
|
);
|
||||||
// Immediately select "Unnamed" and move to Step 2
|
// Immediately select "Unnamed" and move to Step 2
|
||||||
(this.$refs.customDialog as GiftedDialog).selectGiver();
|
(this.$refs.customDialog as GiftedDialog).selectGiver();
|
||||||
|
} else if (contact === "You") {
|
||||||
|
// Special case: Handle "You" entity selection
|
||||||
|
let giver: GiverReceiverInputInfo;
|
||||||
|
let recipient: GiverReceiverInputInfo;
|
||||||
|
|
||||||
|
if (this.stepType === "giver") {
|
||||||
|
// We're selecting a giver, so "You" becomes the giver
|
||||||
|
giver = { did: this.activeDid, name: "You" };
|
||||||
|
|
||||||
|
// Recipient is either a project or the current user
|
||||||
|
if (this.recipientEntityType === "project") {
|
||||||
|
recipient = {
|
||||||
|
did: this.recipientProjectHandleId,
|
||||||
|
name: this.recipientProjectName,
|
||||||
|
image: this.recipientProjectImage,
|
||||||
|
handleId: this.recipientProjectHandleId,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
recipient = { did: this.activeDid, name: "You" };
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// We're selecting a recipient, so "You" becomes the recipient
|
||||||
|
recipient = { did: this.activeDid, name: "You" };
|
||||||
|
|
||||||
|
// Preserve the existing giver from the context
|
||||||
|
if (this.giverEntityType === "project") {
|
||||||
|
giver = {
|
||||||
|
did: this.giverProjectHandleId,
|
||||||
|
name: this.giverProjectName,
|
||||||
|
image: this.giverProjectImage,
|
||||||
|
handleId: this.giverProjectHandleId,
|
||||||
|
};
|
||||||
|
} else if (this.giverDid) {
|
||||||
|
giver = {
|
||||||
|
did: this.giverDid,
|
||||||
|
name: this.giverProjectName || "Someone",
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
giver = { did: this.activeDid, name: "You" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
(this.$refs.customDialog as GiftedDialog).open(
|
||||||
|
giver,
|
||||||
|
recipient,
|
||||||
|
undefined,
|
||||||
|
this.stepType === "giver" ? "Given by You" : "Given to You",
|
||||||
|
this.prompt,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// Regular case: contact is a GiverReceiverInputInfo
|
// Regular case: contact is a GiverReceiverInputInfo
|
||||||
let giver: GiverReceiverInputInfo;
|
let giver: GiverReceiverInputInfo;
|
||||||
@@ -283,5 +351,12 @@ export default class ContactGiftingView extends Vue {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get shouldShowYouEntity(): boolean {
|
||||||
|
return (
|
||||||
|
this.stepType === "recipient" ||
|
||||||
|
(this.stepType === "giver" && this.isFromProjectView)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user