diff --git a/app/Http/Controllers/Fo/StaticPageController.php b/app/Http/Controllers/Fo/StaticPageController.php index de72f36..c3f2117 100644 --- a/app/Http/Controllers/Fo/StaticPageController.php +++ b/app/Http/Controllers/Fo/StaticPageController.php @@ -21,6 +21,7 @@ use App\Models\StaticPage; use App\Models\Strip; use App\Models\Testimonial; use Illuminate\Support\Facades\Mail; +use Illuminate\Support\Str; class StaticPageController extends Controller { @@ -80,18 +81,24 @@ class StaticPageController extends Controller $historySection = $sectionModels->where('section', PageSectionEnum::unveil_history)->first(); $commitmentSection = $sectionModels->where('section', PageSectionEnum::unveil_commitments)->first(); - // * Calcul Viewbox leaflet map. - $viewBox = (object)[ - // @phpstan-ignore-next-line - 'lat' => \round($siteModelList->sum(fn (Site $siteModel) => - $siteModel->latitude) / $siteModelList->count(), 6), - // @phpstan-ignore-next-line - 'lng' => \round($siteModelList->sum(fn (Site $siteModel) => - $siteModel->longitude) / $siteModelList->count(), 6) - ]; + $viewBox = null; + $initialZoom = null; + // * Calcul Viewbox leaflet map (). + // Carte  page “on se dévoile” : Point central = Laval + rayon = 100 km  + /** @var \App\Models\Site|null $lavalSite */ + // @phpstan-ignore-next-line + $lavalSite = $siteModelList->first(fn (Site $site) => Str::contains($site->name, 'Laval')); + if ($lavalSite) { + $viewBox = (object)[ + 'lat' => $lavalSite->latitude, + 'lng' => $lavalSite->longitude + ]; + $initialZoom = 9; + } return view('fo.pages.unveil', compact( 'viewBox', + 'initialZoom', 'staticPageModel', 'sectionModels', 'historicalMilestoneModels', @@ -276,9 +283,17 @@ class StaticPageController extends Controller $nextSiteModel = Site::query()->orderBy('order')->where('order', '>', $site->order)->first(); } + $viewBox = (object)[ + 'lat' => $site->latitude, + 'lng' => $site->longitude + ]; + $initialZoom = 9; + return view('fo.pages.site', [ 'siteModel' => $site, - 'nextSiteModel' => $nextSiteModel + 'nextSiteModel' => $nextSiteModel, + 'viewBox' => $viewBox, + 'initialZoom' => $initialZoom, ]); } -} \ No newline at end of file +} diff --git a/app/Http/Requests/Bo/Sites/StoreSiteRequest.php b/app/Http/Requests/Bo/Sites/StoreSiteRequest.php index 832c6c9..49734d1 100644 --- a/app/Http/Requests/Bo/Sites/StoreSiteRequest.php +++ b/app/Http/Requests/Bo/Sites/StoreSiteRequest.php @@ -80,7 +80,7 @@ class StoreSiteRequest extends FormRequest ]; return \array_merge( $rules, - $this->pictureRules('logo', 300, 300, 300, 300, false), + $this->pictureRules('logo', 1000, 727, 1000, 727, false), $this->pictureRules('picture_1', 1000, 562, 1000, 562, false), $this->pictureRules('picture_2', 1000, 562, 1000, 562, true), $this->pictureRules('picture_3', 1000, 562, 1000, 562, true), diff --git a/composer.json b/composer.json index a312fbb..abb7b6e 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ "axlon/laravel-postal-code-validation": "^3.5", "diglactic/laravel-breadcrumbs": "^8.0", "guzzlehttp/guzzle": "^7.2", + "kwaadpepper/image-resizer": "^2.1", "laravel/framework": "^10.0", "laravel/tinker": "^2.8", "laravel/ui": "^4.2", @@ -28,7 +29,7 @@ "fakerphp/faker": "^1.9.1", "kitloong/laravel-migrations-generator": "^6.8", "krlove/eloquent-model-generator": "dev-l10-compatibility", - "larastan/larastan": "^2.6", + "larastan/larastan": "^2.9", "laravel-lang/common": "^4.0", "laravel/pint": "^1.0", "laravel/sail": "^1.18", diff --git a/composer.lock b/composer.lock index d7285ee..9ec12b2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4bf7c1fe3b307c9b2251f4ebcfbd0cd4", + "content-hash": "1da5334945451015dfb5c5edc5c9b42f", "packages": [ { "name": "axlon/laravel-postal-code-validation", @@ -1422,6 +1422,158 @@ ], "time": "2023-12-03T19:50:20+00:00" }, + { + "name": "intervention/image", + "version": "2.7.2", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "04be355f8d6734c826045d02a1079ad658322dad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/04be355f8d6734c826045d02a1079ad658322dad", + "reference": "04be355f8d6734c826045d02a1079ad658322dad", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1 || ^2.0", + "php": ">=5.4.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "^4.8 || ^5.7 || ^7.5.15" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@intervention.io", + "homepage": "https://intervention.io/" + } + ], + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": [ + "gd", + "image", + "imagick", + "laravel", + "thumbnail", + "watermark" + ], + "support": { + "issues": "https://github.com/Intervention/image/issues", + "source": "https://github.com/Intervention/image/tree/2.7.2" + }, + "funding": [ + { + "url": "https://paypal.me/interventionio", + "type": "custom" + }, + { + "url": "https://github.com/Intervention", + "type": "github" + } + ], + "time": "2022-05-21T17:30:32+00:00" + }, + { + "name": "intervention/imagecache", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/Intervention/imagecache.git", + "reference": "86136575a62d3634b51f196a998fce4a583b49bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/imagecache/zipball/86136575a62d3634b51f196a998fce4a583b49bb", + "reference": "86136575a62d3634b51f196a998fce4a583b49bb", + "shasum": "" + }, + "require": { + "illuminate/cache": "^5.5|~6|~7|~8|~9|~10", + "illuminate/filesystem": "^5.5|~6|~7|~8|~9|~10", + "intervention/image": "~2.2", + "nesbot/carbon": "^2.39", + "opis/closure": "^3.5", + "php": "~7.2|~8" + }, + "require-dev": { + "phpunit/phpunit": "^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@intervention.io", + "homepage": "http://intervention.io/" + } + ], + "description": "Caching extension for the Intervention Image Class", + "homepage": "https://image.intervention.io", + "keywords": [ + "cache", + "gd", + "image", + "imagick", + "laravel" + ], + "support": { + "issues": "https://github.com/Intervention/imagecache/issues", + "source": "https://github.com/Intervention/imagecache/tree/2.6.0" + }, + "funding": [ + { + "url": "https://paypal.me/interventionio", + "type": "custom" + }, + { + "url": "https://github.com/Intervention", + "type": "github" + } + ], + "abandoned": true, + "time": "2023-02-25T19:40:47+00:00" + }, { "name": "jean85/pretty-package-versions", "version": "2.0.6", @@ -1481,6 +1633,66 @@ }, "time": "2024-03-08T09:58:59+00:00" }, + { + "name": "kwaadpepper/image-resizer", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/Kwaadpepper/image-resizer.git", + "reference": "2a14ad153b34916f437af50549bad47c018902df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Kwaadpepper/image-resizer/zipball/2a14ad153b34916f437af50549bad47c018902df", + "reference": "2a14ad153b34916f437af50549bad47c018902df", + "shasum": "" + }, + "require": { + "illuminate/support": "~10", + "intervention/image": "^2.7.2", + "intervention/imagecache": "^2.6", + "laravel/framework": "~10" + }, + "require-dev": { + "slevomat/coding-standard": "^8.11" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Kwaadpepper\\ImageResizer\\ImageResizerServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Kwaadpepper\\ImageResizer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jérémy Munsch", + "email": "github@jeremydev.ovh", + "homepage": "https://jeremydev.ovh" + } + ], + "description": "Resize images on the fly and cache them", + "homepage": "https://github.com/kwaadpepper/image-resizer", + "keywords": [ + "images", + "laravel", + "resize" + ], + "support": { + "issues": "https://github.com/Kwaadpepper/image-resizer/issues", + "source": "https://github.com/Kwaadpepper/image-resizer/tree/2.1.0" + }, + "time": "2023-06-08T12:07:24+00:00" + }, { "name": "laravel/framework", "version": "v10.48.3", @@ -2982,6 +3194,71 @@ ], "time": "2023-11-13T09:31:12+00:00" }, + { + "name": "opis/closure", + "version": "3.6.3", + "source": { + "type": "git", + "url": "https://github.com/opis/closure.git", + "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/opis/closure/zipball/3d81e4309d2a927abbe66df935f4bb60082805ad", + "reference": "3d81e4309d2a927abbe66df935f4bb60082805ad", + "shasum": "" + }, + "require": { + "php": "^5.4 || ^7.0 || ^8.0" + }, + "require-dev": { + "jeremeamia/superclosure": "^2.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.6.x-dev" + } + }, + "autoload": { + "files": [ + "functions.php" + ], + "psr-4": { + "Opis\\Closure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marius Sarca", + "email": "marius.sarca@gmail.com" + }, + { + "name": "Sorin Sarca", + "email": "sarca_sorin@hotmail.com" + } + ], + "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", + "homepage": "https://opis.io/closure", + "keywords": [ + "anonymous functions", + "closure", + "function", + "serializable", + "serialization", + "serialize" + ], + "support": { + "issues": "https://github.com/opis/closure/issues", + "source": "https://github.com/opis/closure/tree/3.6.3" + }, + "time": "2022-01-27T09:35:39+00:00" + }, { "name": "phpoption/phpoption", "version": "1.9.2", diff --git a/config/image-resizer.php b/config/image-resizer.php new file mode 100644 index 0000000..4443faa --- /dev/null +++ b/config/image-resizer.php @@ -0,0 +1,70 @@ + 'imagick', + + /** + * The cache driver to use as defined + * in config/cache of your app + */ + 'cache' => 'file', + + /** + * The path where to store image in cache + */ + 'cachePath' => 'cache/images', + + /** + * Image cache life time + * This is given in minutes + * Here the cache for images is + * one hour + */ + 'lifetime' => 60, + + /** + * Format can specifiy to which format save the image + * JPEG PNG GIF TIF BMP ICO PSD WebP + * GD ✔️ ✔️ ✔️ - - - - ✔️ * + * Imagick ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ * + * For WebP support GD driver must be used with PHP 5 >= 5.5.0 or PHP 7 + * in order to use imagewebp(). If Imagick is used, it must be compiled + * with libwebp for WebP support. + * resize => will resize the image (boolean) + * fit => Combine cropping and resizing to format image in a smart way (boolean) + * keepRatio => will keep image ratio wile resizing (boolean) + * trim => boolean to trim the image using border color + * inCanvas => to make sure image boundarie is respected + * format => select tha wantd ouput form, yan can just convert images if you want + * example : + * 'small' => [ + * 'height' => 500, + * 'width' => 250, + * 'inCanvas' => true, + * 'trim' => ['transparent', null, 10] + * ], + * 'smallWebp' => [ + * 'height' => 500, + * 'width' => 250, + * 'inCanvas' => true, + * 'format' => 'webp' + * ], + * 'justconvertImage' => [ + * 'format' => 'webp' + * ] + */ + 'templates' => [ + 'cartoPicture' => [ + 'height' => 140, + 'width' => 155, + 'fit' => true, + 'inCanvas' => true, + 'trim' => ['transparent', null, 10], + 'format' => 'webp', + ] + ] +]; diff --git a/database/factories/assets/sites/default-picture-1000x727.jpg b/database/factories/assets/sites/default-picture-1000x727.jpg new file mode 100644 index 0000000..68c2be0 Binary files /dev/null and b/database/factories/assets/sites/default-picture-1000x727.jpg differ diff --git a/database/factories/assets/sites/default-picture-300x300.png b/database/factories/assets/sites/default-picture-300x300.png deleted file mode 100644 index 8daffac..0000000 Binary files a/database/factories/assets/sites/default-picture-300x300.png and /dev/null differ diff --git a/database/seeders/Development/SiteSeeder.php b/database/seeders/Development/SiteSeeder.php index 583986c..0e10ac8 100644 --- a/database/seeders/Development/SiteSeeder.php +++ b/database/seeders/Development/SiteSeeder.php @@ -25,7 +25,7 @@ class SiteSeeder extends Seeder $site->logo = FileStorageHelper::storeFile( new Site(), new \SplFileInfo(\resource_path( - '../database/factories/assets/sites/default-picture-300x300.png' + '../database/factories/assets/sites/default-picture-1000x727.jpg' )) ); $site->picture_1 = FileStorageHelper::storeFile( diff --git a/resources/sass/fo/base/_common.scss b/resources/sass/fo/base/_common.scss index 73a8205..eeb3b08 100644 --- a/resources/sass/fo/base/_common.scss +++ b/resources/sass/fo/base/_common.scss @@ -176,3 +176,9 @@ $theme-colors: map.merge($theme-colors, $light-colors); } } } + +// .map-site-widget { +// img { +// width: 6rem; +// } +// } diff --git a/resources/sass/fo/pages/_unveil.scss b/resources/sass/fo/pages/_unveil.scss index affb0f9..fc79930 100644 --- a/resources/sass/fo/pages/_unveil.scss +++ b/resources/sass/fo/pages/_unveil.scss @@ -18,7 +18,15 @@ .sites { .embed-map { - min-height: 20rem; + min-height: 30rem; + + @include media-breakpoint-up(sm) { + min-height: 35rem; + } + + @include media-breakpoint-up(md) { + min-height: 40rem; + } iframe { width: 100%; diff --git a/resources/ts/fo/base/common.ts b/resources/ts/fo/base/common.ts index 1d999e9..f58de70 100644 --- a/resources/ts/fo/base/common.ts +++ b/resources/ts/fo/base/common.ts @@ -177,6 +177,27 @@ document.addEventListener("DOMContentLoaded", function () { }, }, }, + "swiper-sites-map": { + centeredSlides: true, + modules: [Keyboard], + grabCursor: true, + slidesPerView: 1, + spaceBetween: 20, + keyboard: { + enabled: true, + }, + breakpoints: { + 768: { + slidesPerView: 1.5, + }, + 992: { + slidesPerView: 1, + }, + 1200: { + slidesPerView: 1.3, + }, + }, + }, "swiper-sites-pictures": { modules: [Navigation, Keyboard], grabCursor: true, @@ -301,13 +322,8 @@ document.addEventListener("DOMContentLoaded", function () { }, }; - type SwiperSlider = { - element: HTMLElement; - swiper: Swiper; - }; - - const swiperVol = document.getElementsByClassName("swiper") as HTMLCollectionOf, - sliders: SwiperSlider[] = []; + const swiperVol = document.getElementsByClassName("swiper") as HTMLCollectionOf; + window.__SLIDERS = new Map(); for (const htmlElt of swiperVol) { if (!swiperConfig[htmlElt.id as keyof typeof swiperConfig]) { @@ -315,10 +331,12 @@ document.addEventListener("DOMContentLoaded", function () { } // @ts-ignore const swiper = new Swiper(htmlElt, swiperConfig[htmlElt.id as keyof typeof swiperConfig]); - sliders.push({ - element: htmlElt, - swiper: swiper, - }); + window.__SLIDERS.set( + htmlElt.id, + { + element: htmlElt, + swiper: swiper, + }); if (swiper.el.id === "swiper-teams") { const btnPlayPause = document.querySelector(".swiper-pagination-playpause"); btnPlayPause?.addEventListener("click", function () { diff --git a/resources/ts/fo/components/LeafletMapVueComponent.vue b/resources/ts/fo/components/LeafletMapVueComponent.vue index 6c869d7..eb70d35 100644 --- a/resources/ts/fo/components/LeafletMapVueComponent.vue +++ b/resources/ts/fo/components/LeafletMapVueComponent.vue @@ -5,7 +5,7 @@ >
- - -
- -
- -
- - +