From d86b64020900ee0cf8a4591ca96fe9d2fa60933d Mon Sep 17 00:00:00 2001 From: Lobstervova Date: Wed, 4 Feb 2026 23:29:42 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B1=D0=BB=D0=BE=D0=BA=20=D1=81=20=D0=BC=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D0=BC=D0=B8,=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20?= =?UTF-8?q?=D0=B1=D0=BB=D0=BE=D0=BA=D0=B8=20=D1=81=20=D1=84=D0=B8=D0=BB?= =?UTF-8?q?=D1=8C=D1=82=D1=80=D0=B0=D0=BC=D0=B8=20=D0=B8=20=D0=BC=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BC=D0=B8=20=D0=BD=D0=B5=D0=B7=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D1=81=D0=B8=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configurations/SecurityConfig.java | 2 +- .../controllers/web/AccountController.java | 11 --- src/main/resources/static/css/places.css | 73 +++++++++++++++ src/main/resources/static/css/style.css | 1 + .../resources/static/js/site/blocks/header.js | 1 + .../static/js/site/blocks/place-filters.js | 88 ++++++++++--------- .../static/js/site/blocks/places-block.js | 35 ++++++++ .../js/site/blocks/single-place-card.js | 31 +++++++ .../static/js/site/pages/home/home.js | 6 ++ src/main/resources/templates/pages/home.html | 5 +- 10 files changed, 194 insertions(+), 59 deletions(-) create mode 100644 src/main/resources/static/css/places.css create mode 100644 src/main/resources/static/js/site/blocks/places-block.js create mode 100644 src/main/resources/static/js/site/blocks/single-place-card.js create mode 100644 src/main/resources/static/js/site/pages/home/home.js diff --git a/src/main/java/com/example/dateplanner/configurations/SecurityConfig.java b/src/main/java/com/example/dateplanner/configurations/SecurityConfig.java index f055268..3ae7fb6 100644 --- a/src/main/java/com/example/dateplanner/configurations/SecurityConfig.java +++ b/src/main/java/com/example/dateplanner/configurations/SecurityConfig.java @@ -97,7 +97,7 @@ public class SecurityConfig { .authorizeExchange(exchange -> exchange .anyExchange().permitAll() ) - .csrf(ServerHttpSecurity.CsrfSpec::disable) +// .csrf(ServerHttpSecurity.CsrfSpec::disable) .build(); } diff --git a/src/main/java/com/example/dateplanner/controllers/web/AccountController.java b/src/main/java/com/example/dateplanner/controllers/web/AccountController.java index 57f88dc..fb1961d 100644 --- a/src/main/java/com/example/dateplanner/controllers/web/AccountController.java +++ b/src/main/java/com/example/dateplanner/controllers/web/AccountController.java @@ -19,16 +19,5 @@ import java.util.Map; @RequiredArgsConstructor @RequestMapping("/account") public class AccountController { - @GetMapping("/login") - public Mono loginPage() { - Map model = new HashMap<>(); - model.put("title", "Login"); - model.put("index", "login"); - return Mono.just( - Rendering.view("template") - .model(model) - .build() - ); - } } diff --git a/src/main/resources/static/css/places.css b/src/main/resources/static/css/places.css new file mode 100644 index 0000000..4142c1c --- /dev/null +++ b/src/main/resources/static/css/places.css @@ -0,0 +1,73 @@ +.place-card { + border: none; + border-radius: 20px; + overflow: hidden; + transition: transform 0.3s, box-shadow 0.3s; + margin-bottom: 30px; + height: 100%; +} + +.place-card:hover { + transform: translateY(-10px); + box-shadow: 0 20px 40px rgba(0,0,0,0.15); +} + +.place-img { + height: 200px; + object-fit: cover; + width: 100%; +} + +.place-category { + position: absolute; + top: 15px; + right: 15px; + padding: 5px 15px; + border-radius: 20px; + font-size: 0.8rem; + font-weight: 600; +} + +.heart-counter { + position: absolute; + top: 10px; + left: 10px; + background: rgba(255,255,255,0.9); + padding: 5px 10px; + border-radius: 20px; + font-weight: 600; + font-size: 0.9rem; +} + +.heart-counter i { + color: #e74c3c; + margin-right: 5px; +} + +.rating { + color: #f1c40f; + font-size: 0.9rem; +} + +.price-tag { + font-weight: 700; + font-size: 1.2rem; + color: #e74c3c; +} + +.place-category { + position: absolute; + top: 15px; + right: 15px; + padding: 5px 15px; + border-radius: 20px; + font-size: 0.8rem; + font-weight: 600; +} + +.romantic-badge { background: #FD79A8FF; color: white; } +.active-badge { background: #2ECC71FF; color: white; } +.intellectual-badge { background: #3498DBFF; color: white; } +.horror-badge { background: #2C3E50FF; color: white; } +.cozy-badge { background: #E67E22FF; color: white; } +.mystery-badge { background: #9B59B6FF; color: white; } \ No newline at end of file diff --git a/src/main/resources/static/css/style.css b/src/main/resources/static/css/style.css index 81d0c80..7d98e0f 100644 --- a/src/main/resources/static/css/style.css +++ b/src/main/resources/static/css/style.css @@ -1,3 +1,4 @@ @import "fonts.css"; @import "main.css"; @import "header.css"; +@import "places.css"; diff --git a/src/main/resources/static/js/site/blocks/header.js b/src/main/resources/static/js/site/blocks/header.js index f72517b..33ef673 100644 --- a/src/main/resources/static/js/site/blocks/header.js +++ b/src/main/resources/static/js/site/blocks/header.js @@ -103,6 +103,7 @@ function initHeader($header){
+
diff --git a/src/main/resources/static/js/site/blocks/place-filters.js b/src/main/resources/static/js/site/blocks/place-filters.js index c6e798a..833c0e4 100644 --- a/src/main/resources/static/js/site/blocks/place-filters.js +++ b/src/main/resources/static/js/site/blocks/place-filters.js @@ -1,37 +1,35 @@ -function toggleCategoryFilter(filter) { - const btn = event.target.closest('.filter-btn'); - - if (btn.classList.contains('active')) { - btn.classList.remove('active'); - } else { - btn.classList.add('active'); - } -} - -function togglePriceFilter(filter) { - const btn = event.target.closest('.filter-btn'); - - if (btn.classList.contains('active')) { - btn.classList.remove('active'); - } else { - btn.classList.add('active'); - } -} - -function toggleTimeFilter(filter) { - const btn = event.target.closest('.filter-btn'); - - if (btn.classList.contains('active')) { - btn.classList.remove('active'); - } else { - btn.classList.add('active'); - } -} - -function initPlaceFilters($filtersContainer) { +let currentFilters = {category: [], price: [], time: []}; +export function initPlaceFilters($filtersContainer) { console.log("init places filters"); - const $filters = (` + // Одна общая функция для всех фильтров + function toggleFilter(event) { + const $btn = $(event.currentTarget); + $btn.toggleClass('active'); + + // Можно получить тип и значение фильтра + const type = $btn.data('type'); + const value = $btn.data('value'); + + console.log(`Фильтр: ${type} = ${value}, активен: ${$btn.hasClass('active')}`); + + // ОБНОВЛЯЕМ МАССИВ ФИЛЬТРОВ! + if ($btn.hasClass('active')) { + // Добавляем фильтр, если его еще нет + if (!currentFilters[type].includes(value)) { + currentFilters[type].push(value); + } + } else { + // Удаляем фильтр + currentFilters[type] = currentFilters[type].filter(item => item !== value); + } + + // Здесь можно обновить данные или сделать запрос + // Триггерим событие изменения фильтров + $(document).trigger('filtersChanged', [currentFilters]); + } + + const $filters = $(`
@@ -40,22 +38,22 @@ function initPlaceFilters($filtersContainer) {
Тип свидания
-
+
Романтическое
-
+
Активное
-
+
Интеллектуальное
-
+
Хоррор
-
+
Уютное
-
+
Тайна
@@ -63,23 +61,23 @@ function initPlaceFilters($filtersContainer) {
Бюджет
-
+
Эконом (до 2,000₽)
-
+
Премиум (от 5,000₽)
Время
-
+
День
-
+
Вечер
-
+
Ночь
@@ -89,5 +87,9 @@ function initPlaceFilters($filtersContainer) {
`); + + // Вешаем один обработчик на все кнопки + $filters.on('click', '.filter-btn', toggleFilter); + $filtersContainer.append($filters); } \ No newline at end of file diff --git a/src/main/resources/static/js/site/blocks/places-block.js b/src/main/resources/static/js/site/blocks/places-block.js new file mode 100644 index 0000000..45a0b92 --- /dev/null +++ b/src/main/resources/static/js/site/blocks/places-block.js @@ -0,0 +1,35 @@ +import {createCard} from "./single-place-card.js"; + +export function initPlacesBlock($container) { + console.log("initPlacesBlock") + $container.append( + $(` +
+
+ +
+
+ `) + ) + + function loadPlaces(filters = {}) { + $('#placesContainer').empty().append('
Загрузка...
'); + + // Задержка 500ms перед отрисовкой + setTimeout(() => { + $('#placesContainer').empty(); + console.log("новые фильтры в loadPlaces: ", filters) + for (let i = 0; i < 10; i++) { + $('#placesContainer').append($(createCard())); + } + }, 1500); + } + + $(document).on('filtersChanged', (e, filters) => { + console.log('Фильтры изменились:', filters); + loadPlaces(filters); + }); + + // первая загрузка + loadPlaces() +} \ No newline at end of file diff --git a/src/main/resources/static/js/site/blocks/single-place-card.js b/src/main/resources/static/js/site/blocks/single-place-card.js new file mode 100644 index 0000000..6e33202 --- /dev/null +++ b/src/main/resources/static/js/site/blocks/single-place-card.js @@ -0,0 +1,31 @@ +export function createCard() { + return ` +
+
+
+ Ресторан 'Панорама' +
Романтическое
+
+ 128 +
+
+
+
Ресторан 'Панорама'
+

Ресторан на 25-м этаже с панорамным видом на город. Идеальное место для романтического ужина при све...

+
+
+ + ★★★★½ + 4.8 + +
4500₽
+
+ +
+
+
+
+ ` +} \ No newline at end of file diff --git a/src/main/resources/static/js/site/pages/home/home.js b/src/main/resources/static/js/site/pages/home/home.js new file mode 100644 index 0000000..d5a5f3a --- /dev/null +++ b/src/main/resources/static/js/site/pages/home/home.js @@ -0,0 +1,6 @@ +import {initPlacesBlock} from "../../blocks/places-block.js"; +import {initPlaceFilters} from "../../blocks/place-filters.js"; + + +initPlaceFilters($('#mainPageContainer')); +initPlacesBlock($('#mainPageContainer')); \ No newline at end of file diff --git a/src/main/resources/templates/pages/home.html b/src/main/resources/templates/pages/home.html index d522803..1f4190a 100644 --- a/src/main/resources/templates/pages/home.html +++ b/src/main/resources/templates/pages/home.html @@ -28,7 +28,4 @@
- - \ No newline at end of file + \ No newline at end of file