feat: more settings

This commit is contained in:
Subarashimo
2025-12-03 09:19:03 +01:00
parent 32c2543605
commit f3c224a99a
13 changed files with 369 additions and 48 deletions
+15 -10
View File
@@ -4,6 +4,7 @@
*/
import { i18n } from '../../core/i18n.js';
import { extensionSettings } from '../../core/state.js';
/**
* Sets up desktop tab navigation for organizing content.
@@ -31,21 +32,25 @@ export function setupDesktopTabs() {
return;
}
// Create tab navigation
// Create tab navigation - conditionally show inventory and quests tabs based on settings
const inventoryTabHtml = extensionSettings.showInventory ? `
<button class="rpg-tab-btn" data-tab="inventory">
<i class="fa-solid fa-box"></i>
<span data-i18n-key="global.inventory">Inventory</span>
</button>` : '';
const questsTabHtml = extensionSettings.showQuests ? `
<button class="rpg-tab-btn" data-tab="quests">
<i class="fa-solid fa-scroll"></i>
<span data-i18n-key="global.quests">Quests</span>
</button>` : '';
const $tabNav = $(`
<div class="rpg-tabs-nav">
<button class="rpg-tab-btn active" data-tab="status">
<i class="fa-solid fa-chart-simple"></i>
<span data-i18n-key="global.status">Status</span>
</button>
<button class="rpg-tab-btn" data-tab="inventory">
<i class="fa-solid fa-box"></i>
<span data-i18n-key="global.inventory">Inventory</span>
</button>
<button class="rpg-tab-btn" data-tab="quests">
<i class="fa-solid fa-scroll"></i>
<span data-i18n-key="global.quests">Quests</span>
</button>
</button>${inventoryTabHtml}${questsTabHtml}
</div>
`);
+14 -5
View File
@@ -9,7 +9,8 @@ import {
$userStatsContainer,
$infoBoxContainer,
$thoughtsContainer,
$inventoryContainer
$inventoryContainer,
$questsContainer
} from '../../core/state.js';
import { i18n } from '../../core/i18n.js';
@@ -230,22 +231,30 @@ export function updateSectionVisibility() {
if ($inventoryContainer) {
$inventoryContainer.toggle(extensionSettings.showInventory);
}
if ($questsContainer) {
$questsContainer.toggle(extensionSettings.showQuests);
}
// Show/hide dividers intelligently
// Divider after User Stats: shown if User Stats is visible AND at least one section after it is visible
const showDividerAfterStats = extensionSettings.showUserStats &&
(extensionSettings.showInfoBox || extensionSettings.showCharacterThoughts || extensionSettings.showInventory);
(extensionSettings.showInfoBox || extensionSettings.showCharacterThoughts || extensionSettings.showInventory || extensionSettings.showQuests);
$('#rpg-divider-stats').toggle(showDividerAfterStats);
// Divider after Info Box: shown if Info Box is visible AND at least one section after it is visible
const showDividerAfterInfo = extensionSettings.showInfoBox &&
(extensionSettings.showCharacterThoughts || extensionSettings.showInventory);
(extensionSettings.showCharacterThoughts || extensionSettings.showInventory || extensionSettings.showQuests);
$('#rpg-divider-info').toggle(showDividerAfterInfo);
// Divider after Thoughts: shown if Thoughts is visible AND Inventory is visible
// Divider after Thoughts: shown if Thoughts is visible AND Inventory or Quests is visible
const showDividerAfterThoughts = extensionSettings.showCharacterThoughts &&
extensionSettings.showInventory;
(extensionSettings.showInventory || extensionSettings.showQuests);
$('#rpg-divider-thoughts').toggle(showDividerAfterThoughts);
// Divider after Inventory: shown if Inventory is visible AND Quests is visible
const showDividerAfterInventory = extensionSettings.showInventory &&
extensionSettings.showQuests;
$('#rpg-divider-inventory').toggle(showDividerAfterInventory);
}
/**