Browse Source

Fix: stepType was being set to an object

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

22
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;
}
/**

13
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);
}
/**

12
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;
}
}
Loading…
Cancel
Save