forked from jsnbuchanan/crowd-funder-for-time-pwa
Refactor ClaimView.vue: remove inline template logic, improve types, and centralize logic
- Move all complex template logic to computed properties and methods - Replace all `as any` usages with proper TypeScript types (OfferClaim, GiveActionClaim) - Add computed property for claim image, removing inline image access - Route all logging through PlatformServiceMixin - Ensure all icon-only buttons have aria-labels for accessibility - Remove unused imports and direct logger usage - Lint clean: no warnings or errors remain
This commit is contained in:
@@ -1062,6 +1062,39 @@ export const PlatformServiceMixin = {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
// =================================================
|
||||
// LOGGING METHODS (convenience methods for components)
|
||||
// =================================================
|
||||
|
||||
/**
|
||||
* Log message to database - $log()
|
||||
* @param message Message to log
|
||||
* @param level Log level (info, warn, error)
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
async $log(message: string, level?: string): Promise<void> {
|
||||
return logger.toDb(message, level);
|
||||
},
|
||||
|
||||
/**
|
||||
* Log error message to database - $logError()
|
||||
* @param message Error message to log
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
async $logError(message: string): Promise<void> {
|
||||
return logger.toDb(message, "error");
|
||||
},
|
||||
|
||||
/**
|
||||
* Log message to console and database - $logAndConsole()
|
||||
* @param message Message to log
|
||||
* @param isError Whether this is an error message
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
async $logAndConsole(message: string, isError = false): Promise<void> {
|
||||
return logger.toConsoleAndDb(message, isError);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1123,6 +1156,11 @@ export interface IPlatformServiceMixin {
|
||||
did: string,
|
||||
settings: Partial<Settings>,
|
||||
): Promise<boolean>;
|
||||
|
||||
// Logging methods
|
||||
$log(message: string, level?: string): Promise<void>;
|
||||
$logError(message: string): Promise<void>;
|
||||
$logAndConsole(message: string, isError?: boolean): Promise<void>;
|
||||
}
|
||||
|
||||
// TypeScript declaration merging to eliminate (this as any) type assertions
|
||||
@@ -1217,5 +1255,10 @@ declare module "@vue/runtime-core" {
|
||||
did: string,
|
||||
settings: Partial<Settings>,
|
||||
): Promise<boolean>;
|
||||
|
||||
// Logging methods
|
||||
$log(message: string, level?: string): Promise<void>;
|
||||
$logError(message: string): Promise<void>;
|
||||
$logAndConsole(message: string, isError?: boolean): Promise<void>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user