lint fix wip

This commit is contained in:
Nicolas Cantu 2026-01-06 21:52:38 +01:00
parent e97d2b32cc
commit 91fe30a860
3 changed files with 85 additions and 44 deletions

View File

@ -291,11 +291,15 @@ export function RelayManager({ onConfigChange }: RelayManagerProps): React.React
handleDrop(e, relay.id)
}}
className={`bg-cyber-dark border rounded p-4 space-y-3 transition-all ${
draggedId === relay.id
? 'opacity-50 border-neon-cyan'
: dragOverId === relay.id
? 'border-neon-green shadow-lg'
: 'border-neon-cyan/30'
(() => {
if (draggedId === relay.id) {
return 'opacity-50 border-neon-cyan'
}
if (dragOverId === relay.id) {
return 'border-neon-green shadow-lg'
}
return 'border-neon-cyan/30'
})()
}`}
>
<div className="flex items-start justify-between gap-4">

View File

@ -41,7 +41,12 @@ export function ReviewForm({ article, onSuccess, onCancel }: ReviewFormProps): R
return
}
const category = article.category === 'author-presentation' ? 'science-fiction' : (article.category ?? 'science-fiction')
const category = (() => {
if (article.category === 'author-presentation') {
return 'science-fiction'
}
return article.category ?? 'science-fiction'
})()
const seriesId = article.seriesId ?? ''
await publishReview({

View File

@ -7,7 +7,6 @@
import type { Event } from 'nostr-tools'
import type { SimplePoolWithSub } from '@/types/nostr-tools-extended'
import { nostrService } from './nostr'
import { getPrimaryRelaySync } from './config'
import { PLATFORM_SERVICE, MIN_EVENT_DATE } from './platformConfig'
import { buildTagFilter, extractTagsFromEvent } from './nostrTagSystem'
import { objectCache } from './objectCache'
@ -24,6 +23,7 @@ class PlatformSyncService {
/**
* Start background sync
* Scans all notes with service='zapwall.fr' and caches them
* Does not require pubkey - syncs all public notes with service='zapwall.fr'
*/
async startSync(): Promise<void> {
if (this.syncInProgress) {
@ -38,12 +38,25 @@ class PlatformSyncService {
this.syncInProgress = true
// Update progress manager to show sync indicator
const { syncProgressManager } = await import('./syncProgressManager')
const { relaySessionManager } = await import('./relaySessionManager')
const activeRelays = await relaySessionManager.getActiveRelays()
const initialRelay = activeRelays[0] ?? 'Connecting...'
syncProgressManager.setProgress({ currentStep: 0, totalSteps: 1, completed: false, currentRelay: initialRelay })
try {
await this.performSync(pool as unknown as SimplePoolWithSub)
syncProgressManager.setProgress({ currentStep: 1, totalSteps: 1, completed: true, currentRelay: initialRelay })
} catch (error) {
console.error('Error in platform sync:', error)
syncProgressManager.setProgress(null)
} finally {
this.syncInProgress = false
// Clear progress after a short delay
setTimeout(() => {
syncProgressManager.setProgress(null)
}, 500)
}
}
@ -62,10 +75,24 @@ class PlatformSyncService {
},
]
return new Promise((resolve) => {
const relayUrl = getPrimaryRelaySync()
// Use relay rotation for platform sync
const { tryWithRelayRotation } = await import('./relayRotation')
const { syncProgressManager } = await import('./syncProgressManager')
return tryWithRelayRotation(
pool as unknown as import('nostr-tools').SimplePool,
async (relayUrl, poolWithSub) => {
// Update progress with current relay
const currentProgress = syncProgressManager.getProgress()
if (currentProgress) {
syncProgressManager.setProgress({
...currentProgress,
currentRelay: relayUrl,
})
}
const { createSubscription } = require('@/types/nostr-tools-extended')
const sub = createSubscription(pool, [relayUrl], filters)
const sub = createSubscription(poolWithSub, [relayUrl], filters)
const events: Event[] = []
let resolved = false
@ -82,9 +109,9 @@ class PlatformSyncService {
await this.processAndCacheEvents(events)
this.lastSyncTime = Date.now()
resolve()
}
return new Promise<void>((resolve) => {
sub.on('event', (event: Event): void => {
// Only process events with service='zapwall.fr'
const tags = extractTagsFromEvent(event)
@ -96,6 +123,7 @@ class PlatformSyncService {
sub.on('eose', (): void => {
void (async (): Promise<void> => {
await finalize()
resolve()
})()
})
@ -103,11 +131,15 @@ class PlatformSyncService {
setTimeout((): void => {
void (async (): Promise<void> => {
await finalize()
resolve()
})()
}, this.SYNC_TIMEOUT_MS).unref?.()
this.syncSubscription = sub
})
},
30000 // 30 second timeout per relay
)
}
/**