Browse Source

Fix: handle special "You" entity

pull/142/head
Jose Olarte III 12 hours ago
parent
commit
2917f87137
  1. 14
      src/components/EntitySummaryButton.vue
  2. 37
      src/components/GiftedDialog.vue

14
src/components/EntitySummaryButton.vue

@ -11,17 +11,18 @@ details step with edit functionality. * * @author Matthew Raymer */
<div>
<template v-if="entityType === 'project'">
<ProjectIcon
v-if="entity?.handleId"
v-if="entity && 'handleId' in entity && entity.handleId"
:entity-id="entity.handleId"
:icon-size="32"
:image-url="entity.image"
:image-url="'image' in entity ? entity.image : ''"
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
/>
</template>
<template v-else>
<EntityIcon
v-if="entity?.did"
:contact="entity"
:entity-id="entity.did"
:contact="isContactEntity ? entity : undefined"
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
/>
<font-awesome
@ -101,6 +102,13 @@ export default class EntitySummaryButton extends Vue {
@Prop({ default: true })
editable!: boolean;
/**
* Whether the entity is a Contact object
*/
get isContactEntity(): boolean {
return this.entity !== null && "profileImageUrl" in this.entity;
}
/**
* Computed CSS classes for the edit/lock icon
*/

37
src/components/GiftedDialog.vue

@ -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;
}
}
}

Loading…
Cancel
Save