diff --git a/static/js/managers/ImportManager.js b/static/js/managers/ImportManager.js index 18ef3432..0c4b156a 100644 --- a/static/js/managers/ImportManager.js +++ b/static/js/managers/ImportManager.js @@ -1,8 +1,6 @@ import { modalManager } from './ModalManager.js'; import { showToast } from '../utils/uiHelpers.js'; import { LoadingManager } from './LoadingManager.js'; -import { state } from '../state/index.js'; -import { resetAndReload } from '../api/loraApi.js'; export class ImportManager { constructor() { @@ -922,13 +920,7 @@ export class ImportManager { // Close modal and reload recipes modalManager.closeModal('importModal'); - // Refresh the recipe list if needed - if (typeof refreshRecipes === 'function') { - refreshRecipes(); - } else { - // Fallback to reloading the page - resetAndReload(); - } + window.recipeManager.loadRecipes(true); // true to reset pagination } else { // Handle error diff --git a/static/js/managers/SearchManager.js b/static/js/managers/SearchManager.js index d4d48f28..f0fc49af 100644 --- a/static/js/managers/SearchManager.js +++ b/static/js/managers/SearchManager.js @@ -308,7 +308,6 @@ export class SearchManager { // Call the appropriate manager's load method based on page type if (this.currentPage === 'recipes' && window.recipeManager) { - console.log("load recipes") window.recipeManager.loadRecipes(true); // true to reset pagination } else if (this.currentPage === 'loras' && window.loadMoreLoras) { // Reset loras page and reload diff --git a/static/js/recipes.js b/static/js/recipes.js index af7fcae1..ebee41f0 100644 --- a/static/js/recipes.js +++ b/static/js/recipes.js @@ -56,22 +56,7 @@ class RecipeManager { _exposeGlobalFunctions() { // Only expose what's needed for the page window.recipeManager = this; - window.importRecipes = () => this.importRecipes(); window.importManager = this.importManager; - - // Deprecated - kept for backwards compatibility - window.loadMoreRecipes = () => { - console.warn('loadMoreRecipes is deprecated, use infiniteScroll instead'); - this.pageState.currentPage++; - this.loadRecipes(false); - }; - - // Add appendRecipeCards function for compatibility - window.appendRecipeCards = (recipes) => { - console.warn('appendRecipeCards is deprecated, use recipeManager.updateRecipesGrid instead'); - const data = { items: recipes, has_more: false }; - this.updateRecipesGrid(data, false); - }; } initEventListeners() { @@ -140,6 +125,8 @@ class RecipeManager { } const data = await response.json(); + + console.log('Recipes data:', data); // Update recipes grid this.updateRecipesGrid(data, resetPage); @@ -205,11 +192,6 @@ class RecipeManager { showRecipeDetails(recipe) { this.recipeModal.showRecipeDetails(recipe); } - - // Add a method to handle recipe import - importRecipes() { - this.importManager.showImportModal(); - } } // Initialize components diff --git a/templates/recipes.html b/templates/recipes.html index 451ac97e..07d9360f 100644 --- a/templates/recipes.html +++ b/templates/recipes.html @@ -27,7 +27,7 @@
- +