Fix: handle special "You" entity

This commit is contained in:
Jose Olarte III
2025-07-07 17:16:59 +08:00
parent c28ddc0c5c
commit e1db9083c2
2 changed files with 44 additions and 7 deletions

View File

@@ -82,6 +82,7 @@ import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
mixins: [PlatformServiceMixin],
})
export default class GiftedDialog extends Vue {
$notify!: (notification: any, timeout?: number) => void;
notify!: ReturnType<typeof createNotifyHelpers>;
@Prop() fromProjectId = "";
@@ -564,11 +565,12 @@ export default class GiftedDialog extends Vue {
/**
* Handle entity selection from EntitySelectionStep
* @param entity - The selected entity (person or project) with stepType
* @param entity - The selected entity (person, project, or special) with stepType
*/
handleEntitySelected(entity: {
type: "person" | "project";
data: Contact | PlanData;
type: "person" | "project" | "special";
entityType?: string;
data: Contact | PlanData | { did?: string; name: string };
stepType: string;
}) {
if (entity.type === "person") {
@@ -578,13 +580,40 @@ export default class GiftedDialog extends Vue {
} else {
this.selectRecipient(contact);
}
} else {
} else if (entity.type === "project") {
const project = entity.data as PlanData;
if (entity.stepType === "giver") {
this.selectProject(project);
} else {
this.selectRecipientProject(project);
}
} else if (entity.type === "special") {
// Handle special entities like "You" and "Unnamed"
if (entity.entityType === "you") {
// "You" entity selected
const youEntity = {
did: this.activeDid,
name: "You",
};
if (entity.stepType === "giver") {
this.giver = youEntity;
} else {
this.receiver = youEntity;
}
this.firstStep = false;
} else if (entity.entityType === "unnamed") {
// "Unnamed" entity selected
const unnamedEntity = {
did: "",
name: "Unnamed",
};
if (entity.stepType === "giver") {
this.giver = unnamedEntity;
} else {
this.receiver = unnamedEntity;
}
this.firstStep = false;
}
}
}