Browse Source

Added check for "Unnamed" giver

Pass string "Unnamed" to select unnamed giver and skip contact selection step of dialog.
gifting-ui-2025-05
Jose Olarte III 3 weeks ago
parent
commit
988244b7ae
  1. 5
      src/components/GiftedDialog.vue
  2. 32
      src/views/ContactGiftingView.vue
  3. 38
      src/views/HomeView.vue
  4. 26
      src/views/ProjectViewView.vue

5
src/components/GiftedDialog.vue

@ -9,7 +9,10 @@
<ul <ul
class="grid grid-cols-4 sm:grid-cols-5 md:grid-cols-6 gap-x-2 gap-y-4 text-center mb-4" class="grid grid-cols-4 sm:grid-cols-5 md:grid-cols-6 gap-x-2 gap-y-4 text-center mb-4"
> >
<li @click="selectGiver()"> <li
@click="selectGiver()"
class="cursor-pointer"
>
<font-awesome icon="circle-question" class="text-slate-400 text-5xl mb-1" /> <font-awesome icon="circle-question" class="text-slate-400 text-5xl mb-1" />
<h3 <h3
class="text-xs text-slate-500 font-medium italic text-ellipsis whitespace-nowrap overflow-hidden" class="text-xs text-slate-500 font-medium italic text-ellipsis whitespace-nowrap overflow-hidden"

32
src/views/ContactGiftingView.vue

@ -31,7 +31,7 @@
<button <button
type="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" 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()" @click="openDialog('Unnamed')"
> >
<font-awesome icon="gift" class="fa-fw"></font-awesome> <font-awesome icon="gift" class="fa-fw"></font-awesome>
</button> </button>
@ -129,17 +129,31 @@ export default class ContactGiftingView extends Vue {
} }
} }
openDialog(giver?: GiverReceiverInputInfo) { openDialog(giver?: GiverReceiverInputInfo | "Unnamed") {
const recipient = this.projectId const recipient = this.projectId
? undefined ? undefined
: { did: this.activeDid, name: "you" }; : { did: this.activeDid, name: "you" };
(this.$refs.customDialog as GiftedDialog).open(
giver, if (giver === "Unnamed") {
recipient, // Special case: Pass undefined to trigger Step 1, but with "Unnamed" pre-selected
undefined, (this.$refs.customDialog as GiftedDialog).open(
"Given by " + (giver?.name || "someone not named"), undefined,
this.prompt, recipient,
); undefined,
"Given by Unnamed",
this.prompt,
);
// Immediately select "Unnamed" and move to Step 2
(this.$refs.customDialog as GiftedDialog).selectGiver();
} else {
(this.$refs.customDialog as GiftedDialog).open(
giver,
recipient,
undefined,
"Given by " + (giver?.name || "someone not named"),
this.prompt,
);
}
} }
} }
</script> </script>

38
src/views/HomeView.vue

@ -1412,17 +1412,33 @@ export default class HomeView extends Vue {
* @param giver Optional contact info for giver * @param giver Optional contact info for giver
* @param description Optional gift description * @param description Optional gift description
*/ */
openDialog(giver?: GiverReceiverInputInfo, description?: string) { openDialog(giver?: GiverReceiverInputInfo | "Unnamed", description?: string) {
(this.$refs.customDialog as GiftedDialog).open( if (giver === "Unnamed") {
giver, // Special case: Pass undefined to trigger Step 1, but with "Unnamed" pre-selected
{ (this.$refs.customDialog as GiftedDialog).open(
did: this.activeDid, undefined,
name: "you", {
} as GiverReceiverInputInfo, did: this.activeDid,
undefined, name: "you",
"Given by " + (giver?.name || "someone not named"), } as GiverReceiverInputInfo,
description, undefined,
); "Given by Unnamed",
description,
);
// Immediately select "Unnamed" and move to Step 2
(this.$refs.customDialog as GiftedDialog).selectGiver();
} else {
(this.$refs.customDialog as GiftedDialog).open(
giver,
{
did: this.activeDid,
name: "you",
} as GiverReceiverInputInfo,
undefined,
"Given by " + (giver?.name || "someone not named"),
description,
);
}
} }
/** /**

26
src/views/ProjectViewView.vue

@ -1216,13 +1216,25 @@ export default class ProjectViewView extends Vue {
); );
} }
openGiftDialogToProject(contact?: libsUtil.GiverReceiverInputInfo) { openGiftDialogToProject(contact?: libsUtil.GiverReceiverInputInfo | "Unnamed") {
(this.$refs.giveDialogToThis as GiftedDialog).open( if (contact === "Unnamed") {
contact, // Special case: Pass undefined to trigger Step 1, but with "Unnamed" pre-selected
undefined, (this.$refs.giveDialogToThis as GiftedDialog).open(
undefined, undefined,
(contact?.name || "Someone not named") + ` gave to this project`, undefined,
); undefined,
"Given by Unnamed to this project",
);
// Immediately select "Unnamed" and move to Step 2
(this.$refs.giveDialogToThis as GiftedDialog).selectGiver();
} else {
(this.$refs.giveDialogToThis as GiftedDialog).open(
contact,
undefined,
undefined,
(contact?.name || "Someone not named") + ` gave to this project`,
);
}
} }
openGiftDialogFromProject() { openGiftDialogFromProject() {

Loading…
Cancel
Save