Adds scheduled events to the feed
Implements NIP-52 scheduled events, allowing users to view and interact with calendar events. A new `ScheduledEventService` is introduced to manage fetching, storing, and completing scheduled events. A new `ScheduledEventCard` component is introduced for displaying the scheduled events.
This commit is contained in:
parent
875bf50765
commit
b15a8c21c0
8 changed files with 716 additions and 1 deletions
|
|
@ -47,6 +47,7 @@ export class FeedService extends BaseService {
|
|||
protected relayHub: any = null
|
||||
protected visibilityService: any = null
|
||||
protected reactionService: any = null
|
||||
protected scheduledEventService: any = null
|
||||
|
||||
// Event ID tracking for deduplication
|
||||
private seenEventIds = new Set<string>()
|
||||
|
|
@ -72,10 +73,12 @@ export class FeedService extends BaseService {
|
|||
this.relayHub = injectService(SERVICE_TOKENS.RELAY_HUB)
|
||||
this.visibilityService = injectService(SERVICE_TOKENS.VISIBILITY_SERVICE)
|
||||
this.reactionService = injectService(SERVICE_TOKENS.REACTION_SERVICE)
|
||||
this.scheduledEventService = injectService(SERVICE_TOKENS.SCHEDULED_EVENT_SERVICE)
|
||||
|
||||
console.log('FeedService: RelayHub injected:', !!this.relayHub)
|
||||
console.log('FeedService: VisibilityService injected:', !!this.visibilityService)
|
||||
console.log('FeedService: ReactionService injected:', !!this.reactionService)
|
||||
console.log('FeedService: ScheduledEventService injected:', !!this.scheduledEventService)
|
||||
|
||||
if (!this.relayHub) {
|
||||
throw new Error('RelayHub service not available')
|
||||
|
|
@ -199,6 +202,12 @@ export class FeedService extends BaseService {
|
|||
kinds: [5] // All deletion events (for both posts and reactions)
|
||||
})
|
||||
|
||||
// Add scheduled events (kind 31922) and RSVPs (kind 31925)
|
||||
filters.push({
|
||||
kinds: [31922, 31925], // Calendar events and RSVPs
|
||||
limit: 200
|
||||
})
|
||||
|
||||
console.log(`Creating feed subscription for ${config.feedType} with filters:`, filters)
|
||||
|
||||
// Subscribe to all events (posts, reactions, deletions) with deduplication
|
||||
|
|
@ -257,6 +266,22 @@ export class FeedService extends BaseService {
|
|||
return
|
||||
}
|
||||
|
||||
// Route scheduled events (kind 31922) to ScheduledEventService
|
||||
if (event.kind === 31922) {
|
||||
if (this.scheduledEventService) {
|
||||
this.scheduledEventService.handleScheduledEvent(event)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Route RSVP/completion events (kind 31925) to ScheduledEventService
|
||||
if (event.kind === 31925) {
|
||||
if (this.scheduledEventService) {
|
||||
this.scheduledEventService.handleCompletionEvent(event)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Skip if event already seen (for posts only, kind 1)
|
||||
if (this.seenEventIds.has(event.id)) {
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue