Enhance market module with new chat and events features

- Introduce chat module with components, services, and composables for real-time messaging.
- Implement events module with API service, components, and ticket purchasing functionality.
- Update app configuration to include new modules and their respective settings.
- Refactor existing components to integrate with the new chat and events features.
- Enhance market store and services to support new functionalities and improve order management.
- Update routing to accommodate new views for chat and events, ensuring seamless navigation.
This commit is contained in:
padreug 2025-09-05 00:01:40 +02:00
parent 519a9003d4
commit e40ac91417
46 changed files with 6305 additions and 3264 deletions

View file

@ -1,60 +1,3 @@
import { ref, readonly } from 'vue'
import { useMarket } from './useMarket'
import { useMarketStore } from '@/stores/market'
import { config } from '@/lib/config'
export function useMarketPreloader() {
const isPreloading = ref(false)
const isPreloaded = ref(false)
const preloadError = ref<string | null>(null)
const market = useMarket()
const marketStore = useMarketStore()
const preloadMarket = async () => {
// Don't preload if already done or currently preloading
if (isPreloaded.value || isPreloading.value) {
return
}
try {
isPreloading.value = true
preloadError.value = null
const naddr = config.market.defaultNaddr
if (!naddr) {
return
}
// Connect to market
await market.connectToMarket()
// Load market data
await market.loadMarket(naddr)
// Clear any error state since preloading succeeded
marketStore.setError(null)
isPreloaded.value = true
} catch (error) {
preloadError.value = error instanceof Error ? error.message : 'Failed to preload market'
// Don't throw error, let the UI handle it gracefully
} finally {
isPreloading.value = false
}
}
const resetPreload = () => {
isPreloaded.value = false
preloadError.value = null
}
return {
isPreloading: readonly(isPreloading),
isPreloaded: readonly(isPreloaded),
preloadError: readonly(preloadError),
preloadMarket,
resetPreload
}
}
// Compatibility re-export for the moved useMarketPreloader composable
export * from '@/modules/market/composables/useMarketPreloader'
export { useMarketPreloader } from '@/modules/market/composables/useMarketPreloader'