Skip to content

Commit

Permalink
Fixed menu loading issue..
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Nov 1, 2023
1 parent f911714 commit 24e8fbb
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 18 deletions.
@@ -1,4 +1,5 @@
<x-loading.content />

<div class="relative mt-4">
<x-form
id="{{ $formId }}"
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/index/container.blade.php
@@ -1,5 +1,5 @@
<x-loading.content />

<div {{ ((! $attributes->has('override')) || ($attributes->has('override') && ! in_array('class', explode(',', $attributes->get('override'))))) ? $attributes->merge(['class' => 'my-5']) : $attributes }}>
{!! $slot !!}
</div>

<x-loading.content />
12 changes: 8 additions & 4 deletions resources/views/components/layouts/admin/menu.blade.php
@@ -1,5 +1,7 @@
@props(['companies'])

<x-loading.menu />

<div class="container flex items-center py-3 mb-4 border-b-2 xl:hidden">
<span class="material-icons text-black js-hamburger-menu">menu</span>

Expand Down Expand Up @@ -29,7 +31,12 @@

<div
x-data="{ }"
x-init="setTimeout(() => $refs.realMenu.classList.remove('hidden'), 1000)"
x-init="() => {
const loadEvent = 'onpagehide' in window ? 'pageshow' : 'load';
window.addEventListener(loadEvent, () => {
$refs.realMenu.classList.remove('hidden');
});
}"
x-ref="realMenu"
class="w-70 h-screen flex hidden fixed top-0 js-menu z-20 xl:z-10 transition-all ltr:-left-80 rtl:-right-80 xl:ltr:left-0 xl:rtl:right-0"
>
Expand Down Expand Up @@ -276,7 +283,4 @@ class="flex flex-col items-center justify-center mb-5 cursor-pointer menu-button
<div class="fixed w-full h-full invisible lg:hidden js-menu-background" style="background-color: rgba(0, 0, 0, 0.5); z-index: -1;"></div>
</div>

<x-loading.menu />

@stack('menu_end')

16 changes: 10 additions & 6 deletions resources/views/components/layouts/portal/menu.blade.php
@@ -1,5 +1,7 @@
@props(['companies'])

<x-loading.menu />

<div class="container flex items-center py-3 mb-4 border-b-2 xl:hidden">
<span class="material-icons text-black js-hamburger-menu">menu</span>

Expand All @@ -13,7 +15,12 @@

<div
x-data="{ }"
x-init="setTimeout(() => $refs.realMenu.classList.remove('hidden'), 1000)"
x-init="() => {
const loadEvent = 'onpagehide' in window ? 'pageshow' : 'load';
window.addEventListener(loadEvent, () => {
$refs.realMenu.classList.remove('hidden');
});
}"
x-ref="realMenu"
class="w-70 h-screen flex hidden fixed top-0 js-menu z-20 xl:z-10 transition-all ltr:-left-80 rtl:-right-80 xl:ltr:left-0 xl:rtl:right-0"
>
Expand Down Expand Up @@ -63,13 +70,13 @@ class="flex flex-col items-center justify-center mb-5 cursor-pointer menu-button
</button>
</x-tooltip>
@endcan

<x-tooltip id="tooltip-search" placement="right" message="{{ trans('general.search') }}">
<button type="button" class="flex items-center menu-button justify-center w-8 h-8 mb-2.5 relative cursor-pointer outline-none">
<span name="search" class="material-icons-outlined text-purple text-2xl pointer-events-none">search</span>
</button>
</x-tooltip>

<x-tooltip id="tooltip-support" placement="right" message="{{ trans('general.help') }}">
<x-link href="{{ url(trans('header.support_link')) }}" target="_blank" class="flex items-center justify-center w-8 h-8 mb-2.5 cursor-pointer js-menu-toggles" override="class">
<span class="material-icons-outlined text-purple text-2xl pointer-events-none">support</span>
Expand Down Expand Up @@ -179,7 +186,4 @@ class="flex flex-col items-center justify-center mb-5 cursor-pointer menu-button
<div class="fixed w-full h-full invisible lg:hidden js-menu-background" style="background-color: rgba(0, 0, 0, 0.5); z-index: -1;"></div>
</div>

<x-loading.menu />

@stack('menu_end')

11 changes: 7 additions & 4 deletions resources/views/components/loading/menu.blade.php
@@ -1,9 +1,12 @@
<div
x-data="{ loaded: false }"
x-init="window.addEventListener('load', () => {
loaded = true;
$refs.loadingMenu.remove();
})"
x-init="() => {
const loadEvent = 'onpagehide' in window ? 'pageshow' : 'load';
window.addEventListener(loadEvent, () => {
loaded = true;
$refs.loadingMenu.remove();
});
}"
x-ref="loadingMenu"
class="w-70 h-screen hidden lg:flex fixed top-0 js-menu z-20 transition-all ltr:-left-80 rtl:-right-80 xl:ltr:left-0 xl:rtl:right-0"
>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/reports/show.blade.php
Expand Up @@ -65,11 +65,11 @@

<x-slot name="content">
<div class="my-10">
<x-loading.content />

@include($class->views['filter'])

@include($class->views[$class->type])

<x-loading.content />
</div>
</x-slot>

Expand Down
1 change: 1 addition & 0 deletions resources/views/components/show/content/right.blade.php
Expand Up @@ -2,5 +2,6 @@
@if (! isset($attributes['disable-loading']))
<x-loading.absolute />
@endif

{!! $slot !!}
</div>

0 comments on commit 24e8fbb

Please sign in to comment.