- début refonte graphique
- début MangaDbProvider
This commit is contained in:
@@ -10,5 +10,3 @@ import './styles/app.scss';
|
||||
|
||||
// start the Stimulus application
|
||||
import './bootstrap';
|
||||
|
||||
import 'tw-elements';
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
@import "tailwindcss/utilities";
|
||||
|
||||
body {
|
||||
background-color: lightgray;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
|
||||
39
migrations/Version20240604185153.php
Normal file
39
migrations/Version20240604185153.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20240604185153 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE manga ADD image_url VARCHAR(255) DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE manga ADD publication_year INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE manga ADD description TEXT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE manga ADD genres TEXT DEFAULT NULL');
|
||||
$this->addSql('COMMENT ON COLUMN manga.genres IS \'(DC2Type:array)\'');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('CREATE SCHEMA public');
|
||||
$this->addSql('ALTER TABLE manga DROP image_url');
|
||||
$this->addSql('ALTER TABLE manga DROP publication_year');
|
||||
$this->addSql('ALTER TABLE manga DROP description');
|
||||
$this->addSql('ALTER TABLE manga DROP genres');
|
||||
}
|
||||
}
|
||||
211
package-lock.json
generated
211
package-lock.json
generated
@@ -9,8 +9,7 @@
|
||||
"alpinejs": "^3.13.3",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"postcss-loader": "^7.1.0",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"tw-elements": "^1.0.0-beta1"
|
||||
"tailwindcss": "^3.2.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.17.0",
|
||||
@@ -2028,15 +2027,6 @@
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@popperjs/core": {
|
||||
"version": "2.11.8",
|
||||
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",
|
||||
"integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/popperjs"
|
||||
}
|
||||
},
|
||||
"node_modules/@sinclair/typebox": {
|
||||
"version": "0.27.8",
|
||||
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
|
||||
@@ -3382,19 +3372,6 @@
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/chart.js": {
|
||||
"version": "3.9.1",
|
||||
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-3.9.1.tgz",
|
||||
"integrity": "sha512-Ro2JbLmvg83gXF5F4sniaQ+lTbSv18E+TIf2cOeiH1Iqd2PGFOtem+DUufMZsCJwFE7ywPOpfXFBwRTGq7dh6w=="
|
||||
},
|
||||
"node_modules/chartjs-plugin-datalabels": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/chartjs-plugin-datalabels/-/chartjs-plugin-datalabels-2.2.0.tgz",
|
||||
"integrity": "sha512-14ZU30lH7n89oq+A4bWaJPnAG8a7ZTk7dKf48YAzMvJjQtjrgg5Dpk9f+LbjCF6bpx3RAGTeL13IXpKQYyRvlw==",
|
||||
"peerDependencies": {
|
||||
"chart.js": ">=3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/chokidar": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
||||
@@ -4031,11 +4008,6 @@
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/custom-event-polyfill": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/custom-event-polyfill/-/custom-event-polyfill-1.0.7.tgz",
|
||||
"integrity": "sha512-TDDkd5DkaZxZFM8p+1I3yAlvM3rSr1wbrOliG4yJiwinMZN8z/iGL7BTlDkrJcYTmgUSb4ywVCc3ZaUtOtC76w=="
|
||||
},
|
||||
"node_modules/daisyui": {
|
||||
"version": "4.11.1",
|
||||
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.11.1.tgz",
|
||||
@@ -4072,14 +4044,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/deepmerge": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
|
||||
"integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/default-gateway": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz",
|
||||
@@ -4155,14 +4119,6 @@
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/detect-autofill": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/detect-autofill/-/detect-autofill-1.1.4.tgz",
|
||||
"integrity": "sha512-utCBQwCR/beSnADQmBC7C4tTueBBkYCl6WSpfGUkYKO/+MzPxqYGj6G4MvHzcKmH1gCTK+VunX2vaagvkRXPvA==",
|
||||
"dependencies": {
|
||||
"custom-event-polyfill": "^1.0.7"
|
||||
}
|
||||
},
|
||||
"node_modules/detect-node": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",
|
||||
@@ -6433,11 +6389,6 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/perfect-scrollbar": {
|
||||
"version": "1.5.5",
|
||||
"resolved": "https://registry.npmjs.org/perfect-scrollbar/-/perfect-scrollbar-1.5.5.tgz",
|
||||
"integrity": "sha512-dzalfutyP3e/FOpdlhVryN4AJ5XDVauVWxybSkLZmakFE2sS3y3pc4JnSprw8tGmHvkaG5Edr5T7LBTZ+WWU2g=="
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz",
|
||||
@@ -7288,17 +7239,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/quick-lru": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",
|
||||
"integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/randombytes": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
|
||||
@@ -8582,155 +8522,6 @@
|
||||
"resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
|
||||
"integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="
|
||||
},
|
||||
"node_modules/tw-elements": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/tw-elements/-/tw-elements-1.1.0.tgz",
|
||||
"integrity": "sha512-IUr9YW2l99oTVZxuVjQg6rpuCpo6VZqbaKGYmZUNVVsoSVU/ljPpkJAY2Pn/morlXwKPhP9MTPNQMlWosqHL4w==",
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.6.0",
|
||||
"chart.js": "^3.7.1",
|
||||
"chartjs-plugin-datalabels": "^2.0.0",
|
||||
"deepmerge": "^4.2.2",
|
||||
"detect-autofill": "^1.1.3",
|
||||
"perfect-scrollbar": "^1.5.5",
|
||||
"tailwindcss": "3.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tw-elements/node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
|
||||
},
|
||||
"node_modules/tw-elements/node_modules/glob-parent": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
|
||||
"integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
|
||||
"dependencies": {
|
||||
"is-glob": "^4.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tw-elements/node_modules/lilconfig": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz",
|
||||
"integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/tw-elements/node_modules/postcss-import": {
|
||||
"version": "14.1.0",
|
||||
"resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-14.1.0.tgz",
|
||||
"integrity": "sha512-flwI+Vgm4SElObFVPpTIT7SU7R3qk2L7PyduMcokiaVKuWv9d/U+Gm/QAd8NDLuykTWTkcrjOeD2Pp1rMeBTGw==",
|
||||
"dependencies": {
|
||||
"postcss-value-parser": "^4.0.0",
|
||||
"read-cache": "^1.0.0",
|
||||
"resolve": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tw-elements/node_modules/postcss-load-config": {
|
||||
"version": "3.1.4",
|
||||
"resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-3.1.4.tgz",
|
||||
"integrity": "sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==",
|
||||
"dependencies": {
|
||||
"lilconfig": "^2.0.5",
|
||||
"yaml": "^1.10.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"postcss": ">=8.0.9",
|
||||
"ts-node": ">=9.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"postcss": {
|
||||
"optional": true
|
||||
},
|
||||
"ts-node": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/tw-elements/node_modules/postcss-nested": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.0.0.tgz",
|
||||
"integrity": "sha512-0DkamqrPcmkBDsLn+vQDIrtkSbNkv5AD/M322ySo9kqFkCIYklym2xEmWkwo+Y3/qZo34tzEPNUw4y7yMCdv5w==",
|
||||
"dependencies": {
|
||||
"postcss-selector-parser": "^6.0.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.2.14"
|
||||
}
|
||||
},
|
||||
"node_modules/tw-elements/node_modules/tailwindcss": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.0.tgz",
|
||||
"integrity": "sha512-hOXlFx+YcklJ8kXiCAfk/FMyr4Pm9ck477G0m/us2344Vuj355IpoEDB5UmGAsSpTBmr+4ZhjzW04JuFXkb/fw==",
|
||||
"dependencies": {
|
||||
"arg": "^5.0.2",
|
||||
"chokidar": "^3.5.3",
|
||||
"color-name": "^1.1.4",
|
||||
"didyoumean": "^1.2.2",
|
||||
"dlv": "^1.1.3",
|
||||
"fast-glob": "^3.2.12",
|
||||
"glob-parent": "^6.0.2",
|
||||
"is-glob": "^4.0.3",
|
||||
"jiti": "^1.17.2",
|
||||
"lilconfig": "^2.0.6",
|
||||
"micromatch": "^4.0.5",
|
||||
"normalize-path": "^3.0.0",
|
||||
"object-hash": "^3.0.0",
|
||||
"picocolors": "^1.0.0",
|
||||
"postcss": "^8.0.9",
|
||||
"postcss-import": "^14.1.0",
|
||||
"postcss-js": "^4.0.0",
|
||||
"postcss-load-config": "^3.1.4",
|
||||
"postcss-nested": "6.0.0",
|
||||
"postcss-selector-parser": "^6.0.11",
|
||||
"postcss-value-parser": "^4.2.0",
|
||||
"quick-lru": "^5.1.1",
|
||||
"resolve": "^1.22.1",
|
||||
"sucrase": "^3.29.0"
|
||||
},
|
||||
"bin": {
|
||||
"tailwind": "lib/cli.js",
|
||||
"tailwindcss": "lib/cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.13.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.0.9"
|
||||
}
|
||||
},
|
||||
"node_modules/tw-elements/node_modules/yaml": {
|
||||
"version": "1.10.2",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
|
||||
"integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is": {
|
||||
"version": "1.6.18",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
"alpinejs": "^3.13.3",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"postcss-loader": "^7.1.0",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"tw-elements": "^1.0.0-beta1"
|
||||
"tailwindcss": "^3.2.7"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,35 +7,31 @@ use App\Repository\MangaRepository;
|
||||
use App\Service\MangaExportService;
|
||||
use App\Service\LelScansProviderService;
|
||||
use App\Service\MangaScraperService;
|
||||
use App\Service\MangaUpdatesDbProvider;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\String\Slugger\AsciiSlugger;
|
||||
|
||||
class MangaController extends AbstractController
|
||||
{
|
||||
private MangaScraperService $mangaScraperService;
|
||||
private MangaExportService $mangaExportService;
|
||||
private LelScansProviderService $mangaProviderService;
|
||||
private MangaRepository $mangaRepository;
|
||||
|
||||
public function __construct(MangaScraperService $mangaScraperService, MangaExportService $mangaExportService, LelScansProviderService $mangaProviderService, MangaRepository $mangaRepository)
|
||||
public function __construct(
|
||||
private readonly MangaScraperService $mangaScraperService,
|
||||
private readonly MangaExportService $mangaExportService,
|
||||
private readonly LelScansProviderService $mangaProviderService,
|
||||
private readonly MangaRepository $mangaRepository,
|
||||
private MangaUpdatesDbProvider $mangaUpdatesDbProvider
|
||||
)
|
||||
{
|
||||
$this->mangaScraperService = $mangaScraperService;
|
||||
$this->mangaExportService = $mangaExportService;
|
||||
$this->mangaProviderService = $mangaProviderService;
|
||||
$this->mangaRepository = $mangaRepository;
|
||||
}
|
||||
|
||||
#[Route('/manga', name: 'app_manga')]
|
||||
public function index(): Response
|
||||
{
|
||||
// $this->breadcrumbs->addItem("Accueil", $this->generateUrl("app_manga"));
|
||||
// $this->breadcrumbs->addItem("Mangas", $this->generateUrl("manga_show"));
|
||||
|
||||
$mangas = $this->mangaRepository->findAll();
|
||||
return $this->render('manga/index.html.twig', [
|
||||
'controller_name' => 'MangaController',
|
||||
@@ -49,10 +45,7 @@ class MangaController extends AbstractController
|
||||
$manga = $this->mangaRepository->findOneBy(['slug' => $mangaSlug]);
|
||||
|
||||
if (!$manga) {
|
||||
$manga = new Manga();
|
||||
$manga->setSlug($mangaSlug);
|
||||
$manga->setTitle($this->slugToTitle($mangaSlug));
|
||||
$this->mangaRepository->save($manga, true);
|
||||
throw new NotFoundHttpException("Le manga demandé n'existe pas.");
|
||||
}
|
||||
|
||||
$availableChapters = $this->mangaProviderService->getChapterList($mangaSlug);
|
||||
@@ -90,6 +83,31 @@ class MangaController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/addNew', name: 'add_new_manga')]
|
||||
public function addNew(): Response
|
||||
{
|
||||
$availableManga = $this->mangaProviderService->getMangaList();
|
||||
|
||||
foreach ($availableManga as $key => $manga) {
|
||||
$availableManga[$key]['slug'] = $this->titleToSlug($manga['name']);
|
||||
}
|
||||
|
||||
$mangas = $this->mangaRepository->findAll();
|
||||
return $this->render('manga/add_new.html.twig', [
|
||||
'availableManga' => $availableManga,
|
||||
'mangas' => $mangas,
|
||||
]);
|
||||
}
|
||||
|
||||
public function search(string $title): Response
|
||||
{
|
||||
$mangas = $this->mangaUpdatesDbProvider->search($title);
|
||||
|
||||
return $this->render('manga/add_new.html.twig', [
|
||||
'mangas' => $mangas,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/manga/{mangaSlug}/chapter/{chapterNumber}/download', name: 'download_chapter')]
|
||||
public function downloadChapter(string $mangaSlug, float $chapterNumber): BinaryFileResponse
|
||||
{
|
||||
@@ -206,4 +224,10 @@ class MangaController extends AbstractController
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
private function titleToSlug(string $title): string
|
||||
{
|
||||
$slugger = new AsciiSlugger();
|
||||
return $slugger->slug($title)->lower()->toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class MenuController extends AbstractController
|
||||
}
|
||||
|
||||
$mangas = $this->mangaRepository->findAll();
|
||||
return $this->render('menu/menu.html.twig', [
|
||||
return $this->render('menu/menu_old.html.twig', [
|
||||
'availableManga' => $availableManga,
|
||||
'mangas' => $mangas,
|
||||
]);
|
||||
|
||||
@@ -21,11 +21,11 @@ class AppFixtures extends Fixture
|
||||
];
|
||||
});
|
||||
|
||||
$mangas = MangaFactory::createMany(5);
|
||||
$mangas = MangaFactory::createMany(25);
|
||||
|
||||
foreach ($mangas as $manga) {
|
||||
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
$manga->addChapter(ChapterFactory::createOne([
|
||||
'manga' => $manga,
|
||||
'number' => $i
|
||||
@@ -33,7 +33,7 @@ class AppFixtures extends Fixture
|
||||
}
|
||||
|
||||
foreach ($manga->getChapters() as $chapter) {
|
||||
for ($i = 1; $i <= 15; $i++) {
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
$chapter->addPagesLink(PageFactory::createOne([
|
||||
'chapter' => $chapter,
|
||||
'number' => $i
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Entity;
|
||||
use App\Repository\MangaRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: MangaRepository::class)]
|
||||
@@ -24,6 +25,18 @@ class Manga
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $slug = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $imageUrl = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $publicationYear = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $description = null;
|
||||
|
||||
#[ORM\Column(type: Types::ARRAY, nullable: true)]
|
||||
private ?array $genres = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->chapters = new ArrayCollection();
|
||||
@@ -97,4 +110,52 @@ class Manga
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getImageUrl(): ?string
|
||||
{
|
||||
return $this->imageUrl;
|
||||
}
|
||||
|
||||
public function setImageUrl(?string $imageUrl): static
|
||||
{
|
||||
$this->imageUrl = $imageUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPublicationYear(): ?int
|
||||
{
|
||||
return $this->publicationYear;
|
||||
}
|
||||
|
||||
public function setPublicationYear(?int $publicationYear): static
|
||||
{
|
||||
$this->publicationYear = $publicationYear;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(?string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getGenres(): ?array
|
||||
{
|
||||
return $this->genres;
|
||||
}
|
||||
|
||||
public function setGenres(?array $genres): static
|
||||
{
|
||||
$this->genres = $genres;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace App\EventListener;
|
||||
use App\Entity\Chapter;
|
||||
use App\Entity\Manga;
|
||||
use App\Entity\Page;
|
||||
use App\Event\MangaScrapedEvent;
|
||||
use App\EventSubscriber\MangaScrapedEvent;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class MangaScrapedListener
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Factory;
|
||||
|
||||
use App\Entity\Manga;
|
||||
use App\Repository\MangaRepository;
|
||||
use Symfony\Component\String\Slugger\SluggerInterface;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Proxy;
|
||||
use Zenstruck\Foundry\RepositoryProxy;
|
||||
@@ -34,7 +35,7 @@ final class MangaFactory extends ModelFactory
|
||||
*
|
||||
* @todo inject services if required
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(private SluggerInterface $slugger)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -46,9 +47,11 @@ final class MangaFactory extends ModelFactory
|
||||
*/
|
||||
protected function getDefaults(): array
|
||||
{
|
||||
$title = self::faker()->words(rand(1, 3), true);
|
||||
|
||||
return [
|
||||
'slug' => self::faker()->text(255),
|
||||
'title' => self::faker()->text(255),
|
||||
'slug' => $this->slugger->slug($title)->lower(),
|
||||
'title' => $title,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
10
src/Service/MangaDbProviderInterface.php
Normal file
10
src/Service/MangaDbProviderInterface.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
interface MangaDbProviderInterface
|
||||
{
|
||||
public function search(string $title): Collection;
|
||||
}
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use App\Event\MangaScrapedEvent;
|
||||
use App\EventSubscriber\MangaScrapedEvent;
|
||||
use GuzzleHttp\Client;
|
||||
use PHPUnit\Util\PHP\AbstractPhpProcess;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Symfony\Component\DomCrawler\Crawler;
|
||||
use Symfony\Component\Routing\Matcher\UrlMatcher;
|
||||
use Symfony\Component\Routing\RequestContext;
|
||||
@@ -15,7 +14,7 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
class MangaScraperService
|
||||
{
|
||||
const IMG_BASE_DIR = '/public/manga-images';
|
||||
const string IMG_BASE_DIR = '/public/manga-images';
|
||||
private string $projectDir;
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
|
||||
@@ -28,9 +27,10 @@ class MangaScraperService
|
||||
public function extractMangaPageData(string $html): array
|
||||
{
|
||||
$baseUrl = 'https://lelscans.net';
|
||||
|
||||
//pour éviter à PhpStorm de gueuler...
|
||||
$selector = 'img';
|
||||
$crawler = new Crawler($html);
|
||||
$imgUrl = $crawler->filter('img')->attr('src');
|
||||
$imgUrl = $crawler->filter($selector)->attr('src');
|
||||
$nextLink = $crawler->filter('a[title="Suivant"]');
|
||||
|
||||
if (!preg_match('/^https?:\/\//', $imgUrl)) {
|
||||
@@ -54,6 +54,9 @@ class MangaScraperService
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function scrapeMangaChapter(string $chapterUrl, string $mangaTitle, float $chapterNumber): array|bool
|
||||
{
|
||||
if(!$this->isChapterAvailable($chapterUrl, $chapterNumber)){
|
||||
@@ -101,6 +104,9 @@ class MangaScraperService
|
||||
return $pageData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
private function fetchHtml(string $url): string
|
||||
{
|
||||
$client = new Client();
|
||||
@@ -109,6 +115,9 @@ class MangaScraperService
|
||||
return (string) $response->getBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
private function downloadAndSaveImage(string $imageUrl, string $destinationPath): void
|
||||
{
|
||||
$client = new Client();
|
||||
@@ -117,6 +126,9 @@ class MangaScraperService
|
||||
file_put_contents($destinationPath, $response->getBody()->getContents());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
private function isChapterAvailable(string $chapterUrl, float $chapterNumber): bool
|
||||
{
|
||||
$html = $this->fetchHtml($chapterUrl);
|
||||
|
||||
67
src/Service/MangaUpdatesDbProvider.php
Normal file
67
src/Service/MangaUpdatesDbProvider.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use App\Entity\Manga;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Symfony\Component\BrowserKit\HttpBrowser;
|
||||
use Symfony\Component\String\Slugger\SluggerInterface;
|
||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||
|
||||
class MangaUpdatesDbProvider implements MangaDbProviderInterface
|
||||
{
|
||||
private Client $client;
|
||||
|
||||
public function __construct(private SluggerInterface $slugger)
|
||||
{
|
||||
$this->client = new Client();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function search(string $title): Collection
|
||||
{
|
||||
try {
|
||||
$response = $this->client->request('PUT', 'https://api.mangaupdates.com/v1/account/login', [
|
||||
'json' => [
|
||||
'username' => 'Colgora',
|
||||
'password' => '7TK5jv33NDn*SLV',
|
||||
]
|
||||
])
|
||||
->withHeader('Content-Type', 'application/json');
|
||||
|
||||
$jwt = json_decode($response->getBody()->getContents(), true)['context']['session_token'];
|
||||
|
||||
$results = $this->client->request('POST', 'https://api.mangaupdates.com/v1/series/search', [
|
||||
'json' => [
|
||||
'search' => $title,
|
||||
'orderby' => 'score',
|
||||
]
|
||||
])->withHeader('Authorization', 'Bearer ' . $jwt)
|
||||
->withHeader('Content-Type', 'application/json')
|
||||
->getBody()
|
||||
->getContents();
|
||||
|
||||
$mangas = [];
|
||||
foreach (json_decode($results, true)['results'] as $record) {
|
||||
$record = $record['record'];
|
||||
$mangas[] = (new Manga())
|
||||
->setTitle($record['title'])
|
||||
->setSlug($this->slugger->slug($record['title'])->lower())
|
||||
->setDescription($record['description'])
|
||||
->setImageUrl($record['image']['url']['original'])
|
||||
->setGenres($record['genres'])
|
||||
->setPublicationYear((int)$record['year']);
|
||||
}
|
||||
|
||||
return new ArrayCollection($mangas);
|
||||
} catch (GuzzleException $e) {
|
||||
throw new Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: [
|
||||
'./templates/**/*.html.twig',
|
||||
'./node_modules/tw-elements/dist/js/**/*.js'
|
||||
'./templates/**/*.html.twig'
|
||||
],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [
|
||||
require('tw-elements/dist/plugin'),
|
||||
require("daisyui"),
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||
<title>{% block title %}Mangarr{% endblock %}</title>
|
||||
<link rel="icon"
|
||||
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
|
||||
{% block stylesheets %}
|
||||
@@ -10,50 +10,22 @@
|
||||
{{ encore_entry_link_tags('app') }}
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<body class="h-screen">
|
||||
|
||||
<div class="w-full bg-green-600 h-16">
|
||||
<div class="fixed w-full bg-green-600 h-16">
|
||||
<a href="{{ path('app_manga') }}">
|
||||
<span class="">Mangarr</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="max-w-7xl flex">
|
||||
<div x-data="{ activeItem: { main: null, sub: null } }" class="block w-1/5 bg-gray-700 w-56 flex flex-col justify-center pl-8">
|
||||
<div class="py-4">
|
||||
<button @click="activeItem.main = activeItem.main === 'mangas' ? null : 'mangas'" class="w-full text-left">
|
||||
<span :class="{'text-green-600 bg-gray-800': activeItem.main === 'mangas'}">Mangas</span>
|
||||
</button>
|
||||
<div x-show="activeItem.main === 'mangas'" class="pl-6">
|
||||
<button @click="activeItem.sub = 'add-new'" class="py-4 block w-full text-left hover:text-green-600">
|
||||
<span :class="{'text-green-600': activeItem.sub === 'add-new'}">Add New</span>
|
||||
</button>
|
||||
<button @click="activeItem.sub = 'import'" class="py-4 block w-full text-left hover:text-green-600">
|
||||
<span :class="{'text-green-600': activeItem.sub === 'import'}">Import</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button @click="activeItem.main = 'calendar'" class="pb-4 block w-full text-left hover:text-green-600">
|
||||
<span :class="{'text-green-600': activeItem.main === 'calendar'}">Calendar</span>
|
||||
</button>
|
||||
|
||||
<button @click="activeItem.main = 'settings'" class="pb-4 block w-full text-left hover:text-green-600">
|
||||
<span :class="{'text-green-600': activeItem.main === 'settings'}">Settings</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
{# {% include 'menu/base_menu.html.twig' %} #}
|
||||
<main class="mx-auto flex">
|
||||
<div class="p-4">
|
||||
{% block body %}
|
||||
{# {{ wo_render_breadcrumbs() }}#}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</main>
|
||||
<div class="w-screen pt-16 flex bg-white">
|
||||
{% include 'menu/menu.html.twig' %}
|
||||
{% block body %}{% endblock %}
|
||||
</div>
|
||||
{% block javascripts %}
|
||||
{{ encore_entry_script_tags('app') }}
|
||||
<script src="https://kit.fontawesome.com/42e345444d.js" crossorigin="anonymous"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.13.3/dist/cdn.min.js"></script>
|
||||
{{ encore_entry_script_tags('app') }}
|
||||
{% endblock %}
|
||||
|
||||
<script src="https://kit.fontawesome.com/42e345444d.js" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
80
templates/manga/add_new.html.twig
Normal file
80
templates/manga/add_new.html.twig
Normal file
@@ -0,0 +1,80 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% block body %}
|
||||
<div class="container w-full ml-60 p-4">
|
||||
<form>
|
||||
<div class="form-group">
|
||||
|
||||
<div class="relative h-10 w-72 min-w-[200px]">
|
||||
<label for="manga-select"></label>
|
||||
<select id="manga-select"
|
||||
class="peer h-full w-full rounded-[7px] border border-blue-gray-200 border-t-transparent
|
||||
bg-transparent px-3 py-2.5 font-sans text-sm font-normal text-blue-gray-700 outline
|
||||
outline-0 transition-all placeholder-shown:border placeholder-shown:border-blue-gray-200
|
||||
placeholder-shown:border-t-blue-gray-200 empty:!bg-gray-900 focus:border-2
|
||||
focus:border-gray-900 focus:border-t-transparent focus:outline-0 disabled:border-0
|
||||
disabled:bg-blue-gray-50">
|
||||
{% for manga in availableManga %}
|
||||
<option
|
||||
value="{{ path('manga_show', { 'mangaSlug': manga.slug }) }}">{{ manga.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<label
|
||||
class="before:content[' '] after:content[' '] pointer-events-none absolute left-0 -top-1.5 flex
|
||||
h-full w-full select-none text-[11px] font-normal leading-tight text-blue-gray-400
|
||||
transition-all before:pointer-events-none before:mt-[6.5px] before:mr-1 before:box-border
|
||||
before:block before:h-1.5 before:w-2.5 before:rounded-tl-md before:border-t before:border-l
|
||||
before:border-blue-gray-200 before:transition-all after:pointer-events-none after:mt-[6.5px]
|
||||
after:ml-1 after:box-border after:block after:h-1.5 after:w-2.5 after:flex-grow
|
||||
after:rounded-tr-md after:border-t after:border-r after:border-blue-gray-200
|
||||
after:transition-all peer-placeholder-shown:text-sm peer-placeholder-shown:leading-[3.75]
|
||||
peer-placeholder-shown:text-blue-gray-500 peer-placeholder-shown:before:border-transparent
|
||||
peer-placeholder-shown:after:border-transparent peer-focus:text-[11px] peer-focus:leading-tight
|
||||
peer-focus:text-gray-900 peer-focus:before:border-t-2 peer-focus:before:border-l-2
|
||||
peer-focus:before:border-gray-900 peer-focus:after:border-t-2 peer-focus:after:border-r-2
|
||||
peer-focus:after:border-gray-900 peer-disabled:text-transparent
|
||||
peer-disabled:before:border-transparent peer-disabled:after:border-transparent
|
||||
peer-disabled:peer-placeholder-shown:text-blue-gray-500">
|
||||
Select a Manga
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="container w-full p-4">
|
||||
<form>
|
||||
<div class="relative w-full min-w-[200px] h-10">
|
||||
<input
|
||||
class="peer w-full h-full bg-transparent text-blue-gray-700 font-sans font-normal outline outline-0
|
||||
focus:outline-0 disabled:bg-blue-gray-50 disabled:border-0 transition-all placeholder-shown:border
|
||||
placeholder-shown:border-blue-gray-200 placeholder-shown:border-t-blue-gray-200 border focus:border-2
|
||||
border-t-transparent focus:border-t-transparent text-sm px-3 py-2.5 rounded-[7px] border-blue-gray-200
|
||||
focus:border-gray-900" placeholder=" "/>
|
||||
<label class="flex w-full h-full select-none pointer-events-none absolute left-0 font-normal
|
||||
!overflow-visible truncate peer-placeholder-shown:text-blue-gray-500 leading-tight
|
||||
peer-focus:leading-tight peer-disabled:text-transparent peer-disabled:peer-placeholder-shown:text-blue-gray-500
|
||||
transition-all -top-1.5 peer-placeholder-shown:text-sm text-[11px] peer-focus:text-[11px]
|
||||
before:content[' '] before:block before:box-border before:w-2.5 before:h-1.5
|
||||
before:mt-[6.5px] before:mr-1 peer-placeholder-shown:before:border-transparent before:rounded-tl-md
|
||||
before:border-t peer-focus:before:border-t-2 before:border-l peer-focus:before:border-l-2
|
||||
before:pointer-events-none before:transition-all peer-disabled:before:border-transparent after:content[' ']
|
||||
after:block after:flex-grow after:box-border after:w-2.5 after:h-1.5 after:mt-[6.5px] after:ml-1
|
||||
peer-placeholder-shown:after:border-transparent after:rounded-tr-md after:border-t peer-focus:after:border-t-2
|
||||
after:border-r peer-focus:after:border-r-2 after:pointer-events-none after:transition-all peer-disabled:after:border-transparent
|
||||
peer-placeholder-shown:leading-[3.75] text-gray-500 peer-focus:text-gray-900 before:border-blue-gray-200
|
||||
peer-focus:before:!border-gray-900 after:border-blue-gray-200 peer-focus:after:!border-gray-900">
|
||||
Manga
|
||||
</label>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
<script>
|
||||
const mangaSelect = document.getElementById('manga-select');
|
||||
mangaSelect.addEventListener('change', () => {
|
||||
const selectedUrl = mangaSelect.options[mangaSelect.selectedIndex].value;
|
||||
window.open(selectedUrl, '_top');
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -1,19 +1,20 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Liste des mangas{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Liste des mangas</h1>
|
||||
|
||||
<ul>
|
||||
<div class="container w-full ml-60 p-4 grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-8 2xl:grid-cols-12 gap-4">
|
||||
{% for manga in mangas %}
|
||||
<li>
|
||||
<div class="bg-white overflow-hidden border-gray-300 hover:shadow-2xl hover:border transition-shadow duration-300">
|
||||
<a href="{{ path('manga_show', { 'mangaSlug': manga.slug }) }}">
|
||||
{{ manga.title }}
|
||||
<img src="{{ manga.imageUrl ?? 'https://placehold.co/150x220' }}" alt="{{ manga.title }}" class="w-full">
|
||||
{# <img src="https://placehold.co/150x220" alt="{{ manga.title }}" class="w-full">#}
|
||||
</a>
|
||||
</li>
|
||||
<div class="p-4">
|
||||
<p class="text-lg font-semibold">{{ manga.title }}</p>
|
||||
<p class="text-gray-600">Auteur</p>
|
||||
<p class="text-gray-500">Ajouter: Jun 2 2024</p>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<li>Aucun manga trouvé.</li>
|
||||
<p class="col-span-full text-center text-gray-500">Aucun manga trouvé.</p>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -3,21 +3,25 @@
|
||||
{% block title %}{{ manga.title }} - Chapitre {{ chapter.number }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container w-full ml-60 p-4">
|
||||
<h1 class="text-center text-3xl my-4">{{ manga.title }} - Chapitre {{ chapter.number }}</h1>
|
||||
|
||||
<div class="flex justify-center my-4">
|
||||
{% if currentPage.number > 1 %}
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number - 1 }) }}" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 mr-4">« Précédent</a>
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number - 1 }) }}"
|
||||
class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 mr-4">« Précédent</a>
|
||||
{% endif %}
|
||||
{% if currentPage.number < pages|length %}
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number + 1 }) }}" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Suivant »</a>
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number + 1 }) }}"
|
||||
class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Suivant »</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="page-container flex justify-center">
|
||||
{% if currentPage.number < pages|length %}
|
||||
<a href="{{ path('read_chapter_page', {'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number + 1}) }}">
|
||||
<img src="{{ asset(currentPage.imageLocalUrl) }}" alt="Page {{ currentPage.number }}" class="shadow-lg">
|
||||
<img src="{{ asset(currentPage.imageLocalUrl) }}" alt="Page {{ currentPage.number }}"
|
||||
class="shadow-lg">
|
||||
</a>
|
||||
{% else %}
|
||||
<img src="{{ asset(currentPage.imageLocalUrl) }}" alt="Page {{ currentPage.number }}" class="shadow-lg">
|
||||
@@ -26,10 +30,13 @@
|
||||
|
||||
<div class="flex justify-center my-4">
|
||||
{% if currentPage.number > 1 %}
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number - 1 }) }}" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 mr-4">« Précédent</a>
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number - 1 }) }}"
|
||||
class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 mr-4">« Précédent</a>
|
||||
{% endif %}
|
||||
{% if currentPage.number < pages|length %}
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number + 1 }) }}" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Suivant »</a>
|
||||
<a href="{{ path('read_chapter_page', { 'mangaSlug': manga.slug, 'chapterNumber': chapter.number, 'pageNumber': currentPage.number + 1 }) }}"
|
||||
class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Suivant »</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,9 +1,6 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Chapitres de {{ manga.title }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="container w-full ml-60 p-4">
|
||||
<h1 class="text-4xl font-bold mb-8">Chapitres de {{ manga.title }}</h1>
|
||||
|
||||
<ul class="list-disc pl-5">
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<!-- Menu latéral -->
|
||||
<header class="fixed top-0 left-0 z-10 w-full bg-blue-600 p-4 md:hidden">
|
||||
<button id="hamburger-button" class="text-white">
|
||||
<i class="fas fa-bars"></i>
|
||||
</button>
|
||||
</header>
|
||||
{#<header class="fixed top-0 left-0 z-10 w-full bg-blue-600 p-4 md:hidden">#}
|
||||
{# <button id="hamburger-button" class="text-white">#}
|
||||
{# <i class="fas fa-bars"></i>#}
|
||||
{# </button>#}
|
||||
{#</header>#}
|
||||
|
||||
<aside id="menu" class="fixed top-0 left-0 z-10 h-full w-64 bg-gray-800 text-white p-4 hidden md:block">
|
||||
<div id="menu" class="fixed left-0 h-full w-60 bg-gray-600 text-white hidden md:block">
|
||||
{{ render(controller('App\\Controller\\MenuController::menu')) }}
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
@@ -1,35 +1,32 @@
|
||||
<div class="fixed top-0 left-0 h-screen w-64 bg-gray-100 p-6">
|
||||
<h2 class="text-xl font-bold mb-4">Menu</h2>
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label for="manga-select">Choisissez un manga :</label>
|
||||
<select id="manga-select" class="form-control w-full">
|
||||
<option value="" selected disabled>Sélectionnez un manga</option>
|
||||
{% for manga in availableManga %}
|
||||
<option value="{{ path('manga_show', { 'mangaSlug': manga.slug }) }}">{{ manga.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
<div>
|
||||
<div id="menu" class="fixed left-0 h-full w-60 bg-gray-600 text-white hidden md:block">
|
||||
<aside class="h-full">
|
||||
<nav>
|
||||
<ul>
|
||||
{% for manga in mangas %}
|
||||
<li class="my-2">
|
||||
<a href="{{ path('manga_show', { 'mangaSlug': manga.slug }) }}" class="text-blue-600 hover:text-blue-800">
|
||||
{{ manga.title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
<li class="mb-4 border-l-4 border-green-600">
|
||||
<div class="flex pl-8 p-4 items-center text-green-600 bg-gray-800">
|
||||
<i class="fas fa-book mr-2"></i>
|
||||
<span>Mangas</span>
|
||||
</div>
|
||||
<ul class="ml-14 mt-2 space-y-4">
|
||||
<li><a href="{{ path('add_new_manga') }}" class="hover:text-green-600">Ajouter un nouveau</a></li>
|
||||
<li><a href="#" class="hover:text-green-600">Import bibliothèque</a></li>
|
||||
<li><a href="#" class="hover:text-green-600">Collections</a></li>
|
||||
<li><a href="#" class="hover:text-green-600">Découvrir</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="mb-4 pl-8 flex items-center hover:text-green-600">
|
||||
<i class="fas fa-calendar-alt mr-2"></i>
|
||||
<span>Calendrier</span>
|
||||
</li>
|
||||
<li class="mb-4 pl-8 flex items-center hover:text-green-600">
|
||||
<i class="fas fa-cog mr-2"></i>
|
||||
<span>Paramètres</span>
|
||||
</li>
|
||||
<li class="mb-4 pl-8 flex items-center hover:text-green-600">
|
||||
<i class="fas fa-desktop mr-2"></i>
|
||||
<span>Système</span>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block javascripts %}
|
||||
<script>
|
||||
const mangaSelect = document.getElementById('manga-select');
|
||||
mangaSelect.addEventListener('change', () => {
|
||||
const selectedUrl = mangaSelect.options[mangaSelect.selectedIndex].value;
|
||||
window.open(selectedUrl, '_top');
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
35
templates/menu/menu_old.html.twig
Normal file
35
templates/menu/menu_old.html.twig
Normal file
@@ -0,0 +1,35 @@
|
||||
<div class="fixed left-0 h-screen w-60">
|
||||
<h2 class="text-xl font-bold mb-4">Menu</h2>
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label for="manga-select">Choisissez un manga :</label>
|
||||
<select id="manga-select" class="form-control w-full">
|
||||
<option value="" selected disabled>Sélectionnez un manga</option>
|
||||
{% for manga in availableManga %}
|
||||
<option value="{{ path('manga_show', { 'mangaSlug': manga.slug }) }}">{{ manga.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
<div>
|
||||
<ul>
|
||||
{% for manga in mangas %}
|
||||
<li class="my-2">
|
||||
<a href="{{ path('manga_show', { 'mangaSlug': manga.slug }) }}" class="text-blue-600 hover:text-blue-800">
|
||||
{{ manga.title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% block javascripts %}
|
||||
<script>
|
||||
const mangaSelect = document.getElementById('manga-select');
|
||||
mangaSelect.addEventListener('change', () => {
|
||||
const selectedUrl = mangaSelect.options[mangaSelect.selectedIndex].value;
|
||||
window.open(selectedUrl, '_top');
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user