feat: ajout de la recherche de chapitres dans le store Manga et mise à jour de l'API pour récupérer les chapitres, ainsi que des ajustements dans la configuration de Tailwind et la suppression de l'entrée React dans Webpack.

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-04-03 16:55:48 +02:00
parent b187f3e153
commit e51712a800
8 changed files with 65 additions and 58 deletions

View File

@@ -1,4 +1,3 @@
import { registerReactControllerComponents } from '@symfony/ux-react';
import './bootstrap.js';
import '@fortawesome/fontawesome-free/js/all.js';
@@ -15,4 +14,4 @@ import './styles/app.scss';
// start the Stimulus application
import './bootstrap';
//registerReactControllerComponents(require.context('./react/controllers', true, /\.(j|t)sx?$/));
// La ligne registerReactControllerComponents a déjà été commentée

View File

@@ -128,6 +128,19 @@ export const useMangaStore = defineStore('manga', {
} finally {
this.addingManga = false;
}
},
// --- Chapter Actions ---
async searchChapter(chapterId) {
try {
await mangaRepository.searchChapter(chapterId);
// Rafraîchir la collection après la recherche
await this.refreshCollectionInBackground();
return true;
} catch (error) {
console.error('Erreur lors de la recherche du chapitre:', error);
return false;
}
}
}
});

View File

@@ -119,4 +119,23 @@ export class ApiMangaRepository {
throw error;
}
}
async searchChapter(chapterId) {
try {
const response = await fetch('https://localhost/api/scraping/chapters', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ chapterId })
});
if (!response.ok) {
throw new Error('Échec de la recherche du chapitre');
}
return await response.json();
} catch (error) {
console.error('API Error:', error);
throw error;
}
}
}

View File

@@ -52,8 +52,11 @@
const store = useMangaStore();
const handleSearch = async () => {
// TODO: Implémenter la recherche de chapitre
console.log('Recherche du chapitre:', props.chapter.id);
try {
await store.searchChapter(props.chapter.id);
} catch (error) {
console.error('Erreur lors de la recherche du chapitre:', error);
}
};
const handleDelete = async () => {

View File

@@ -1,10 +1,6 @@
<template>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 p-6">
<MangaCard
v-for="manga in mangas"
:key="manga.id"
:manga="manga"
/>
<MangaCard v-for="manga in mangas" :key="manga.id" :manga="manga" />
</div>
</template>

View File

@@ -4,15 +4,6 @@ controllers:
namespace: App\Controller
type: attribute
react_app:
path: /react/{req}
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController
defaults:
template: 'react/index.html.twig'
req: ''
requirements:
req: ".*"
vue_app:
path: /vue/{req}
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController

View File

@@ -3,18 +3,14 @@ module.exports = {
content: [
'./templates/**/*.html.twig',
'./assets/react/**/*.{js,jsx}',
'./assets/**/*.{js,jsx}'
'./assets/**/*.{js,jsx}',
'./assets/vue/**/*.{js,vue}'
],
theme: {
extend: {},
extend: {}
},
plugins: [
// require("daisyui"),
],
safelist: [
'bg-red-500',
'bg-blue-500',
'bg-yellow-500',
'bg-green-500',
],
}
safelist: ['bg-red-500', 'bg-blue-500', 'bg-yellow-500', 'bg-green-500']
};

View File

@@ -21,7 +21,6 @@ Encore
* and one CSS file (e.g. app.css) if your JavaScript imports CSS.
*/
.addEntry('app', './assets/app.js')
.addEntry('react-app', './assets/react/app/index.jsx')
.addEntry('vue-app', './assets/vue/app/index.js')
// .addEntry('alpine', 'alpinejs')
@@ -31,7 +30,6 @@ Encore
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks()
.enableReactPreset()
.enableVueLoader()
// will require an extra script tag for runtime.js
@@ -57,7 +55,7 @@ Encore
// })
// enables and configure @babel/preset-env polyfills
.configureBabelPresetEnv((config) => {
.configureBabelPresetEnv(config => {
config.useBuiltIns = 'usage';
config.corejs = '3.23';
})
@@ -68,17 +66,9 @@ Encore
// uncomment if you use TypeScript
//.enableTypeScriptLoader()
// uncomment if you use React
//.enableReactPreset()
// uncomment to get integrity="..." attributes on your script & link tags
// requires WebpackEncoreBundle 1.4 or higher
//.enableIntegrityHashes(Encore.isProduction())
// uncomment if you're having problems with a jQuery plugin
//.autoProvidejQuery()
.enablePostCssLoader()
;
.enablePostCssLoader();
module.exports = Encore.getWebpackConfig();