From e1b312a402e6529af0ce6c6b97c3c3899545308f Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Tue, 20 Jan 2026 20:14:48 -0700 Subject: [PATCH] refactor: consolidate data checks & remove unused items --- src/components/EntitySelectionStep.vue | 33 +------------------------- src/components/EntitySummaryButton.vue | 11 +-------- src/components/GiftDetailsStep.vue | 29 +++++++--------------- src/components/GiftedDialog.vue | 8 ------- src/interfaces/common.ts | 10 ++++++++ src/views/GiftedDetailsView.vue | 12 ---------- 6 files changed, 21 insertions(+), 82 deletions(-) diff --git a/src/components/EntitySelectionStep.vue b/src/components/EntitySelectionStep.vue index c10ee69bf0..6a38de05fc 100644 --- a/src/components/EntitySelectionStep.vue +++ b/src/components/EntitySelectionStep.vue @@ -45,16 +45,7 @@ import EntityGrid from "./EntityGrid.vue"; import { Contact } from "../db/tables/contacts"; import { PlanData } from "../interfaces/records"; import { NotificationIface } from "../constants/app"; - -/** - * Entity data interface for giver/receiver - */ -interface EntityData { - did?: string; - handleId?: string; - name?: string; - image?: string; -} +import { EntityData } from "@/interfaces"; /** * Entity selection event data structure @@ -103,14 +94,6 @@ export default class EntitySelectionStep extends Vue { @Prop({ required: true }) conflictChecker!: (did: string) => boolean; - /** Project ID for context (giver) */ - @Prop({ default: "" }) - fromProjectId!: string; - - /** Project ID for context (recipient) */ - @Prop({ default: "" }) - toProjectId!: string; - /** Current giver entity for context */ @Prop() giver?: EntityData | null; @@ -119,20 +102,6 @@ export default class EntitySelectionStep extends Vue { @Prop() receiver?: EntityData | null; - /** Form field values to preserve when navigating to "Show All" */ - @Prop({ default: "" }) - description!: string; - - @Prop({ default: "0" }) - amountInput!: string; - - @Prop({ default: "HUR" }) - unitCode!: string; - - /** Offer ID for context when fulfilling an offer */ - @Prop({ default: "" }) - offerId!: string; - /** Notification function from parent component */ @Prop() notify?: (notification: NotificationIface, timeout?: number) => void; diff --git a/src/components/EntitySummaryButton.vue b/src/components/EntitySummaryButton.vue index 68a2baf415..cd8746756b 100644 --- a/src/components/EntitySummaryButton.vue +++ b/src/components/EntitySummaryButton.vue @@ -50,16 +50,7 @@ import EntityIcon from "./EntityIcon.vue"; import ProjectIcon from "./ProjectIcon.vue"; import { Contact } from "../db/tables/contacts"; import { UNNAMED_ENTITY_NAME } from "@/constants/entities"; - -/** - * Entity interface for both person and project entities - */ -interface EntityData { - did?: string; - handleId?: string; - name?: string; - image?: string; -} +import { EntityData } from "@/interfaces"; /** * EntitySummaryButton - Displays selected entity with edit capability diff --git a/src/components/GiftDetailsStep.vue b/src/components/GiftDetailsStep.vue index ef8fb25b55..b6c38ec254 100644 --- a/src/components/GiftDetailsStep.vue +++ b/src/components/GiftDetailsStep.vue @@ -14,7 +14,6 @@ control over updates and validation * * @author Matthew Raymer */ @@ -22,7 +21,6 @@ control over updates and validation * * @author Matthew Raymer */ @@ -104,16 +102,7 @@ import { Component, Prop, Vue, Watch, Emit } from "vue-facing-decorator"; import EntitySummaryButton from "./EntitySummaryButton.vue"; import AmountInput from "./AmountInput.vue"; import { RouteLocationRaw } from "vue-router"; - -/** - * Entity data interface for giver/receiver - */ -interface EntityData { - did?: string; - handleId?: string; - name?: string; - image?: string; -} +import { EntityData } from "@/interfaces"; /** * GiftDetailsStep - Complete step 2 gift details form interface @@ -145,14 +134,6 @@ export default class GiftDetailsStep extends Vue { @Prop({ required: true }) receiver!: EntityData | null; - /** Type of giver entity: 'person' or 'project' */ - @Prop({ required: true }) - giverEntityType!: "person" | "project"; - - /** Type of recipient entity: 'person' or 'project' */ - @Prop({ required: true }) - recipientEntityType!: "person" | "project"; - /** Gift description */ @Prop({ default: "" }) description!: string; @@ -211,6 +192,14 @@ export default class GiftDetailsStep extends Vue { private localAmount: number = 0; private localUnitCode: string = "HUR"; + get giverEntityType(): string { + return this.giver?.handleId ? "project" : "person"; + } + + get recipientEntityType(): string { + return this.receiver?.handleId ? "project" : "person"; + } + /** * CSS classes for the photo & more options link */ diff --git a/src/components/GiftedDialog.vue b/src/components/GiftedDialog.vue index e80196810b..252e6726d3 100644 --- a/src/components/GiftedDialog.vue +++ b/src/components/GiftedDialog.vue @@ -9,20 +9,12 @@