Skip to content

Commit

Permalink
Media show in dashboard throwing class-based component (#20)
Browse files Browse the repository at this point in the history
- Showing all media in dashboard
- Use a class-based component to retrieve data that is fully independent and can be managed for further use.
  • Loading branch information
anisAronno authored Jan 1, 2024
1 parent 4d17167 commit 7451d9f
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.cache

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
'cache_expiry_time' => 1440,
'guard' => ['auth:api'],
'batch_delete_secret' => '1a463c2c-81b0-441e-9e4f-04691a7e5e0f',
'view_all_media_anyone' => false,
'view_all_media_anyone' => true,
];
1 change: 0 additions & 1 deletion public/build/assets/app-7IyCsEX6.css

This file was deleted.

1 change: 1 addition & 0 deletions public/build/assets/app-Y_YYTRtK.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/build/assets/app-aUp0Sp7t.css

This file was deleted.

2 changes: 1 addition & 1 deletion public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resources/css/app.css": {
"file": "assets/app-7IyCsEX6.css",
"file": "assets/app-Y_YYTRtK.css",
"isEntry": true,
"src": "resources/css/app.css"
},
Expand Down
3 changes: 2 additions & 1 deletion resources/views/components/modal.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'lg' => 'sm:max-w-lg',
'xl' => 'sm:max-w-xl',
'2xl' => 'sm:max-w-2xl',
'7xl' => 'sm:max-w-7xl',
][$maxWidth];
@endphp

Expand Down Expand Up @@ -46,7 +47,7 @@ class="fixed inset-0 overflow-y-auto px-4 py-6 sm:px-0 z-50" style="display: {{
</div>

<div x-show="show"
class="mb-6 bg-white dark:bg-gray-800 rounded-lg overflow-hidden shadow-xl transform transition-all sm:w-full {{ $maxWidth }} sm:mx-auto"
class="mb-6 bg-white dark:bg-gray-800 rounded-lg overflow-hidden shadow-xl transform transition-all sm:w-full {{ $maxWidth }} sm:mx-auto m-5"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100" x-transition:leave="ease-in duration-200"
Expand Down
22 changes: 22 additions & 0 deletions resources/views/components/sidebar-footer.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div class="hidden absolute bottom-0 left-0 justify-center p-4 space-x-4 w-full lg:flex bg-white dark:bg-gray-800 z-20">
<a href="#"
class="inline-flex justify-center p-2 text-gray-500 rounded cursor-pointer dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-600">
<svg aria-hidden="true" class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<path
d="M5 4a1 1 0 00-2 0v7.268a2 2 0 000 3.464V16a1 1 0 102 0v-1.268a2 2 0 000-3.464V4zM11 4a1 1 0 10-2 0v1.268a2 2 0 000 3.464V16a1 1 0 102 0V8.732a2 2 0 000-3.464V4zM16 3a1 1 0 011 1v7.268a2 2 0 010 3.464V16a1 1 0 11-2 0v-1.268a2 2 0 010-3.464V4a1 1 0 011-1z">
</path>
</svg>
</a>
<a href="#" data-tooltip-target="tooltip-settings"
class="inline-flex justify-center p-2 text-gray-500 rounded cursor-pointer dark:text-gray-400 dark:hover:text-white hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-600">
<x-icons.setting />

</a>
<div id="tooltip-settings" role="tooltip"
class="inline-block absolute invisible z-10 py-2 px-3 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 transition-opacity duration-300 tooltip">
Settings page
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
<!-- Dropdown -->
<x-language-dropdown />
</div>
32 changes: 5 additions & 27 deletions resources/views/components/sidebar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ class="inline-flex justify-center items-center w-5 h-5 text-xs font-semibold rou
</li>

<li>
<a href="#"
class="flex items-center p-2 text-base font-medium text-gray-900 rounded-lg transition duration-75 hover:bg-gray-100 dark:hover:bg-gray-700 dark:text-white group">
<a href="{{ route('admin.media.index') }}"
class="flex items-center p-2 text-base font-medium text-gray-900 rounded-lg transition duration-75 hover:bg-gray-100 dark:hover:bg-gray-700 dark:text-white group
{{ request()->routeIs('admin.media.index') ? 'bg-gray-200 dark:bg-gray-700' : '' }} active ">
<x-icons.media />
<span class="ml-3">Media</span>
<span class="ml-3">Media </span>
</a>
</li>
<li>
Expand Down Expand Up @@ -178,28 +179,5 @@ class="flex items-center p-2 pl-11 w-full text-base font-medium text-gray-900 ro

