- Introduced ProfileService to handle user profiles, including fetching and displaying profile information. - Updated NostrFeed module to register ProfileService in the DI container and initialize it during installation. - Enhanced NostrFeed.vue to utilize the profiles service for displaying user names alongside posts. - Created useProfiles composable for managing profile-related functionality, including fetching and subscribing to profile updates. These changes improve user engagement by providing richer profile information within the feed, enhancing the overall user experience.
57 lines
No EOL
1.6 KiB
TypeScript
57 lines
No EOL
1.6 KiB
TypeScript
import type { App } from 'vue'
|
|
import type { ModulePlugin } from '@/core/types'
|
|
import { container, SERVICE_TOKENS } from '@/core/di-container'
|
|
import NostrFeed from './components/NostrFeed.vue'
|
|
import { useFeed } from './composables/useFeed'
|
|
import { FeedService } from './services/FeedService'
|
|
import { ProfileService } from './services/ProfileService'
|
|
|
|
/**
|
|
* Nostr Feed Module Plugin
|
|
* Provides social feed functionality with admin announcements support
|
|
*/
|
|
export const nostrFeedModule: ModulePlugin = {
|
|
name: 'nostr-feed',
|
|
version: '1.0.0',
|
|
dependencies: ['base'],
|
|
|
|
async install(app: App) {
|
|
console.log('nostr-feed module: Starting installation...')
|
|
|
|
// Register services in DI container
|
|
const feedService = new FeedService()
|
|
const profileService = new ProfileService()
|
|
|
|
container.provide(SERVICE_TOKENS.FEED_SERVICE, feedService)
|
|
container.provide(SERVICE_TOKENS.PROFILE_SERVICE, profileService)
|
|
console.log('nostr-feed module: Services registered in DI container')
|
|
|
|
// Initialize services
|
|
console.log('nostr-feed module: Initializing services...')
|
|
await Promise.all([
|
|
feedService.initialize({
|
|
waitForDependencies: true,
|
|
maxRetries: 3
|
|
}),
|
|
profileService.initialize({
|
|
waitForDependencies: true,
|
|
maxRetries: 3
|
|
})
|
|
])
|
|
console.log('nostr-feed module: Services initialized')
|
|
|
|
// Register components globally
|
|
app.component('NostrFeed', NostrFeed)
|
|
console.log('nostr-feed module: Installation complete')
|
|
},
|
|
|
|
components: {
|
|
NostrFeed
|
|
},
|
|
|
|
composables: {
|
|
useFeed
|
|
}
|
|
}
|
|
|
|
export default nostrFeedModule |