Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Apr 26, 2024
1 parent bf8bbf3 commit 0c4a88e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
10 changes: 8 additions & 2 deletions web/app/Filament/Pages/Modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Modules extends Page

protected function getViewData(): array
{

$scanModules = scandir(base_path('Modules'));
$scanModules = array_diff($scanModules, ['.', '..']);

Expand All @@ -47,13 +46,20 @@ protected function getViewData(): array
if (isset($moduleJson['category'])) {
$category = $moduleJson['category'];
}
$url = '';
$installed = 0;
$findModule = Module::where('name', $module)->first();
if ($findModule) {
$installed = 1;
}
$modules[$category][] = [
'name' => $module,
'description' => 'A drag and drop website builder and a powerful next-generation CMS.',
'url' => url('admin/' . $module),
'url' => $url,
'iconUrl' => url('images/modules/' . $module . '.png'),
'logoIcon' => $logoIcon,
'category' => 'Content Management',
'installed'=>$installed,
];
}

Expand Down
13 changes: 10 additions & 3 deletions web/resources/views/filament/pages/modules.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ class="text-left text-sm font-medium text-gray-950 dark:text-yellow-500 h-[20rem

<div class="grid grid-cols-3 gap-6 mb-6">
@foreach($modules as $module)
<div class="sm:flex gap-2 px-6 py-6 rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10">
<div class="sm:flex gap-3 px-6 py-6 rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10">
<div class="mb-2">
<div class="w-12">
<div class="flex flex-col items-center w-16">
<x-filament::icon :icon="$module['logoIcon']"
class="w-12 h-12 text-primary-500"/>
@if ($module['installed'])
<x-filament::badge class="bg-green-500 text-white mt-2">Installed</x-filament::badge>
@endif
</div>
</div>
<div class="flex justify-between w-full">
<div class="flex justify-between items-center w-full">
<div class="flex flex-col">
<p>
{{$module['name']}}
Expand All @@ -71,7 +74,11 @@ class="w-12 h-12 text-primary-500"/>
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24">
<path fill="currentColor" d="M11 2v5H8l4 4l4-4h-3V2h7a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm8 14H5v4h14zm-2 1v2h-2v-2z"></path>
</svg>
@if ($module['installed'])
Reinstall
@else
Install
@endif
</div>
</x-filament::dropdown.list.item>
</x-filament::dropdown.list>
Expand Down

0 comments on commit 0c4a88e

Please sign in to comment.