From b286a0315dd5ffedb0aa4beda3752f7a8f206e4e Mon Sep 17 00:00:00 2001 From: padreug Date: Fri, 7 Nov 2025 14:35:38 +0100 Subject: [PATCH 01/32] Updates project documentation Refines project documentation to reflect recent architectural changes and coding standards. Adds detailed explanations of the BaseService pattern, module structure, and JavaScript best practices to enhance developer understanding and consistency. Clarifies CSS styling guidelines, emphasizing semantic classes for theme-aware styling. Includes critical bug prevention techniques related to JavaScript falsy values and correct usage of the nullish coalescing operator. Updates build configuration details, environment variable requirements, and mobile browser workaround strategies. --- CLAUDE.md | 500 ++++++++++++++++++++---------------------------------- 1 file changed, 180 insertions(+), 320 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 6fd5d02..2ef2826 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,7 +10,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co - `npm run preview` - Preview production build locally - `npm run analyze` - Build with bundle analysis (opens visualization) -**Electron Development** +**Electron Development** - `npm run electron:dev` - Run both Vite dev server and Electron concurrently - `npm run electron:build` - Full build and package for Electron - `npm run start` - Start Electron using Forge @@ -26,7 +26,7 @@ This is a modular Vue 3 + TypeScript + Vite application with Electron support, f The application uses a plugin-based modular architecture with dependency injection for service management: **Core Modules:** -- **Base Module** (`src/modules/base/`) - Core infrastructure (Nostr, Auth, PWA) +- **Base Module** (`src/modules/base/`) - Core infrastructure (Nostr, Auth, PWA, Image Upload) - **Wallet Module** (`src/modules/wallet/`) - Lightning wallet management with real-time balance updates - **Nostr Feed Module** (`src/modules/nostr-feed/`) - Social feed functionality - **Chat Module** (`src/modules/chat/`) - Encrypted Nostr chat @@ -90,6 +90,12 @@ const relayHub = injectService(SERVICE_TOKENS.RELAY_HUB) - `SERVICE_TOKENS.VISIBILITY_SERVICE` - App visibility and connection management - `SERVICE_TOKENS.WALLET_SERVICE` - Wallet operations (send, receive, transactions) - `SERVICE_TOKENS.WALLET_WEBSOCKET_SERVICE` - Real-time wallet balance updates via WebSocket +- `SERVICE_TOKENS.STORAGE_SERVICE` - Local storage management +- `SERVICE_TOKENS.TOAST_SERVICE` - Toast notification system +- `SERVICE_TOKENS.INVOICE_SERVICE` - Lightning invoice creation and management +- `SERVICE_TOKENS.LNBITS_API` - LNbits API client +- `SERVICE_TOKENS.IMAGE_UPLOAD_SERVICE` - Image upload to pictrs server +- `SERVICE_TOKENS.NOSTR_METADATA_SERVICE` - Nostr user metadata (NIP-01 kind 0) **Core Stack:** - Vue 3 with Composition API (` From 9ed674d0f3ef701db81e236335a47fd73b84d8c6 Mon Sep 17 00:00:00 2001 From: padreug Date: Fri, 7 Nov 2025 16:21:59 +0100 Subject: [PATCH 03/32] Adds expense tracking module Adds a new module for tracking user expenses. The module includes: - Configuration settings for the LNbits API endpoint and timeouts. - An ExpensesAPI service for fetching accounts and submitting expense entries. - A UI component for adding expenses, including account selection and form input. - Dependency injection for the ExpensesAPI service. This allows users to submit expense entries with account selection and reference data, which will be linked to their wallet. --- src/app.config.ts | 14 + src/app.ts | 11 +- src/core/di-container.ts | 3 + .../expenses/components/AccountSelector.vue | 257 ++++++++++++++++ .../expenses/components/AddExpense.vue | 288 ++++++++++++++++++ src/modules/expenses/index.ts | 58 ++++ src/modules/expenses/services/ExpensesAPI.ts | 248 +++++++++++++++ src/modules/expenses/types/index.ts | 97 ++++++ 8 files changed, 975 insertions(+), 1 deletion(-) create mode 100644 src/modules/expenses/components/AccountSelector.vue create mode 100644 src/modules/expenses/components/AddExpense.vue create mode 100644 src/modules/expenses/index.ts create mode 100644 src/modules/expenses/services/ExpensesAPI.ts create mode 100644 src/modules/expenses/types/index.ts diff --git a/src/app.config.ts b/src/app.config.ts index 8060762..8893996 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -93,6 +93,20 @@ export const appConfig: AppConfig = { pollingInterval: 10000 // 10 seconds for polling updates } } + }, + expenses: { + name: 'expenses', + enabled: true, + lazy: false, + config: { + apiConfig: { + baseUrl: import.meta.env.VITE_LNBITS_BASE_URL || 'http://localhost:5000', + timeout: 30000 // 30 seconds for API requests + }, + defaultCurrency: 'sats', + maxExpenseAmount: 1000000, // 1M sats + requireDescription: true + } } }, diff --git a/src/app.ts b/src/app.ts index 459283e..6878880 100644 --- a/src/app.ts +++ b/src/app.ts @@ -16,6 +16,7 @@ import chatModule from './modules/chat' import eventsModule from './modules/events' import marketModule from './modules/market' import walletModule from './modules/wallet' +import expensesModule from './modules/expenses' // Root component import App from './App.vue' @@ -43,7 +44,8 @@ export async function createAppInstance() { ...chatModule.routes || [], ...eventsModule.routes || [], ...marketModule.routes || [], - ...walletModule.routes || [] + ...walletModule.routes || [], + ...expensesModule.routes || [] ].filter(Boolean) // Create router with all routes available immediately @@ -126,6 +128,13 @@ export async function createAppInstance() { ) } + // Register expenses module + if (appConfig.modules.expenses?.enabled) { + moduleRegistrations.push( + pluginManager.register(expensesModule, appConfig.modules.expenses) + ) + } + // Wait for all modules to register await Promise.all(moduleRegistrations) diff --git a/src/core/di-container.ts b/src/core/di-container.ts index da71624..0d27524 100644 --- a/src/core/di-container.ts +++ b/src/core/di-container.ts @@ -160,6 +160,9 @@ export const SERVICE_TOKENS = { // Image upload services IMAGE_UPLOAD_SERVICE: Symbol('imageUploadService'), + + // Expenses services + EXPENSES_API: Symbol('expensesAPI'), } as const // Type-safe injection helpers diff --git a/src/modules/expenses/components/AccountSelector.vue b/src/modules/expenses/components/AccountSelector.vue new file mode 100644 index 0000000..ec49ed3 --- /dev/null +++ b/src/modules/expenses/components/AccountSelector.vue @@ -0,0 +1,257 @@ + + + diff --git a/src/modules/expenses/components/AddExpense.vue b/src/modules/expenses/components/AddExpense.vue new file mode 100644 index 0000000..6b24130 --- /dev/null +++ b/src/modules/expenses/components/AddExpense.vue @@ -0,0 +1,288 @@ +