lint fix wip

This commit is contained in:
Nicolas Cantu 2026-01-06 16:44:12 +01:00
parent 0e856d958e
commit cc84d85193
6 changed files with 36 additions and 27 deletions

View File

@ -11,10 +11,6 @@ export function SyncProgressBar(): React.ReactElement | null {
const [lastSyncDate, setLastSyncDate] = useState<number | null>(null)
const [totalDays, setTotalDays] = useState<number>(0)
useEffect(() => {
void loadSyncStatus()
}, [])
async function loadSyncStatus(): Promise<void> {
try {
const state = nostrAuthService.getState()
@ -28,12 +24,6 @@ export function SyncProgressBar(): React.ReactElement | null {
setLastSyncDate(storedLastSyncDate)
setTotalDays(days)
// If everything is synced (no days to sync), don't show the progress bar
if (days === 0 && storedLastSyncDate >= currentTimestamp) {
setSyncProgress(null)
}
} catch (error) {
console.error('Error loading sync status:', error)
}
@ -66,21 +56,14 @@ export function SyncProgressBar(): React.ReactElement | null {
}
}
// Don't show if not connected or if everything is synced
// Don't show if not connected
const state = nostrAuthService.getState()
if (!state.connected || !state.pubkey) {
return null
}
// If everything is synced, don't show the progress bar
if (totalDays === 0 && lastSyncDate !== null && lastSyncDate >= getCurrentTimestamp()) {
return null
}
// If sync is completed and no days to sync, don't show
if (syncProgress?.completed && totalDays === 0) {
return null
}
// Check if sync is recently completed (within last hour)
const isRecentlySynced = lastSyncDate !== null && lastSyncDate >= getCurrentTimestamp() - 3600
const progressPercentage = syncProgress && syncProgress.totalSteps > 0
? Math.min(100, (syncProgress.currentStep / syncProgress.totalSteps) * 100)
@ -108,7 +91,7 @@ export function SyncProgressBar(): React.ReactElement | null {
<h3 className="text-lg font-semibold text-neon-cyan">
{t('settings.sync.title')}
</h3>
{!isSyncing && totalDays > 0 && (
{!isSyncing && (
<button
onClick={() => {
void startSync()
@ -154,11 +137,17 @@ export function SyncProgressBar(): React.ReactElement | null {
</div>
)}
{!isSyncing && totalDays === 0 && lastSyncDate !== null && (
{!isSyncing && totalDays === 0 && isRecentlySynced && (
<p className="text-sm text-green-400">
{t('settings.sync.completed')}
</p>
)}
{!isSyncing && totalDays === 0 && !isRecentlySynced && (
<p className="text-sm text-cyber-accent">
{t('settings.sync.ready')}
</p>
)}
</div>
)
}

View File

@ -94,7 +94,12 @@ async function buildSeriesEvent(
authorPubkey: string
},
category: NonNullable<ArticleDraft['category']>
) {
): Promise<{
kind: number
created_at: number
content: string
tags: string[][]
}> {
// Map category to new system
const newCategory = category === 'science-fiction' ? 'sciencefiction' : 'research'
@ -197,7 +202,12 @@ async function buildReviewEvent(
text?: string
},
category: NonNullable<ArticleDraft['category']>
) {
): Promise<{
kind: number
created_at: number
content: string
tags: string[][]
}> {
// Map category to new system
const newCategory = category === 'science-fiction' ? 'sciencefiction' : 'research'
@ -260,7 +270,7 @@ async function buildUpdateTags(
newCategory: 'sciencefiction' | 'research',
authorPubkey: string,
currentVersion: number = 0
) {
): Promise<string[][]> {
// Generate hash ID from publication data
const hashId = await generatePublicationHashId({
pubkey: authorPubkey,

View File

@ -7,7 +7,15 @@ import { getPrimaryRelaySync } from './config'
import { MIN_EVENT_DATE } from './platformConfig'
import { parseObjectId } from './urlGenerator'
function buildSponsoringFilters(authorPubkey?: string, payerPubkey?: string, seriesId?: string, articleId?: string) {
function buildSponsoringFilters(authorPubkey?: string, payerPubkey?: string, seriesId?: string, articleId?: string): Array<{
kinds: number[]
since?: number
authors?: string[]
'#p'?: string[]
'#series'?: string[]
'#article'?: string[]
'#kind_type'?: string[]
}> {
const filters: Array<{
kinds: number[]
since?: number

View File

@ -19,7 +19,7 @@ interface ParseResult {
files: Record<string, FormidableFile[]>
}
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
export default async function handler(req: NextApiRequest, res: NextApiResponse): Promise<void> {
if (req.method !== 'POST') {
return res.status(405).json({ error: 'Method not allowed' })
}

View File

@ -241,6 +241,7 @@ settings.sync.start=Start Synchronization
settings.sync.daysRange=From {{startDate}} to {{endDate}} ({{days}} days)
settings.sync.progress=Step {{current}} of {{total}}
settings.sync.completed=Everything is synchronized
settings.sync.ready=Ready to synchronize
settings.nip95.title=NIP-95 Upload Endpoints
settings.nip95.loading=Loading...
settings.nip95.error.loadFailed=Failed to load NIP-95 APIs

View File

@ -241,6 +241,7 @@ settings.sync.start=Démarrer la synchronisation
settings.sync.daysRange=Du {{startDate}} au {{endDate}} ({{days}} jours)
settings.sync.progress=Étape {{current}} sur {{total}}
settings.sync.completed=Tout est synchronisé
settings.sync.ready=Prêt à synchroniser
settings.language.title=Langue de préférence
settings.language.description=Choisissez votre langue préférée pour l'interface
settings.language.loading=Chargement...