You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

6.0 KiB

NewEditProjectView.vue Pre-Migration Audit

Component Overview

  • File: src/views/NewEditProjectView.vue
  • Size: 844 lines (Very High Complexity)
  • Purpose: Project creation and editing interface
  • Migration Target: Enhanced Triple Migration Pattern

Database Operations Analysis

Phase 1: Database Migration Requirements

Current databaseUtil Usage:

  1. databaseUtil.retrieveSettingsForActiveAccount() - Lines 282, 705
    • Migration: → this.$accountSettings()
    • Usage: Get active DID, API server, and advanced settings
    • Context: Component initialization and partner API calls

Additional Database Operations:

  • retrieveAccountCount() - Line 281
  • retrieveFullyDecryptedAccount() - Line 667
  • These are already using util functions but need PlatformServiceMixin integration

Phase 2: SQL Abstraction Assessment

Status: No raw SQL queries identified

  • Component uses high-level database utilities
  • No direct SQL statements requiring abstraction

Phase 3: Notification Migration Analysis

Current Notification Patterns (16 total notifications):

  1. Error Notifications (10 instances):

    • Account loading errors (Line 260)
    • Project loading errors (Line 336)
    • Image deletion errors (Lines 403, 428)
    • Location validation errors (Line 460)
    • Date validation errors (Lines 478, 494)
    • Partner sending errors (Lines 568, 728, 753)
    • Claim saving errors (Line 636)
  2. Success Notifications (3 instances):

    • Project saved successfully (Line 535)
    • Sent to partner services (Line 733)
  3. Confirmation Dialogs (2 instances):

    • Image deletion confirmation (Line 350)
    • Location marker erasure (Line 788)
  4. Info Notifications (1 instance):

    • Nostr partner information (Line 812)

Migration Requirements:

  • Extract all notification messages to constants
  • Implement helper system for consistent timeouts
  • Standardize error message formats

Phase 4: Template Streamlining Assessment

Template Complexity: High - Multiple complex inline expressions

Candidates for Computed Properties:

  1. Button State Management:

    • isHiddenSave and isHiddenSpinner logic
    • Save button classes and states
  2. Form Validation States:

    • Date/time input validation
    • Location validation
    • Agent DID validation warning
  3. Dynamic Content Display:

    • Timezone display formatting
    • Character count for description
    • Image display and deletion logic
  4. Map and Location Logic:

    • Map marker visibility
    • Location inclusion state
    • Coordinate validation

Component Feature Analysis

Core Features

  • Project CRUD Operations: Create, read, update project ideas
  • Rich Form Fields: Name, description, website, dates, location
  • Image Management: Upload, display, delete project images
  • Location Integration: Interactive map with marker placement
  • Partner Integration: Trustroots and TripHopping sharing
  • Validation Systems: Date/time, location, form validation
  • State Management: Loading states, error handling

External Dependencies

  • Leaflet Maps: Geographic location selection
  • Axios: API communication
  • Luxon: Date/time manipulation
  • Nostr Tools: Cryptographic signing for partners
  • Image API: Image upload and deletion

Technical Complexity Indicators

  • 16 notification calls requiring standardization
  • Complex state management with multiple loading states
  • External API integration with error handling
  • Cryptographic operations for partner sharing
  • Map integration with interactive features
  • Form validation with multiple field types

Migration Complexity Assessment

Complexity Rating: Very High

  • Component Size: 844 lines
  • Database Operations: 3 patterns requiring migration
  • Notification Patterns: 16 calls requiring standardization
  • Template Complexity: Multiple candidates for computed properties
  • External Dependencies: High integration complexity

Estimated Migration Time

  • Conservative Estimate: 45-60 minutes
  • Optimistic Estimate: 35-45 minutes
  • High Estimate: 60-75 minutes

Risk Factors

  1. High Line Count: Large component with many interconnected features
  2. Complex State Management: Multiple loading and error states
  3. External Integrations: Map, image, and partner API dependencies
  4. Cryptographic Operations: Nostr signing and key management
  5. Form Validation: Multiple validation patterns requiring careful handling

Migration Strategy

Phase 1: Database Migration

  1. Add PlatformServiceMixin to mixins array
  2. Replace databaseUtil.retrieveSettingsForActiveAccount()this.$accountSettings()
  3. Ensure other database utilities work with mixin integration
  4. Add comprehensive JSDoc documentation

Phase 2: SQL Abstraction

  • No raw SQL queries to migrate
  • Verify service layer integration works correctly

Phase 3: Notification Migration

  1. Import notification constants from @/constants/notifications
  2. Implement notification helper system
  3. Replace all 16 $notify calls with standardized helpers
  4. Use appropriate timeout constants for different message types

Phase 4: Template Streamlining

  1. Extract button state logic to computed properties
  2. Create validation state computed properties
  3. Implement display formatting computed properties
  4. Simplify map and location logic

Pre-Migration Checklist

  • Component structure analyzed
  • Database operations identified
  • Notification patterns catalogued
  • Template complexity assessed
  • Migration strategy defined
  • Risk factors identified
  • Time estimates calculated

Next Steps

  1. Begin Phase 1: Database Migration
  2. Add PlatformServiceMixin integration
  3. Replace databaseUtil calls with mixin methods
  4. Proceed through remaining phases systematically

Notes

  • Component is feature-rich with significant complexity
  • Multiple external dependencies require careful handling
  • Strong candidate for computed property extraction
  • Comprehensive testing will be required post-migration