Remove site.webmanifest and refactor state initialization in RecipeManager and HeaderManager

- Deleted the site.webmanifest file as it is no longer needed.
- Simplified state management by removing initPageState from RecipeManager and integrating it into HeaderManager.
- Cleaned up console logging in loraApi.js to reduce unnecessary output.
- Minor formatting adjustments in FilterManager to enhance code readability.
This commit is contained in:
Will Miao
2025-03-21 05:22:20 +08:00
parent 34078d8a60
commit 644ee31654
5 changed files with 4 additions and 8 deletions

View File

@@ -1 +0,0 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}

View File

@@ -57,8 +57,6 @@ export async function loadMoreLoras(resetPage = false, updateFolders = false) {
} }
} }
console.log('Loading loras with params:', params.toString());
const response = await fetch(`/api/loras?${params}`); const response = await fetch(`/api/loras?${params}`);
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to fetch loras: ${response.statusText}`); throw new Error(`Failed to fetch loras: ${response.statusText}`);

View File

@@ -2,6 +2,7 @@ import { updateService } from '../managers/UpdateService.js';
import { toggleTheme } from '../utils/uiHelpers.js'; import { toggleTheme } from '../utils/uiHelpers.js';
import { SearchManager } from '../managers/SearchManager.js'; import { SearchManager } from '../managers/SearchManager.js';
import { FilterManager } from '../managers/FilterManager.js'; import { FilterManager } from '../managers/FilterManager.js';
import { initPageState } from '../state/index.js';
/** /**
* Header.js - Manages the application header behavior across different pages * Header.js - Manages the application header behavior across different pages
@@ -10,6 +11,7 @@ import { FilterManager } from '../managers/FilterManager.js';
export class HeaderManager { export class HeaderManager {
constructor() { constructor() {
this.currentPage = this.detectCurrentPage(); this.currentPage = this.detectCurrentPage();
initPageState(this.currentPage);
this.searchManager = null; this.searchManager = null;
this.filterManager = null; this.filterManager = null;

View File

@@ -359,7 +359,7 @@ export class FilterManager {
// Update state with loaded filters // Update state with loaded filters
const pageState = getCurrentPageState(); const pageState = getCurrentPageState();
pageState.filters = { ...this.filters }; pageState.filters = { ...this.filters };
this.updateTagSelections(); this.updateTagSelections();
this.updateActiveFiltersCount(); this.updateActiveFiltersCount();

View File

@@ -3,13 +3,10 @@ import { appCore } from './core.js';
import { ImportManager } from './managers/ImportManager.js'; import { ImportManager } from './managers/ImportManager.js';
import { RecipeCard } from './components/RecipeCard.js'; import { RecipeCard } from './components/RecipeCard.js';
import { RecipeModal } from './components/RecipeModal.js'; import { RecipeModal } from './components/RecipeModal.js';
import { state, getCurrentPageState, setCurrentPageType, initPageState } from './state/index.js'; import { getCurrentPageState } from './state/index.js';
class RecipeManager { class RecipeManager {
constructor() { constructor() {
// Initialize recipe page state
initPageState('recipes');
// Get page state // Get page state
this.pageState = getCurrentPageState(); this.pageState = getCurrentPageState();