From 0708337fc7f673a1efb437a1a8331dad7435df4b Mon Sep 17 00:00:00 2001 From: Roy Duineveld Date: Wed, 15 Jan 2025 16:34:02 +0100 Subject: [PATCH 001/244] WIP - Instantsearch migration --- composer.json | 10 +- lang/nl.json | 4 +- package.json | 4 +- resources/css/app.css | 1 - resources/css/components/pagination.css | 37 -- resources/js/components/Listing/Listing.vue | 54 +- resources/views/components/listing.blade.php | 25 +- resources/views/listing/filters.blade.php | 9 +- .../listing/partials/filter/boolean.blade.php | 66 +- .../listing/partials/filter/select.blade.php | 74 +-- .../views/listing/partials/item.blade.php | 4 +- .../listing/partials/pagination.blade.php | 47 ++ .../views/listing/partials/stats.blade.php | 30 +- resources/views/listing/products.blade.php | 28 +- src/Models/Product.php | 58 ++ .../Product/CastMultiselectAttributes.php | 13 + yarn.lock | 621 ++++-------------- 17 files changed, 411 insertions(+), 674 deletions(-) delete mode 100644 resources/css/components/pagination.css create mode 100644 resources/views/listing/partials/pagination.blade.php diff --git a/composer.json b/composer.json index ad465e611..a403fea58 100644 --- a/composer.json +++ b/composer.json @@ -17,18 +17,21 @@ "prefer-stable": true, "require": { "php": "^8.1|^8.2|^8.3", - "rapidez/laravel-multi-cache": "^1.0", "blade-ui-kit/blade-heroicons": "^2.4", + "http-interop/http-factory-guzzle": "^1.2", "illuminate/database": "^11.0", "illuminate/events": "^11.0", "illuminate/queue": "^11.0", "illuminate/support": "^11.0", "justbetter/laravel-http3earlyhints": "*", + "laravel/scout": "^10.11", "lcobucci/clock": "^2.0|^3.2", "lcobucci/jwt": "^4.0|^5.3", "mailerlite/laravel-elasticsearch": "^11.1", + "meilisearch/meilisearch-php": "^1.12", "rapidez/blade-components": "^1.0", "rapidez/blade-directives": "^1.0", + "rapidez/laravel-multi-cache": "^1.0", "tormjens/eventy": "^0.8" }, "require-dev": { @@ -53,7 +56,10 @@ } }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "php-http/discovery": true + } }, "extra": { "laravel": { diff --git a/lang/nl.json b/lang/nl.json index 400b346c2..922e5b792 100644 --- a/lang/nl.json +++ b/lang/nl.json @@ -111,5 +111,7 @@ "Yes": "Ja", "You don't have anything in your cart.": "Je hebt geen producten in je winkelwagen.", "You have filtered for:": "Je hebt gefilterd op:", - "Your order is currently:": "Je bestelling is op dit moment:" + "Your order is currently:": "Je bestelling is op dit moment:", + "First": "Eerste", + "Last": "Laatste" } diff --git a/package.json b/package.json index cc2656c64..0b83d84b9 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ "prod": "vite build" }, "devDependencies": { - "@appbaseio/reactivesearch-vue": "https://gitpkg.vercel.app/api/pkg?url=rapidez/reactivesearch/packages/vue&commit=fixes&scripts.postinstall=yarn%20install%20--ignore-scripts%20%26%26%20yarn%20run%20build-es&scripts.build-es=nps%20build.es", "@babel/core": "^7.23.9", "@hotwired/turbo": "^8.0.2", + "@meilisearch/instant-meilisearch": "^0.23.0", "@tailwindcss/forms": "^0.5.3", "@tailwindcss/typography": "^0.5.9", "@vitejs/plugin-vue2": "^2.2.0", @@ -20,6 +20,7 @@ "graphql": "^16.8.1", "graphql-combine-query": "indykoning/graphql-combine-query#feature/add-allowed-duplicates", "graphql-tag": "^2.12.6", + "instantsearch.js": "^4.75.7", "laravel-vite-plugin": "^1.0.5", "postcss": "^8.4.29", "postcss-import": "^16.1.0", @@ -33,6 +34,7 @@ "vue": "^2.7", "vue-clickaway": "^2.2.2", "vue-cookies": "^1.8.2", + "vue-instantsearch": "^4.19.13", "vue-template-compiler": "^2.7.14", "vue-turbolinks": "^2.2.2" }, diff --git a/resources/css/app.css b/resources/css/app.css index 0c0cd17d2..e35303a07 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -1,6 +1,5 @@ @import 'components/vue-slider'; @import 'components/price-slider'; -@import 'components/pagination'; @import 'components/autocomplete'; @tailwind base; diff --git a/resources/css/components/pagination.css b/resources/css/components/pagination.css deleted file mode 100644 index 1027377b5..000000000 --- a/resources/css/components/pagination.css +++ /dev/null @@ -1,37 +0,0 @@ -.pagination .pagination-button:first-child:nth-last-child(3), -.pagination .pagination-button:first-child:nth-last-child(3) ~ .pagination-button { - @apply hidden; -} - -.pagination { - @apply flex flex-wrap justify-center gap-x-2 !m-0 !my-6 max-md:gap-y-4; -} - -.pagination-button { - @apply !font-semibold !font-sans !border !border-border !rounded !bg-white !text !shadow; -} - -.pagination-button.active { - @apply !border !border-none !bg-primary !text-white !shadow-none; -} - -.pagination-button:first-child { - @apply !mr-auto max-md:w-full max-md:order-last; -} - -.pagination-button:last-child { - @apply !ml-auto max-md:w-full max-md:-order-1; -} - -.pagination-button:not(:first-child):not(:last-child) { - @apply !m-0 !size-14 max-md:flex-1 max-md:w-auto; -} - -.pagination-button:first-child, -.pagination-button:last-child { - @apply h-14 px-6 max-md:!m-0; -} - -.pagination-button[disabled] { - @apply opacity-60; -} diff --git a/resources/js/components/Listing/Listing.vue b/resources/js/components/Listing/Listing.vue index 0c0d69c0a..9b5588d59 100644 --- a/resources/js/components/Listing/Listing.vue +++ b/resources/js/components/Listing/Listing.vue @@ -1,25 +1,16 @@ diff --git a/resources/js/vue-components.js b/resources/js/vue-components.js index 9a400f4c7..fec46eb63 100644 --- a/resources/js/vue-components.js +++ b/resources/js/vue-components.js @@ -15,6 +15,8 @@ import graphql from './components/Graphql.vue' Vue.component('graphql', graphql) import graphqlMutation from './components/GraphqlMutation.vue' Vue.component('graphql-mutation', graphqlMutation) +import recursion from './components/Recursion.vue' +Vue.component('recursion', recursion) import notifications from './components/Notifications/Notifications.vue' Vue.component('notifications', notifications) diff --git a/resources/views/category/overview.blade.php b/resources/views/category/overview.blade.php index 84db698a3..d9230e3e5 100644 --- a/resources/views/category/overview.blade.php +++ b/resources/views/category/overview.blade.php @@ -11,10 +11,6 @@

{{ $category->name }}

@if ($category->is_anchor) - {{-- - The "query string query" is cleaner, - but will this work everywhere? - --}} @else
diff --git a/resources/views/components/filter/heading.blade.php b/resources/views/components/filter/heading.blade.php index 5da92c527..f7eaf45af 100644 --- a/resources/views/components/filter/heading.blade.php +++ b/resources/views/components/filter/heading.blade.php @@ -1,14 +1,19 @@ @slots(['title']) +{{-- TODO: Can't we use
with for this? --}} +{{-- +TODO: Double check these paddings; +why are they different? And why +do we've pb-4 wrapped around +it from the filters? +--}}