diff --git a/src/components/ActivityListItem.vue b/src/components/ActivityListItem.vue index 6b91371c..b3bb9035 100644 --- a/src/components/ActivityListItem.vue +++ b/src/components/ActivityListItem.vue @@ -52,7 +52,7 @@ @@ -67,7 +67,7 @@ >

- + {{ description }}

@@ -248,7 +248,7 @@ diff --git a/src/components/ContactInputForm.vue b/src/components/ContactInputForm.vue index 8d791eda..35c693e4 100644 --- a/src/components/ContactInputForm.vue +++ b/src/components/ContactInputForm.vue @@ -64,7 +64,7 @@ diff --git a/src/components/ContactListHeader.vue b/src/components/ContactListHeader.vue index 3e2c4589..cfb65be2 100644 --- a/src/components/ContactListHeader.vue +++ b/src/components/ContactListHeader.vue @@ -8,21 +8,21 @@ :checked="allContactsSelected" class="align-middle ml-2 h-6 w-6" data-testId="contactCheckAllTop" - @click="$emit('toggle-all-selection')" + @click="emitToggleAllSelection" /> @@ -33,7 +33,7 @@ v-if="showGiveNumbers" class="text-md bg-gradient-to-b shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-3 py-1.5 rounded-md" :class="giveAmountsButtonClass" - @click="$emit('toggle-give-totals')" + @click="emitToggleGiveTotals" > {{ giveAmountsButtonText }} @@ -41,7 +41,7 @@ @@ -50,7 +50,7 @@ diff --git a/src/components/ContactListItem.vue b/src/components/ContactListItem.vue index abdfdbb0..c972fe80 100644 --- a/src/components/ContactListItem.vue +++ b/src/components/ContactListItem.vue @@ -9,14 +9,14 @@ :checked="isSelected" class="ml-2 h-6 w-6 flex-shrink-0" data-testId="contactCheckOne" - @click="$emit('toggle-selection', contact.did)" + @click="emitToggleSelection(contact.did)" />
@@ -63,7 +63,7 @@ @@ -71,7 +71,7 @@ @@ -81,7 +81,7 @@ @@ -102,7 +102,7 @@ diff --git a/src/components/MembersList.vue b/src/components/MembersList.vue index 36db158a..d10d4847 100644 --- a/src/components/MembersList.vue +++ b/src/components/MembersList.vue @@ -178,7 +178,7 @@ // Validation: Passes lint checks and TypeScript compilation // Navigation: Contacts → Chair Icon → Start/Join Meeting → Members List -import { Component, Vue, Prop } from "vue-facing-decorator"; +import { Component, Vue, Prop, Emit } from "vue-facing-decorator"; import { errorStringForLog, @@ -222,6 +222,12 @@ export default class MembersList extends Vue { @Prop({ required: true }) password!: string; @Prop({ default: false }) showOrganizerTools!: boolean; + // Emit methods using @Emit decorator + @Emit("error") + emitError(message: string) { + return message; + } + decryptedMembers: DecryptedMember[] = []; firstName = ""; isLoading = true; @@ -262,10 +268,7 @@ export default class MembersList extends Vue { "Error fetching members: " + errorStringForLog(error), true, ); - this.$emit( - "error", - serverMessageForUser(error) || "Failed to fetch members.", - ); + this.emitError(serverMessageForUser(error) || "Failed to fetch members."); } finally { this.isLoading = false; } @@ -478,8 +481,7 @@ export default class MembersList extends Vue { "Error toggling admission: " + errorStringForLog(error), true, ); - this.$emit( - "error", + this.emitError( serverMessageForUser(error) || "Failed to update member admission status.", ); diff --git a/src/components/OnboardingDialog.vue b/src/components/OnboardingDialog.vue index 5c3724da..f6275f12 100644 --- a/src/components/OnboardingDialog.vue +++ b/src/components/OnboardingDialog.vue @@ -180,7 +180,7 @@ > Let's go!
- See & record gratitude. + See & record things you've received.
diff --git a/src/db/tables/contacts.ts b/src/db/tables/contacts.ts index 147323b9..3dfa6e1b 100644 --- a/src/db/tables/contacts.ts +++ b/src/db/tables/contacts.ts @@ -6,7 +6,9 @@ export type ContactMethod = { export type Contact = { // - // When adding a property, consider whether it should be added when exporting & sharing contacts, eg. DataExportSection + // When adding a property: + // - Consider whether it should be added when exporting & sharing contacts, eg. DataExportSection + // - If it's a boolean, it should be converted from a 0/1 integer in PlatformServiceMixin._mapColumnsToValues did: string; contactMethods?: Array; diff --git a/src/libs/util.ts b/src/libs/util.ts index 8a84a77e..ea234243 100644 --- a/src/libs/util.ts +++ b/src/libs/util.ts @@ -34,6 +34,7 @@ import { PlatformServiceFactory } from "../services/PlatformServiceFactory"; import { IIdentifier } from "@veramo/core"; import { DEFAULT_ROOT_DERIVATION_PATH } from "./crypto"; +// Consolidate this with src/utils/PlatformServiceMixin._parseJsonField function parseJsonField(value: unknown, defaultValue: T): T { if (typeof value === "string") { try { diff --git a/src/utils/PlatformServiceMixin.ts b/src/utils/PlatformServiceMixin.ts index 5afbd58e..09fec9c0 100644 --- a/src/utils/PlatformServiceMixin.ts +++ b/src/utils/PlatformServiceMixin.ts @@ -59,14 +59,14 @@ import { // TYPESCRIPT INTERFACES // ================================================= -/** - * Cache entry interface for storing data with TTL - */ -interface CacheEntry { - data: T; - timestamp: number; - ttl: number; // milliseconds -} +// /** +// * Cache entry interface for storing data with TTL +// */ +// interface CacheEntry { +// data: T; +// timestamp: number; +// ttl: number; // milliseconds +// } /** * Vue component interface that uses the PlatformServiceMixin @@ -79,21 +79,21 @@ interface VueComponentWithMixin { platformService(): PlatformService; } -/** - * Global cache store for mixin instances - * Uses WeakMap to avoid memory leaks when components are destroyed - */ -const componentCaches = new WeakMap< - VueComponentWithMixin, - Map> ->(); - -/** - * Cache configuration constants - */ -const CACHE_DEFAULTS = { - default: 15000, // 15 seconds default TTL -} as const; +// /** +// * Global cache store for mixin instances +// * Uses WeakMap to avoid memory leaks when components are destroyed +// */ +// const componentCaches = new WeakMap< +// VueComponentWithMixin, +// Map> +// >(); +// +// /** +// * Cache configuration constants +// */ +// const CACHE_DEFAULTS = { +// default: 15000, // 15 seconds default TTL +// } as const; const _memoryLogs: string[] = []; @@ -178,8 +178,8 @@ export const PlatformServiceMixin = { logger.debug( `[PlatformServiceMixin] ActiveDid changed from ${oldDid} to ${newDid}`, ); - // Clear caches that might be affected by the change - (this as any).$clearAllCaches(); + // // Clear caches that might be affected by the change + // (this as any).$clearAllCaches(); } }, immediate: true, @@ -203,8 +203,8 @@ export const PlatformServiceMixin = { logger.debug( `[PlatformServiceMixin] ActiveDid updated from ${oldDid} to ${newDid}`, ); - // Clear caches that might be affected by the change - this.$clearAllCaches(); + // // Clear caches that might be affected by the change + // this.$clearAllCaches(); } }, @@ -251,6 +251,8 @@ export const PlatformServiceMixin = { /** * Self-contained implementation of parseJsonField * Safely parses JSON strings with fallback to default value + * + * Consolidate this with src/libs/util.ts parseJsonField */ _parseJsonField(value: unknown, defaultValue: T): T { if (typeof value === "string") { @@ -263,71 +265,71 @@ export const PlatformServiceMixin = { return (value as T) || defaultValue; }, - // ================================================= - // CACHING UTILITY METHODS - // ================================================= - - /** - * Get or initialize cache for this component instance - */ - _getCache(): Map> { - let cache = componentCaches.get(this as unknown as VueComponentWithMixin); - if (!cache) { - cache = new Map(); - componentCaches.set(this as unknown as VueComponentWithMixin, cache); - } - return cache; - }, - - /** - * Check if cache entry is valid (not expired) - */ - _isCacheValid(entry: CacheEntry): boolean { - return Date.now() - entry.timestamp < entry.ttl; - }, - - /** - * Get data from cache if valid, otherwise return null - */ - _getCached(key: string): T | null { - const cache = this._getCache(); - const entry = cache.get(key); - if (entry && this._isCacheValid(entry)) { - return entry.data as T; - } - cache.delete(key); // Clean up expired entries - return null; - }, - - /** - * Store data in cache with TTL - */ - _setCached(key: string, data: T, ttl?: number): T { - const cache = this._getCache(); - const actualTtl = ttl || CACHE_DEFAULTS.default; - cache.set(key, { - data, - timestamp: Date.now(), - ttl: actualTtl, - }); - return data; - }, - - /** - * Invalidate specific cache entry - */ - _invalidateCache(key: string): void { - const cache = this._getCache(); - cache.delete(key); - }, - - /** - * Clear all cache entries for this component - */ - _clearCache(): void { - const cache = this._getCache(); - cache.clear(); - }, + // // ================================================= + // // CACHING UTILITY METHODS + // // ================================================= + + // /** + // * Get or initialize cache for this component instance + // */ + // _getCache(): Map> { + // let cache = componentCaches.get(this as unknown as VueComponentWithMixin); + // if (!cache) { + // cache = new Map(); + // componentCaches.set(this as unknown as VueComponentWithMixin, cache); + // } + // return cache; + // }, + + // /** + // * Check if cache entry is valid (not expired) + // */ + // _isCacheValid(entry: CacheEntry): boolean { + // return Date.now() - entry.timestamp < entry.ttl; + // }, + + // /** + // * Get data from cache if valid, otherwise return null + // */ + // _getCached(key: string): T | null { + // const cache = this._getCache(); + // const entry = cache.get(key); + // if (entry && this._isCacheValid(entry)) { + // return entry.data as T; + // } + // cache.delete(key); // Clean up expired entries + // return null; + // }, + + // /** + // * Store data in cache with TTL + // */ + // _setCached(key: string, data: T, ttl?: number): T { + // const cache = this._getCache(); + // const actualTtl = ttl || CACHE_DEFAULTS.default; + // cache.set(key, { + // data, + // timestamp: Date.now(), + // ttl: actualTtl, + // }); + // return data; + // }, + + // /** + // * Invalidate specific cache entry + // */ + // _invalidateCache(key: string): void { + // const cache = this._getCache(); + // cache.delete(key); + // }, + + // /** + // * Clear all cache entries for this component + // */ + // _clearCache(): void { + // const cache = this._getCache(); + // cache.clear(); + // }, // ================================================= // ENHANCED DATABASE METHODS (with error handling) @@ -879,13 +881,13 @@ export const PlatformServiceMixin = { return await this.$contacts(); }, - /** - * Clear all caches for this component - $clearAllCaches() - * Useful for manual cache management - */ - $clearAllCaches(): void { - this._clearCache(); - }, + // /** + // * Clear all caches for this component - $clearAllCaches() + // * Useful for manual cache management + // */ + // $clearAllCaches(): void { + // this._clearCache(); + // }, // ================================================= // HIGH-LEVEL ENTITY OPERATIONS (eliminate verbose SQL patterns) @@ -1657,7 +1659,7 @@ declare module "@vue/runtime-core" { // Cache management methods $refreshSettings(): Promise; $refreshContacts(): Promise; - $clearAllCaches(): void; + // $clearAllCaches(): void; // High-level entity operations (eliminate verbose SQL patterns) $mapResults( diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index 8fbc75d0..1cb9be94 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -1396,10 +1396,6 @@ export default class AccountViewView extends Vue { if (imageResp.status === 200) { this.imageLimits = imageResp.data; } else { - await this.$saveSettings({ - profileImageUrl: "", - }); - this.profileImageUrl = ""; this.limitsMessage = ACCOUNT_VIEW_CONSTANTS.LIMITS.NO_IMAGE_ACCESS; this.notify.warning(ACCOUNT_VIEW_CONSTANTS.LIMITS.CANNOT_UPLOAD_IMAGES); return; @@ -1414,10 +1410,6 @@ export default class AccountViewView extends Vue { if (endorserResp.status === 200) { this.endorserLimits = endorserResp.data; } else { - await this.$saveSettings({ - profileImageUrl: "", - }); - this.profileImageUrl = ""; this.limitsMessage = ACCOUNT_VIEW_CONSTANTS.LIMITS.NO_LIMITS_FOUND; this.notify.warning(ACCOUNT_VIEW_CONSTANTS.LIMITS.BAD_SERVER_RESPONSE); return; @@ -1425,7 +1417,7 @@ export default class AccountViewView extends Vue { } catch (error) { this.limitsMessage = ACCOUNT_VIEW_CONSTANTS.LIMITS.ERROR_RETRIEVING_LIMITS; - console.log("error: ", error); + logger.error("Error retrieving limits: ", error); // this.notify.error(this.limitsMessage, TIMEOUTS.STANDARD); } finally { this.loadingLimits = false; diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index 93c4473d..fb099518 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -314,6 +314,7 @@ import { } from "@/constants/notifications"; import * as Package from "../../package.json"; +// consolidate this with GiveActionClaim in src/interfaces/claims.ts interface Claim { claim?: Claim; // For nested claims in Verifiable Credentials agent?: {