Skip to content

Commit

Permalink
Merge pull request #35 from lara-zeus/better-ui
Browse files Browse the repository at this point in the history
fix UI and the usage of plugin config in FE
  • Loading branch information
atmonshi authored Feb 9, 2024
2 parents 5cc3f30 + 9f438f7 commit 0409839
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion resources/views/filament/pages/builder.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ $this->mainWidgetForm }}

<div class="grid grid-cols-12 gap-4 w-full">
@foreach (\LaraZeus\DynamicDashboard\DynamicDashboardPlugin::get()->getModel('Columns')::all() as $layout)
@foreach (config('zeus-dynamic-dashboard.models.Columns')::all() as $layout)
<x-filament::section class="w-full {{ $layout->class }}">
<p>{{ $layout->name }}</p>
{{ $this->{'widgetsFrom'.$layout->key} }}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/filament/pages/dynamic-dashboard.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<x-filament::page>
@if($dashLayout->widgets !== null)
<div class="grid grid-cols-12 gap-2 w-full px-2">
@foreach (\LaraZeus\DynamicDashboard\DynamicDashboardPlugin::get()->getModel('Columns')::all() as $column)
@foreach (config('zeus-dynamic-dashboard.models.Columns')::all() as $column)
@if(isset($dashLayout->widgets[$column->key]))
@php
$widgetsItems = collect($dashLayout->widgets[$column->key])->sortBy('data.sort')->toArray();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div>
@if($dashLayout->widgets !== null)
<div class="grid grid-cols-12 gap-2 w-full px-2">
@foreach (\LaraZeus\DynamicDashboard\DynamicDashboardPlugin::get()->getModel('Columns')::all() as $column)
@foreach (config('zeus-dynamic-dashboard.models.Columns')::all() as $column)
@if(isset($dashLayout->widgets[$column->key]))
@php
$widgetsItems = collect($dashLayout->widgets[$column->key])->sortBy('data.sort')->toArray();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="space-y-3 bg-white dark:bg-black shadow my-10 py-3 px-4 hover:shadow-lg transition-all ease-in-out duration-500 ltr:rounded-tr-none rtl:rounded-tl-none rounded-3xl border border-primary-100 dark:border-primary-700/50">
<div>
@if($data['faqs'] !== null)
@foreach($data['faqs'] as $faq)
<x-filament::section class="my-4" collapsible :collapsed="$data['faqs']->count() >1">
<x-filament::section class="my-4" collapsible :collapsed="$data['faqs']->count() > 1">
<x-slot name="heading">
<h3 class="font-semibold">{{ $faq->question }}</h3>
</x-slot>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="my-4">
@if($data['form_slug'] !== null)
@php
$checkForm = \LaraZeus\Bolt\BoltPlugin::getModel('Form')::whereSlug($data['form_slug'])->first();
$checkForm = config('zeus-bolt.models.Form')::whereSlug($data['form_slug'])->first();
@endphp
@if($checkForm !== null)
<livewire:bolt.fill-form :inline="true" :slug="$checkForm->slug" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<div class="space-y-3 bg-white dark:bg-black shadow my-10 py-3 px-4 hover:shadow-lg transition-all ease-in-out duration-500 ltr:rounded-tr-none rtl:rounded-tl-none rounded-3xl border border-primary-100 dark:border-primary-700/50">

<div class="p-4 prose lg:prose-xl prose-primary dark:prose-invert">
<div class="max-w-none p-4 prose lg:prose-xl prose-primary dark:prose-invert">
{!! str($data['content'])->markdown() !!}
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="py-4">
<div>
@if(isset($data['url']))
<img alt="{{ $data['alt'] }}" src="{{ asset('storage/'.$data['url']) }}">
@endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="py-2 space-y-4">
<div>
@foreach($data['posts'] as $post)
<a href="{{ route('post',$post->slug) }}" class="group flex items-center justify-center gap-4">
@if($post->image() !== null && $data['show_thumbnail'])
Expand Down
5 changes: 2 additions & 3 deletions src/Livewire/Layouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace LaraZeus\DynamicDashboard\Livewire;

use Illuminate\View\View;
use LaraZeus\DynamicDashboard\DynamicDashboardPlugin;
use LaraZeus\DynamicDashboard\Models\Layout;
use Livewire\Component;

Expand All @@ -13,8 +12,8 @@ class Layouts extends Component

public function mount(?string $slug = null): void
{
$l = $slug ?? DynamicDashboardPlugin::get()->getDefaultLayout();
$this->dashLayout = DynamicDashboardPlugin::get()->getModel('Layout')::where('layout_slug', $l)->firstOrFail();
$l = $slug ?? config('zeus-dynamic-dashboard.defaultLayout');
$this->dashLayout = config('zeus-dynamic-dashboard.models.Layout')::where('layout_slug', $l)->firstOrFail();
}

public function render(): View
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/Classes/FaqWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function viewData(array $data): array
{
return [
// @phpstan-ignore-next-line
'faqs' => ($data['faq_cat'] !== null) ? \LaraZeus\Sky\SkyPlugin::get()->getModel('Faq')::withAnyTags([$data['faq_cat']], 'faq')->get() : null,
'faqs' => ($data['faq_cat'] !== null) ? config('zeus-sky.models.Faq')::withAnyTags([$data['faq_cat']], 'faq')->get() : null,
];
}
}
2 changes: 1 addition & 1 deletion src/Widgets/Classes/LibraryWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function viewData(array $data): array
{
return [
// @phpstan-ignore-next-line
'library' => ($data['library_slug'] !== null) ? \LaraZeus\Sky\SkyPlugin::get()->getModel('Library')::withAnyTags([$data['library_slug']], 'library')->get() : null,
'library' => ($data['library_slug'] !== null) ? config('zeus-sky.models.Library')::withAnyTags([$data['library_slug']], 'library')->get() : null,
];
}
}
2 changes: 1 addition & 1 deletion src/Widgets/Classes/MenuWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function viewData(array $data): array
{
return [
// @phpstan-ignore-next-line
'menu' => ($data['menu_slug'] !== null) ? \LaraZeus\Sky\SkyPlugin::get()->getModel('Navigation')::fromHandle($data['menu_slug']) : null,
'menu' => ($data['menu_slug'] !== null) ? config('zeus-sky.models.Navigation')::fromHandle($data['menu_slug']) : null,
];
}
}
6 changes: 3 additions & 3 deletions src/Widgets/Classes/PostsWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function form(): Builder\Block

Select::make('category')
// @phpstan-ignore-next-line
->options(\LaraZeus\Sky\SkyPlugin::get()->getModel('Tag')::query()
->options(config('zeus-sky.models.Tag')::query()
->withType('category')
->pluck('name', 'id')),

Expand All @@ -65,11 +65,11 @@ public function form(): Builder\Block
public function viewData(array $data): array
{
// @phpstan-ignore-next-line
$posts = \LaraZeus\Sky\SkyPlugin::get()->getModel('Post')::query();
$posts = config('zeus-sky.models.Post')::query();

if ($data['category'] !== null) {
// @phpstan-ignore-next-line
$category = \LaraZeus\Sky\SkyPlugin::get()->getModel('Tag')::where('type', 'category')->find($data['category']);
$category = config('zeus-sky.models.Tag')::where('type', 'category')->find($data['category']);
if ($category !== null) {
$posts = $category->postsPublished();
}
Expand Down

0 comments on commit 0409839

Please sign in to comment.