Browse Source

Fix: stepType was being set to an object

pull/142/head
Jose Olarte III 1 day ago
parent
commit
fe0d80eef9
  1. 16
      src/components/EntitySelectionStep.vue
  2. 13
      src/components/GiftedDialog.vue
  3. 12
      src/types/global.d.ts

16
src/components/EntitySelectionStep.vue

@ -144,12 +144,15 @@ export default class EntitySelectionStep extends Vue {
get stepLabel(): string { get stepLabel(): string {
if (this.stepType === "recipient") { if (this.stepType === "recipient") {
return "Choose who received the gift:"; return "Choose who received the gift:";
} else if (this.showProjects) { } else if (this.stepType === "giver") {
if (this.shouldShowProjects) {
return "Choose a project benefitted from:"; return "Choose a project benefitted from:";
} else { } else {
return "Choose a person received from:"; return "Choose a person received from:";
} }
} }
return "Choose entity:";
}
/** /**
* Computed conflict context for better error messages * Computed conflict context for better error messages
@ -166,10 +169,13 @@ export default class EntitySelectionStep extends Vue {
* Whether to show projects in the grid * Whether to show projects in the grid
*/ */
get shouldShowProjects(): boolean { get shouldShowProjects(): boolean {
return ( // When editing an entity, show the appropriate entity type for that entity
(this.stepType === "giver" && this.giverEntityType === "project") || if (this.stepType === "giver") {
(this.stepType === "recipient" && this.recipientEntityType === "project") return this.giverEntityType === "project";
); } else if (this.stepType === "recipient") {
return this.recipientEntityType === "project";
}
return false;
} }
/** /**

13
src/components/GiftedDialog.vue

@ -564,22 +564,23 @@ export default class GiftedDialog extends Vue {
/** /**
* Handle entity selection from EntitySelectionStep * 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: { handleEntitySelected(entity: {
type: "person" | "project"; type: "person" | "project";
data: Contact | PlanData; data: Contact | PlanData;
stepType: string;
}) { }) {
if (entity.type === "person") { if (entity.type === "person") {
const contact = entity.data as Contact; const contact = entity.data as Contact;
if (this.stepType === "giver") { if (entity.stepType === "giver") {
this.selectGiver(contact); this.selectGiver(contact);
} else { } else {
this.selectRecipient(contact); this.selectRecipient(contact);
} }
} else { } else {
const project = entity.data as PlanData; const project = entity.data as PlanData;
if (this.stepType === "giver") { if (entity.stepType === "giver") {
this.selectProject(project); this.selectProject(project);
} else { } else {
this.selectRecipientProject(project); this.selectRecipientProject(project);
@ -589,10 +590,10 @@ export default class GiftedDialog extends Vue {
/** /**
* Handle edit entity request from GiftDetailsStep * Handle edit entity request from GiftDetailsStep
* @param entityType - 'giver' or 'recipient' * @param data - Object containing entityType and currentEntity
*/ */
handleEditEntity(entityType: "giver" | "recipient") { handleEditEntity(data: { entityType: string; currentEntity: any }) {
this.goBackToStep1(entityType); this.goBackToStep1(data.entityType);
} }
/** /**

12
src/types/global.d.ts

@ -67,3 +67,15 @@ declare global {
electronAPI: ElectronAPI; 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;
}
}
Loading…
Cancel
Save