From 78b393aabf923a116abc6aad69dade86cd9718a2 Mon Sep 17 00:00:00 2001 From: Jere Ljungberg Date: Tue, 10 Dec 2024 08:41:55 +0200 Subject: [PATCH 1/4] UHF-10772: Add events list to Helsinki near you * Add template that embeds linkedevents app * Add new variables to drupalSettings * Add translations --- .../HelsinkiNearYouResultsController.php | 19 +++++++++---- .../custom/helfi_etusivu/translations/fi.po | 12 +++++++++ .../custom/helfi_etusivu/translations/sv.po | 12 +++++++++ .../helsinki-near-you-results-page.html.twig | 27 +++++++++++++++++++ 4 files changed, 65 insertions(+), 5 deletions(-) diff --git a/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php b/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php index a4798a99..66c5f604 100644 --- a/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php +++ b/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php @@ -70,13 +70,22 @@ public function content(Request $request) : array|RedirectResponse { return [ '#attached' => [ 'drupalSettings' => [ - 'helsinki_near_you' => [ - 'events_api_url' => $this->linkedEvents->getEventsRequest([ - 'dwithin_origin' => $addressData['coordinates'], - 'dwithin_distance' => 1000, - ]), + 'helfi_events' => [ + 'base_url' => LinkedEvents::BASE_URL, + 'data' => [ + 'helfi-coordinates-based-event-list' => [ + 'events_api_url' => $this->linkedEvents->getEventsRequest([ + 'dwithin_origin' => $addressData['coordinates'], + 'dwithin_distance' => 1000, + ]), + 'field_event_count' => 3, + ], + ], + 'useBorderedCards' => TRUE, + 'seeAllButtonOverride' => $this->t('See all events', [], ['context' => 'Helsinki near you']), ], ], + 'library' => ['hdbt/event-list'], ], '#back_link_label' => $this->t('Edit address', [], ['context' => 'Helsinki near you']), '#back_link_url' => $return_url, diff --git a/public/modules/custom/helfi_etusivu/translations/fi.po b/public/modules/custom/helfi_etusivu/translations/fi.po index 99291971..b957d866 100644 --- a/public/modules/custom/helfi_etusivu/translations/fi.po +++ b/public/modules/custom/helfi_etusivu/translations/fi.po @@ -88,3 +88,15 @@ msgstr "Antamallasi osoitteella ei löytynyt tuloksia. Voit kokeilla muuttaa hak msgctxt "Helsinki near you" msgid "Search" msgstr "Hae" + +msgctxt "Helsinki near you" +msgid "See all events" +msgstr "Katso kaikki tapahtumat" + +msgctxt "Helsinki near you" +msgid "Events near you" +msgstr "Tapahtumat lähelläsi" + +msgctxt "Helsinki near you" +msgid "Browse events near you, sorted by their start time" +msgstr "Tutustu tapahtumiin tapahtumisajan mukaisessa järjestyksessä." diff --git a/public/modules/custom/helfi_etusivu/translations/sv.po b/public/modules/custom/helfi_etusivu/translations/sv.po index 40f82ddc..569ed011 100644 --- a/public/modules/custom/helfi_etusivu/translations/sv.po +++ b/public/modules/custom/helfi_etusivu/translations/sv.po @@ -77,3 +77,15 @@ msgstr "Adressen du angav gav inga resultat. Du kanske vill prova en annan adres msgctxt "Helsinki near you" msgid "Search" msgstr "Söka" + +msgctxt "Helsinki near you" +msgid "See all events" +msgstr "Se alla evenemang" + +msgctxt "Helsinki near you" +msgid "Events near you" +msgstr "Evenemang nära dig" + +msgctxt "Helsinki near you" +msgid "Browse events near you, sorted by their start time" +msgstr "Utforska evenemang i ordning efter deras starttid." diff --git a/public/themes/custom/hdbt_subtheme/templates/module/helfi-etusivu/helsinki-near-you-results-page.html.twig b/public/themes/custom/hdbt_subtheme/templates/module/helfi-etusivu/helsinki-near-you-results-page.html.twig index 70da59f0..249db1c3 100644 --- a/public/themes/custom/hdbt_subtheme/templates/module/helfi-etusivu/helsinki-near-you-results-page.html.twig +++ b/public/themes/custom/hdbt_subtheme/templates/module/helfi-etusivu/helsinki-near-you-results-page.html.twig @@ -16,5 +16,32 @@ } %} {% endblock component_content %} {% endembed %} + {% embed "@hdbt/misc/component.twig" with + { + component_classes: [ + 'component--full-width', + 'component--react-search', + 'component--event-list', + ], + component_title: 'Events near you'|trans({}, {'context': 'Helsinki near you'}), + component_description: 'Browse events near you, sorted by their start time'|trans({}, {'context': 'Helsinki near you'}), + component_content_class: 'event-list', + } + %} + {% block component_content %} + {# Hook React app to this div #} + + {# Indicate JS not enabled #} + + {% endblock %} + {% endembed %} From cbebd97840128b0d7426af87761666886456b4bd Mon Sep 17 00:00:00 2001 From: Jere Ljungberg Date: Tue, 10 Dec 2024 10:16:48 +0200 Subject: [PATCH 2/4] UHF-10772: Fix settings base url for linkedevents --- .../src/Controller/HelsinkiNearYouResultsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php b/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php index 66c5f604..5ed23ee4 100644 --- a/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php +++ b/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php @@ -71,7 +71,7 @@ public function content(Request $request) : array|RedirectResponse { '#attached' => [ 'drupalSettings' => [ 'helfi_events' => [ - 'base_url' => LinkedEvents::BASE_URL, + 'baseUrl' => LinkedEvents::BASE_URL, 'data' => [ 'helfi-coordinates-based-event-list' => [ 'events_api_url' => $this->linkedEvents->getEventsRequest([ From e9ef00ff99fccdb37cb2306d97c01851383d7d3d Mon Sep 17 00:00:00 2001 From: Jere Ljungberg Date: Tue, 10 Dec 2024 11:12:48 +0200 Subject: [PATCH 3/4] UHF-10772: Set events radius to 2km --- .../src/Controller/HelsinkiNearYouResultsController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php b/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php index 5ed23ee4..991f9180 100644 --- a/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php +++ b/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php @@ -75,8 +75,8 @@ public function content(Request $request) : array|RedirectResponse { 'data' => [ 'helfi-coordinates-based-event-list' => [ 'events_api_url' => $this->linkedEvents->getEventsRequest([ - 'dwithin_origin' => $addressData['coordinates'], - 'dwithin_distance' => 1000, + 'dwithin_origin' => implode(',', $addressData['coordinates']), + 'dwithin_metres' => 2000, ]), 'field_event_count' => 3, ], From 95236951596752816fdab83d8523a3efcfed9294 Mon Sep 17 00:00:00 2001 From: Jere Ljungberg Date: Wed, 11 Dec 2024 15:22:39 +0200 Subject: [PATCH 4/4] UHF-10772: Coordinates-based event list tweaks * No longer use bordered cards setting * Add class to component --- .../src/Controller/HelsinkiNearYouResultsController.php | 2 +- .../helfi-etusivu/helsinki-near-you-results-page.html.twig | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php b/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php index 991f9180..286aed5f 100644 --- a/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php +++ b/public/modules/custom/helfi_etusivu/src/Controller/HelsinkiNearYouResultsController.php @@ -81,8 +81,8 @@ public function content(Request $request) : array|RedirectResponse { 'field_event_count' => 3, ], ], - 'useBorderedCards' => TRUE, 'seeAllButtonOverride' => $this->t('See all events', [], ['context' => 'Helsinki near you']), + 'useExperimentalGhosts' => TRUE, ], ], 'library' => ['hdbt/event-list'], diff --git a/public/themes/custom/hdbt_subtheme/templates/module/helfi-etusivu/helsinki-near-you-results-page.html.twig b/public/themes/custom/hdbt_subtheme/templates/module/helfi-etusivu/helsinki-near-you-results-page.html.twig index 249db1c3..62960b47 100644 --- a/public/themes/custom/hdbt_subtheme/templates/module/helfi-etusivu/helsinki-near-you-results-page.html.twig +++ b/public/themes/custom/hdbt_subtheme/templates/module/helfi-etusivu/helsinki-near-you-results-page.html.twig @@ -22,6 +22,7 @@ 'component--full-width', 'component--react-search', 'component--event-list', + 'component--coordinates-based-event-list', ], component_title: 'Events near you'|trans({}, {'context': 'Helsinki near you'}), component_description: 'Browse events near you, sorted by their start time'|trans({}, {'context': 'Helsinki near you'}),