mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-22 13:42:12 -03:00
- Added ServerI18nManager to handle translations and locale settings on the server. - Integrated server-side translations into templates, reducing language flashing on initial load. - Created API endpoints for setting and getting user language preferences. - Enhanced client-side i18n handling to work seamlessly with server-rendered content. - Updated various templates to utilize the new translation system. - Added mixed i18n handler to coordinate server and client translations, improving user experience. - Expanded translation files to include initialization messages for various components.
159 lines
7.4 KiB
HTML
159 lines
7.4 KiB
HTML
<header class="app-header">
|
|
<div class="header-container">
|
|
<div class="header-branding">
|
|
<a href="/loras" class="logo-link">
|
|
<img src="/loras_static/images/favicon-32x32.png" alt="LoRA Manager" class="app-logo">
|
|
<span class="app-title">{{ t('header.appTitle') }}</span>
|
|
</a>
|
|
</div>
|
|
<nav class="main-nav">
|
|
<a href="/loras" class="nav-item" id="lorasNavItem">
|
|
<i class="fas fa-layer-group"></i> <span>{{ t('header.navigation.loras') }}</span>
|
|
</a>
|
|
<a href="/loras/recipes" class="nav-item" id="recipesNavItem">
|
|
<i class="fas fa-book-open"></i> <span>{{ t('header.navigation.recipes') }}</span>
|
|
</a>
|
|
<a href="/checkpoints" class="nav-item" id="checkpointsNavItem">
|
|
<i class="fas fa-check-circle"></i> <span>{{ t('header.navigation.checkpoints') }}</span>
|
|
</a>
|
|
<a href="/embeddings" class="nav-item" id="embeddingsNavItem">
|
|
<i class="fas fa-code"></i> <span>{{ t('header.navigation.embeddings') }}</span>
|
|
</a>
|
|
<a href="/statistics" class="nav-item" id="statisticsNavItem">
|
|
<i class="fas fa-chart-bar"></i> <span>{{ t('header.navigation.statistics') }}</span>
|
|
</a>
|
|
</nav>
|
|
|
|
<!-- Context-aware search container -->
|
|
<div class="header-search" id="headerSearch">
|
|
<div class="search-container">
|
|
<input type="text" id="searchInput" placeholder="{{ t('header.search.placeholder') }}" />
|
|
<i class="fas fa-search search-icon"></i>
|
|
<button class="search-options-toggle" id="searchOptionsToggle" title="{{ t('header.search.options') }}">
|
|
<i class="fas fa-sliders-h"></i>
|
|
</button>
|
|
<button class="search-filter-toggle" id="filterButton" title="{{ t('header.filter.title') }}">
|
|
<i class="fas fa-filter"></i>
|
|
<span class="filter-badge" id="activeFiltersCount" style="display: none">0</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="header-actions">
|
|
<!-- Integrated corner controls -->
|
|
<div class="header-controls">
|
|
<div class="theme-toggle" data-i18n="header.theme.toggle" data-i18n-target="title" title="Toggle theme">
|
|
<i class="fas fa-moon dark-icon"></i>
|
|
<i class="fas fa-sun light-icon"></i>
|
|
<i class="fas fa-adjust auto-icon"></i>
|
|
</div>
|
|
<div class="settings-toggle" title="Settings">
|
|
<i class="fas fa-cog"></i>
|
|
</div>
|
|
<div class="help-toggle" id="helpToggleBtn" title="Help & Tutorials">
|
|
<i class="fas fa-question-circle"></i>
|
|
<span class="update-badge"></span>
|
|
</div>
|
|
<div class="update-toggle" id="updateToggleBtn" title="Check Updates">
|
|
<i class="fas fa-bell"></i>
|
|
<span class="update-badge"></span>
|
|
</div>
|
|
<div class="support-toggle" id="supportToggleBtn" title="Support">
|
|
<i class="fas fa-heart"></i>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Add search options panel with context-aware options -->
|
|
<div id="searchOptionsPanel" class="search-options-panel hidden">
|
|
<div class="options-header">
|
|
<h3>{{ t('header.search.options') }}</h3>
|
|
<button class="close-options-btn" id="closeSearchOptions">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
</div>
|
|
<div class="options-section">
|
|
<h4>{{ t('header.search.searchIn') }}</h4>
|
|
<div class="search-option-tags">
|
|
{% if request.path == '/loras/recipes' %}
|
|
<div class="search-option-tag active" data-option="title">{{ t('header.search.filters.title') }}</div>
|
|
<div class="search-option-tag active" data-option="tags">{{ t('header.search.filters.tags') }}</div>
|
|
<div class="search-option-tag active" data-option="loraName">{{ t('header.search.filters.loraName') }}</div>
|
|
<div class="search-option-tag active" data-option="loraModel">{{ t('header.search.filters.loraModel') }}</div>
|
|
{% elif request.path == '/checkpoints' %}
|
|
<div class="search-option-tag active" data-option="filename">{{ t('header.search.filters.filename') }}</div>
|
|
<div class="search-option-tag active" data-option="modelname">{{ t('header.search.filters.modelname') }}</div>
|
|
<div class="search-option-tag active" data-option="tags">{{ t('header.search.filters.tags') }}</div>
|
|
<div class="search-option-tag" data-option="creator">{{ t('header.search.filters.creator') }}</div>
|
|
{% elif request.path == '/embeddings' %}
|
|
<div class="search-option-tag active" data-option="filename">{{ t('header.search.filters.filename') }}</div>
|
|
<div class="search-option-tag active" data-option="modelname">{{ t('header.search.filters.modelname') }}</div>
|
|
<div class="search-option-tag active" data-option="tags">{{ t('header.search.filters.tags') }}</div>
|
|
<div class="search-option-tag" data-option="creator">{{ t('header.search.filters.creator') }}</div>
|
|
{% else %}
|
|
<!-- Default options for LoRAs page -->
|
|
<div class="search-option-tag active" data-option="filename">{{ t('header.search.filters.filename') }}</div>
|
|
<div class="search-option-tag active" data-option="modelname">{{ t('header.search.filters.modelname') }}</div>
|
|
<div class="search-option-tag active" data-option="tags">{{ t('header.search.filters.tags') }}</div>
|
|
<div class="search-option-tag" data-option="creator">{{ t('header.search.filters.creator') }}</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add filter panel -->
|
|
<div id="filterPanel" class="filter-panel hidden">
|
|
<div class="filter-header">
|
|
<h3>{{ t('header.filter.title') }}</h3>
|
|
<button class="close-filter-btn" onclick="filterManager.closeFilterPanel()">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
</div>
|
|
<div class="filter-section">
|
|
<h4>{{ t('header.filter.baseModel') }}</h4>
|
|
<div class="filter-tags" id="baseModelTags">
|
|
<!-- Tags will be dynamically inserted here -->
|
|
</div>
|
|
</div>
|
|
<div class="filter-section">
|
|
<h4>{{ t('header.filter.modelTags') }}</h4>
|
|
<div class="filter-tags" id="modelTagsFilter">
|
|
<!-- Top tags will be dynamically inserted here -->
|
|
<div class="tags-loading">{{ t('common.status.loading') }}</div>
|
|
</div>
|
|
</div>
|
|
<div class="filter-actions">
|
|
<button class="clear-filters-btn" onclick="filterManager.clearFilters()">
|
|
{{ t('header.filter.clearAll') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Header JavaScript will be handled by the HeaderManager in Header.js -->
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Get the current path from the URL
|
|
const currentPath = window.location.pathname;
|
|
|
|
// Update active nav item (i18n is handled by the HeaderManager)
|
|
const lorasNavItem = document.getElementById('lorasNavItem');
|
|
const recipesNavItem = document.getElementById('recipesNavItem');
|
|
const checkpointsNavItem = document.getElementById('checkpointsNavItem');
|
|
const embeddingsNavItem = document.getElementById('embeddingsNavItem');
|
|
const statisticsNavItem = document.getElementById('statisticsNavItem');
|
|
|
|
if (currentPath === '/loras') {
|
|
lorasNavItem.classList.add('active');
|
|
} else if (currentPath === '/loras/recipes') {
|
|
recipesNavItem.classList.add('active');
|
|
} else if (currentPath === '/checkpoints') {
|
|
checkpointsNavItem.classList.add('active');
|
|
} else if (currentPath === '/embeddings') {
|
|
embeddingsNavItem.classList.add('active');
|
|
} else if (currentPath === '/statistics') {
|
|
statisticsNavItem.classList.add('active');
|
|
}
|
|
});
|
|
</script> |