Fix strip refresh button visibility based on generation mode
This commit is contained in:
@@ -35,6 +35,7 @@ import { renderMusicPlayer } from '../rendering/musicPlayer.js';
|
||||
import { i18n } from '../../core/i18n.js';
|
||||
import { generateAvatarsForCharacters } from '../features/avatarGenerator.js';
|
||||
import { setFabLoadingState, updateFabWidgets } from '../ui/mobile.js';
|
||||
import { updateStripWidgets } from '../ui/desktop.js';
|
||||
|
||||
// Store the original preset name to restore after tracker generation
|
||||
let originalPresetName = null;
|
||||
@@ -240,8 +241,10 @@ export async function updateRPGData(renderUserStats, renderInfoBox, renderThough
|
||||
|
||||
// Update button to show "Updating..." state
|
||||
const $updateBtn = $('#rpg-manual-update');
|
||||
const $stripRefreshBtn = $('#rpg-strip-refresh');
|
||||
const updatingText = i18n.getTranslation('template.mainPanel.updating') || 'Updating...';
|
||||
$updateBtn.html(`<i class="fa-solid fa-spinner fa-spin"></i> ${updatingText}`).prop('disabled', true);
|
||||
$stripRefreshBtn.html('<i class="fa-solid fa-spinner fa-spin"></i>').prop('disabled', true);
|
||||
|
||||
const prompt = await generateSeparateUpdatePrompt();
|
||||
|
||||
@@ -380,11 +383,14 @@ export async function updateRPGData(renderUserStats, renderInfoBox, renderThough
|
||||
setIsGenerating(false);
|
||||
setFabLoadingState(false); // Stop spinning FAB on mobile
|
||||
updateFabWidgets(); // Update FAB widgets with new data
|
||||
updateStripWidgets(); // Update strip widgets with new data
|
||||
|
||||
// Restore button to original state
|
||||
const $updateBtn = $('#rpg-manual-update');
|
||||
const $stripRefreshBtn = $('#rpg-strip-refresh');
|
||||
const refreshText = i18n.getTranslation('template.mainPanel.refreshRpgInfo') || 'Refresh RPG Info';
|
||||
$updateBtn.html(`<i class="fa-solid fa-sync"></i> ${refreshText}`).prop('disabled', false);
|
||||
$stripRefreshBtn.html('<i class="fa-solid fa-sync"></i>').prop('disabled', false);
|
||||
|
||||
// Reset the flag after tracker generation completes
|
||||
// This ensures the flag persists through both main generation AND tracker generation
|
||||
|
||||
@@ -434,6 +434,7 @@ export function updateGenerationModeUI() {
|
||||
if (extensionSettings.generationMode === 'together') {
|
||||
// In "together" mode, manual update button is hidden
|
||||
$('#rpg-manual-update').hide();
|
||||
$('#rpg-strip-refresh').hide();
|
||||
$('#rpg-external-api-settings').slideUp(200);
|
||||
$('#rpg-separate-mode-settings').slideUp(200);
|
||||
// Hide auto-update toggle (not applicable in together mode)
|
||||
@@ -441,6 +442,7 @@ export function updateGenerationModeUI() {
|
||||
} else if (extensionSettings.generationMode === 'separate') {
|
||||
// In "separate" mode, manual update button is visible
|
||||
$('#rpg-manual-update').show();
|
||||
$('#rpg-strip-refresh').show();
|
||||
$('#rpg-external-api-settings').slideUp(200);
|
||||
$('#rpg-separate-mode-settings').slideDown(200);
|
||||
// Show auto-update toggle
|
||||
@@ -448,6 +450,7 @@ export function updateGenerationModeUI() {
|
||||
} else if (extensionSettings.generationMode === 'external') {
|
||||
// In "external" mode, manual update button is visible AND both settings are shown
|
||||
$('#rpg-manual-update').show();
|
||||
$('#rpg-strip-refresh').show();
|
||||
$('#rpg-external-api-settings').slideDown(200);
|
||||
$('#rpg-separate-mode-settings').slideDown(200);
|
||||
// Show auto-update toggle for external mode too
|
||||
|
||||
Reference in New Issue
Block a user