From fe0d80eef9606bc7cbee658405294c8bd53017ce Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Mon, 7 Jul 2025 16:20:11 +0800 Subject: [PATCH] Fix: stepType was being set to an object --- src/components/EntitySelectionStep.vue | 22 ++++++++++++++-------- src/components/GiftedDialog.vue | 13 +++++++------ src/types/global.d.ts | 12 ++++++++++++ 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/components/EntitySelectionStep.vue b/src/components/EntitySelectionStep.vue index 3c415ce2..802cbab7 100644 --- a/src/components/EntitySelectionStep.vue +++ b/src/components/EntitySelectionStep.vue @@ -144,11 +144,14 @@ export default class EntitySelectionStep extends Vue { get stepLabel(): string { if (this.stepType === "recipient") { return "Choose who received the gift:"; - } else if (this.showProjects) { - return "Choose a project benefitted from:"; - } else { - return "Choose a person received from:"; + } else if (this.stepType === "giver") { + if (this.shouldShowProjects) { + return "Choose a project benefitted from:"; + } else { + return "Choose a person received from:"; + } } + return "Choose entity:"; } /** @@ -166,10 +169,13 @@ export default class EntitySelectionStep extends Vue { * Whether to show projects in the grid */ get shouldShowProjects(): boolean { - return ( - (this.stepType === "giver" && this.giverEntityType === "project") || - (this.stepType === "recipient" && this.recipientEntityType === "project") - ); + // When editing an entity, show the appropriate entity type for that entity + if (this.stepType === "giver") { + return this.giverEntityType === "project"; + } else if (this.stepType === "recipient") { + return this.recipientEntityType === "project"; + } + return false; } /** diff --git a/src/components/GiftedDialog.vue b/src/components/GiftedDialog.vue index ce40605b..fd66c2fa 100644 --- a/src/components/GiftedDialog.vue +++ b/src/components/GiftedDialog.vue @@ -564,22 +564,23 @@ export default class GiftedDialog extends Vue { /** * Handle entity selection from EntitySelectionStep - * @param entity - The selected entity (person or project) + * @param entity - The selected entity (person or project) with stepType */ handleEntitySelected(entity: { type: "person" | "project"; data: Contact | PlanData; + stepType: string; }) { if (entity.type === "person") { const contact = entity.data as Contact; - if (this.stepType === "giver") { + if (entity.stepType === "giver") { this.selectGiver(contact); } else { this.selectRecipient(contact); } } else { const project = entity.data as PlanData; - if (this.stepType === "giver") { + if (entity.stepType === "giver") { this.selectProject(project); } else { this.selectRecipientProject(project); @@ -589,10 +590,10 @@ export default class GiftedDialog extends Vue { /** * Handle edit entity request from GiftDetailsStep - * @param entityType - 'giver' or 'recipient' + * @param data - Object containing entityType and currentEntity */ - handleEditEntity(entityType: "giver" | "recipient") { - this.goBackToStep1(entityType); + handleEditEntity(data: { entityType: string; currentEntity: any }) { + this.goBackToStep1(data.entityType); } /** diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 2cf5bc81..bc353374 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -66,4 +66,16 @@ declare global { interface Window { electronAPI: ElectronAPI; } +} + +/** + * Vue instance interface extension for global properties. + * + * This makes global properties available on Vue instances + * in TypeScript without type errors. + */ +declare module 'vue' { + interface ComponentCustomProperties { + $notify: (notification: any, timeout?: number) => void; + } } \ No newline at end of file