</ul>
</div>
<div
class="hidden absolute bottom-0 left-0 justify-center p-4 space-x-4 w-full lg:flex bg-white dark:bg-gray-800 z-20">
<a href="#"
class="inline-flex justify-center p-2 text-gray-500 rounded cursor-pointer dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-600">
<svg aria-hidden="true" class="w-6 h-6" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path
d="M5 4a1 1 0 00-2 0v7.268a2 2 0 000 3.464V16a1 1 0 102 0v-1.268a2 2 0 000-3.464V4zM11 4a1 1 0 10-2 0v1.268a2 2 0 000 3.464V16a1 1 0 102 0V8.732a2 2 0 000-3.464V4zM16 3a1 1 0 011 1v7.268a2 2 0 010 3.464V16a1 1 0 11-2 0v-1.268a2 2 0 010-3.464V4a1 1 0 011-1z">
</path>
</svg>
</a>
<a href="#" data-tooltip-target="tooltip-settings"
class="inline-flex justify-center p-2 text-gray-500 rounded cursor-pointer dark:text-gray-400 dark:hover:text-white hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-600">
<x-icons.setting />

</a>
<div id="tooltip-settings" role="tooltip"
class="inline-block absolute invisible z-10 py-2 px-3 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 transition-opacity duration-300 tooltip">
Settings page
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
<!-- Dropdown -->
<x-language-dropdown />
</div>
<x-sidebar-footer />
</aside>
4 changes: 1 addition & 3 deletions resources/views/dashboard/roles/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ class="flex items-center py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:
<div class="grid grid-cols-1 justify-between items-start md:items-center space-y-3 md:space-y-0 p-4 w-full text-gray-700 dark:text-gray-100"
aria-label="Table navigation">
@if ($roles->hasPages())
{{ $roles->links() }}
@else
<p class="text-center">All available data is currently displayed</p>
{{ $roles->links() }}
@endif
</div>
@else
Expand Down
5 changes: 3 additions & 2 deletions resources/views/dashboard/roles/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class="w-full flex flex-col md:flex-row items-center justify-between space-y-3 m
<div
class="w-full md:w-auto flex flex-col md:flex-row space-y-2 md:space-y-0 items-stretch md:items-center justify-end md:space-x-3 flex-shrink-0">
<h2 class="font-medium text-md xl:text-lg text-gray-950 dark:text-gray-100 ">All Permission for
<span class="text-blue-600 capitalize">{{ $role->name }}</span> Role </h2>
<span class="text-blue-600 capitalize">{{ $role->name }}</span> Role
</h2>
</div>
<div
class="w-full flex flex-col md:flex-row items-center justify-end space-y-3 md:space-y-0 md:space-x-4 p-4">
Expand Down Expand Up @@ -64,7 +65,7 @@ class="flex items-center justify-center text-white bg-primary-700 hover:bg-prima
@foreach ($role->permissions as $permission)
<div class="flex-shrink-0 grow">
<div
class="block p-6 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700 min-w-32 min-h-60 truncate">
class="block p-6 bg-white border border-gray-200 rounded-lg shadow hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700 min-w-32 min-h-60 truncate">
<h5
class="mb-3 text-2xl font-bold tracking-tight text-gray-900 dark:text-white capitalize underline underline-offset-8">
{{ $permission->group_name }}
Expand Down
4 changes: 1 addition & 3 deletions resources/views/dashboard/user/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ class="flex items-center py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:
<div class="grid grid-cols-1 justify-between items-start md:items-center space-y-3 md:space-y-0 p-4 w-full text-gray-700 dark:text-gray-100"
aria-label="Table navigation">
@if ($users->hasPages())
{{ $users->links() }}
@else
<p class="text-center">All available data is currently displayed</p>
{{ $users->links() }}
@endif
</div>
@else
Expand Down
1 change: 1 addition & 0 deletions routes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
Route::get('/', [DashboardController::class, 'index'])->middleware(['verified'])->name('dashboard');
Route::resource('roles', RolesController::class);
Route::resource('user', UserController::class);
Route::view('media', 'dashboard.media.index')->name('media.index');
});

0 comments on commit 7451d9f

Please sign in to comment.