mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-24 22:52:12 -03:00
Refactor panel position management and enhance recipe card handling
- Removed redundant updatePanelPositions calls from various components and centralized the logic in the uiHelpers.js for better maintainability. - Introduced appendRecipeCards function in RecipeManager to streamline the addition of recipe cards from search results. - Cleaned up unused code related to search input handling and recipe loading, improving overall code clarity and performance. - Updated HeaderManager and SearchManager to utilize the new updatePanelPositions function, ensuring consistent panel positioning across the application.
This commit is contained in:
@@ -59,6 +59,12 @@ class RecipeManager {
|
||||
window.importRecipes = () => this.importRecipes();
|
||||
window.importManager = this.importManager;
|
||||
window.loadMoreRecipes = () => this.loadMoreRecipes();
|
||||
|
||||
// Add appendRecipeCards function for the search manager to use
|
||||
window.appendRecipeCards = (recipes) => {
|
||||
const data = { items: recipes, has_more: false };
|
||||
this.updateRecipesGrid(data, false);
|
||||
};
|
||||
}
|
||||
|
||||
initEventListeners() {
|
||||
@@ -70,28 +76,6 @@ class RecipeManager {
|
||||
this.loadRecipes();
|
||||
});
|
||||
}
|
||||
|
||||
// Search input
|
||||
const searchInput = document.getElementById('searchInput');
|
||||
if (searchInput) {
|
||||
let debounceTimeout;
|
||||
searchInput.addEventListener('input', () => {
|
||||
clearTimeout(debounceTimeout);
|
||||
debounceTimeout = setTimeout(() => {
|
||||
this.pageState.filters.search = searchInput.value;
|
||||
this.loadRecipes();
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
|
||||
// Import button
|
||||
const importButton = document.querySelector('button[onclick="importRecipes()"]');
|
||||
if (importButton) {
|
||||
importButton.onclick = (e) => {
|
||||
e.preventDefault();
|
||||
this.importManager.showImportModal();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async loadRecipes(resetPage = true) {
|
||||
|
||||
Reference in New Issue
Block a user