fix: add spinner animation to mobile refresh FAB button

The spinning animation when refreshing existed but only worked on
the desktop button. Mobile FAB was never updated with the spinner.

Changes:
- Update both desktop and mobile buttons when refresh starts
- Desktop shows: spinner + 'Updating...' text
- Mobile FAB shows: spinner icon only (no text)
- Both buttons restore properly when done

Now mobile users see the spinner animation when tapping refresh!
This commit is contained in:
Lucas 'Paperboy' Rose-Winters
2025-10-22 10:34:31 +11:00
parent e2393fa73c
commit 9a49433a28
+11 -2
View File
@@ -97,11 +97,16 @@ export async function updateRPGData(renderUserStats, renderInfoBox, renderThough
try { try {
setIsGenerating(true); setIsGenerating(true);
// Update button to show "Updating..." state // Update desktop button to show "Updating..." state
const $updateBtn = $('#rpg-manual-update'); const $updateBtn = $('#rpg-manual-update');
const originalHtml = $updateBtn.html(); const originalHtml = $updateBtn.html();
$updateBtn.html('<i class="fa-solid fa-spinner fa-spin"></i> Updating...').prop('disabled', true); $updateBtn.html('<i class="fa-solid fa-spinner fa-spin"></i> Updating...').prop('disabled', true);
// Update mobile FAB to show spinner (icon only)
const $updateBtnMobile = $('#rpg-manual-update-mobile');
const originalHtmlMobile = $updateBtnMobile.html();
$updateBtnMobile.html('<i class="fa-solid fa-spinner fa-spin"></i>').prop('disabled', true);
// Save current preset name before switching (if we're going to switch) // Save current preset name before switching (if we're going to switch)
if (extensionSettings.useSeparatePreset) { if (extensionSettings.useSeparatePreset) {
originalPresetName = await getCurrentPresetName(); originalPresetName = await getCurrentPresetName();
@@ -219,10 +224,14 @@ export async function updateRPGData(renderUserStats, renderInfoBox, renderThough
setIsGenerating(false); setIsGenerating(false);
// Restore button to original state // Restore desktop button to original state
const $updateBtn = $('#rpg-manual-update'); const $updateBtn = $('#rpg-manual-update');
$updateBtn.html('<i class="fa-solid fa-sync"></i> Refresh RPG Info').prop('disabled', false); $updateBtn.html('<i class="fa-solid fa-sync"></i> Refresh RPG Info').prop('disabled', false);
// Restore mobile FAB to original state (icon only)
const $updateBtnMobile = $('#rpg-manual-update-mobile');
$updateBtnMobile.html('<i class="fa-solid fa-sync"></i>').prop('disabled', false);
// Reset the flag after tracker generation completes // Reset the flag after tracker generation completes
// This ensures the flag persists through both main generation AND tracker generation // This ensures the flag persists through both main generation AND tracker generation
// console.log('[RPG Companion] 🔄 Tracker generation complete - resetting lastActionWasSwipe to false'); // console.log('[RPG Companion] 🔄 Tracker generation complete - resetting lastActionWasSwipe to false');