@@ -389,7 +389,11 @@ document.addEventListener('alpine:init', () => { Alpine.data('mainApp', () => ({
389389 } ,
390390
391391 getNoteSyncStatus ( note ) {
392- return this . noteSyncStatus [ note . id ] || { status : 'idle' , updatedAt : note . updatedAt } ;
392+ if ( this . noteSyncStatus [ note . id ] ) {
393+ return this . noteSyncStatus [ note . id ] ;
394+ }
395+ const hasSynced = this . lastSync && ( new Date ( note . updatedAt ) <= new Date ( this . lastSync ) ) ;
396+ return { status : hasSynced ? 'ok' : 'idle' , updatedAt : note . updatedAt } ;
393397 } ,
394398
395399 getNoteSyncIconClass ( status ) {
@@ -423,17 +427,17 @@ document.addEventListener('alpine:init', () => { Alpine.data('mainApp', () => ({
423427 getProviderIcon ( provider ) {
424428 switch ( provider ) {
425429 case 's3' :
426- return `<svg class="w-3.5 h-3.5 " viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="12" cy="5" rx="9" ry="3"></ellipse><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path><path d="M3 12c0 1.66 4 3 9 3s9-1.34 9-3"></path></svg>` ;
430+ return `<svg class="w-3 h-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="12" cy="5" rx="9" ry="3"></ellipse><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path><path d="M3 12c0 1.66 4 3 9 3s9-1.34 9-3"></path></svg>` ;
427431 case 'gdrive' :
428- return `<svg class="w-3.5 h-3.5 " viewBox="0 0 24 24" fill="currentColor"><path d="M8.2 14.28L4.36 21H12.2l3.84-6.72H8.2zm14.1-1.74l-3.84-6.72H10.6l3.84 6.72h7.86zm-5.63.87l-3.84-6.72L5 13.41l3.84 6.72 7.83-6.72z" /></svg>` ;
432+ return `<svg class="w-3 h-3" viewBox="0 0 24 24" fill="currentColor"><path d="M8.2 14.28L4.36 21H12.2l3.84-6.72H8.2zm14.1-1.74l-3.84-6.72H10.6l3.84 6.72h7.86zm-5.63.87l-3.84-6.72L5 13.41l3.84 6.72 7.83-6.72z" /></svg>` ;
429433 case 'git' :
430- return `<svg class="w-3.5 h-3.5 " viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="6" y1="3" x2="6" y2="15"></line><circle cx="18" cy="6" r="3"></circle><circle cx="6" cy="18" r="3"></circle><path d="M18 9a9 9 0 0 1-9 9"></path><circle cx="6" cy="6" r="3"></circle></svg>` ;
434+ return `<svg class="w-3 h-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="6" y1="3" x2="6" y2="15"></line><circle cx="18" cy="6" r="3"></circle><circle cx="6" cy="18" r="3"></circle><path d="M18 9a9 9 0 0 1-9 9"></path><circle cx="6" cy="6" r="3"></circle></svg>` ;
431435 case 'ipfs' :
432- return `<svg class="w-3.5 h-3.5 " viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2L2 7v10l10 5 10-5V7L12 2z"></path><path d="M12 22V12"></path><path d="M12 12L2 7"></path><path d="M12 12l10-5"></path></svg>` ;
436+ return `<svg class="w-3 h-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2L2 7v10l10 5 10-5V7L12 2z"></path><path d="M12 22V12"></path><path d="M12 12L2 7"></path><path d="M12 12l10-5"></path></svg>` ;
433437 case 'nostr' :
434- return `<svg class="w-3.5 h-3.5 " viewBox="0 0 24 24" fill="currentColor"><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" /></svg>` ;
438+ return `<svg class="w-3 h-3" viewBox="0 0 24 24" fill="currentColor"><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" /></svg>` ;
435439 default :
436- return `<svg class="w-3.5 h-3.5 " viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="10" /></svg>` ;
440+ return `<svg class="w-3 h-3" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="10" /></svg>` ;
437441 }
438442 } ,
439443
@@ -470,11 +474,14 @@ document.addEventListener('alpine:init', () => { Alpine.data('mainApp', () => ({
470474
471475 if ( ! allStatus ) {
472476 allStatus = { } ;
473- if ( this . s3Bucket ) allStatus . s3 = { status : 'idle' } ;
474- if ( this . gdriveStore && this . gdriveStore . connected ) allStatus . gdrive = { status : 'idle' } ;
475- if ( this . gitRepoUrl ) allStatus . git = { status : 'idle' } ;
476- if ( this . useDirectIpfs || this . pinataJwt || this . pinataApiKey ) allStatus . ipfs = { status : 'idle' } ;
477- if ( this . nostrPrivateKey ) allStatus . nostr = { status : 'idle' } ;
477+ const hasSynced = this . lastSync && ( new Date ( note . updatedAt ) <= new Date ( this . lastSync ) ) ;
478+ const defaultStatus = hasSynced ? 'ok' : 'idle' ;
479+
480+ if ( this . s3Bucket ) allStatus . s3 = { status : defaultStatus } ;
481+ if ( this . gdriveStore && this . gdriveStore . connected ) allStatus . gdrive = { status : defaultStatus } ;
482+ if ( this . gitRepoUrl ) allStatus . git = { status : defaultStatus } ;
483+ if ( this . useDirectIpfs || this . pinataJwt || this . pinataApiKey ) allStatus . ipfs = { status : defaultStatus } ;
484+ if ( this . nostrPrivateKey ) allStatus . nostr = { status : defaultStatus } ;
478485 return allStatus ;
479486 }
480487
0 commit comments