Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slow rendering of catalog filter #1025

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/Helpers/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ function utrans($str)
return mb_ucfirst(trans($str));
}

function mb_ucfirst($str) {
$str = mb_strtoupper(mb_substr($str, 0, 1)) . mb_substr($str, 1);
return $str;
if (!function_exists('mb_ucfirst')) {
function mb_ucfirst($str) {
$str = mb_strtoupper(mb_substr($str, 0, 1)) . mb_substr($str, 1);
return $str;
}
}

function isValidURL($url)
Expand Down
44 changes: 35 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"vue": "^3.2.47"
},
"dependencies": {
"@popperjs/core": "^2.11.7",
"axios": "^1.6.0",
"bootstrap": "^3.4.1",
"clipboard": "^2.0.6",
Expand All @@ -34,6 +33,7 @@
"debounce": "1.2.0",
"flickity": "^2.2.1",
"flickity-imagesloaded": "^2.0.0",
"floating-vue": "^5.2.2",
"imagesloaded": "^4.1.4",
"infinite-scroll": "^3.0.6",
"isotope-layout": "^3.0.6",
Expand Down
8 changes: 8 additions & 0 deletions resources/css/app-tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
@import './fonts.css';

@tailwind components;

.v-popper__popper.v-popper--theme-dropdown .v-popper__arrow-container {
@apply tw-hidden;
}
.v-popper__popper.v-popper--theme-dropdown .v-popper__inner {
@apply tw-bg-transparent tw-shadow-none tw-border-0 tw-rounded-none;
}

@tailwind utilities;

@layer base {
Expand Down
5 changes: 4 additions & 1 deletion resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ import CopyToClipboardLink from './components/CopyToClipboardLink.vue'
import BottomModal from './components/BottomModal.vue'
import NewsletterSignupFormController from './components/newsletter-signup/FormController.vue'
import NewsletterSignupBottomModalController from './components/newsletter-signup/BottomModalController.vue'
import { Menu } from 'floating-vue'

import 'floating-vue/dist/style.css'

createApp({
compilerOptions: {
Expand All @@ -81,7 +84,7 @@ createApp({
},
})
.use(ZiggyVue)

.component('VMenu', Menu)
.component('featured-piece-click-tracker', FeaturedPieceClickTracker)
.component('filter-sort-by', FilterSortBy)
.component('filter-checkbox', FilterCheckbox)
Expand Down
43 changes: 18 additions & 25 deletions resources/js/components/catalog-new/Popover.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import { ref } from 'vue'
import { PopoverRoot, PopoverTrigger, PopoverPortal, PopoverContent } from 'radix-vue'
import { Menu as VMenu } from 'floating-vue'

import CaretUpIcon from './icons/CaretUp.vue'

Expand All @@ -13,9 +13,17 @@ const isOpen = ref(false)
</script>

<template>
<PopoverRoot @update:open="($open) => (isOpen = $open)">
<VMenu
:triggers="['click']"
:shown="isOpen"
:distance="10"
placement="bottom-start"
@show="isOpen = true"
@hide="isOpen = false"
:delay="0"
>
<div class="tw-border" :class="[isOpen ? 'tw-border-gray-800' : 'tw-border-transparent']">
<PopoverTrigger
<button
class="tw-border tw-bg-white tw-py-2.5 tw-px-4 hover:tw-border-gray-800"
:class="[isOpen || isActive ? 'tw-border-gray-800' : 'tw-border-gray-300']"
>
Expand All @@ -26,29 +34,14 @@ const isOpen = ref(false)
:class="[isOpen ? 'tw-fill-sky-300' : 'tw-rotate-180']"
/>
</div>
</PopoverTrigger>
</button>
</div>

<PopoverPortal>
<!-- PopoverPortal teleports outside of .tailwind-rules scope -->
<template #popper>
<div class="tailwind-rules">
<Transition
class="tw-origin-[var(--radix-popover-content-transform-origin)]"
enter-from-class="tw-opacity-0"
leave-to-class="tw-opacity-0"
enter-active-class="tw-transition-opacity tw-duration-100"
leave-active-class="tw-transition-opacity tw-duration-100"
>
<PopoverContent
side="bottom"
align="start"
:side-offset="10"
class="tw-hidden md:tw-block tw-border-2 tw-border-gray-800 tw-bg-white tw-p-6 tw-mr-8 -tw-ml-px"
>
<slot name="content"></slot>
</PopoverContent>
</Transition>
<div class="tw-hidden md:tw-block tw-border-2 tw-border-gray-800 tw-bg-white tw-p-6 tw-mr-8">
<slot name="content"></slot>
</div>
</div>
</PopoverPortal>
</PopoverRoot>
</template>
</VMenu>
</template>
File renamed without changes.