diff --git a/src/admin/AdminOutdatedClient.tsx b/src/admin/AdminOutdatedClient.tsx index 85e017ae..1c2ea4e0 100644 --- a/src/admin/AdminOutdatedClient.tsx +++ b/src/admin/AdminOutdatedClient.tsx @@ -22,6 +22,8 @@ export default function AdminOutdatedClient({ }) { const [photoIdsSyncing, setPhotoIdsSyncing] = useState([]); + const arePhotoIdsSyncing = photoIdsSyncing.length > 0; + const router = useRouter(); return ( @@ -41,8 +43,10 @@ export default function AdminOutdatedClient({ hideTextOnMobile={false} className="primary" onClick={async () => { - // eslint-disable-next-line max-len - if (window.confirm(`Are you sure you want to sync the oldest ${UPDATE_BATCH_SIZE} photos? This action cannot be undone.`)) { + if (window.confirm( + // eslint-disable-next-line max-len + `Are you sure you want to sync the oldest ${UPDATE_BATCH_SIZE} photos? This action cannot be undone.` + )) { const photosToSync = photos .slice(0, UPDATE_BATCH_SIZE) .map(photo => photo.id); @@ -54,13 +58,18 @@ export default function AdminOutdatedClient({ }); } }} + isLoading={arePhotoIdsSyncing} > - - Sync {UPDATE_BATCH_SIZE} Oldest Photos - - - Sync {UPDATE_BATCH_SIZE} Oldest - + {arePhotoIdsSyncing + ? 'Syncing' + : <> + + Sync {UPDATE_BATCH_SIZE} Oldest Photos + + + Sync {UPDATE_BATCH_SIZE} Oldest + + } } >