Skip to content

Commit

Permalink
feat: panel dashboard refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
CS76 committed Apr 9, 2024
1 parent 62b71b0 commit 4ae8f18
Show file tree
Hide file tree
Showing 41 changed files with 260 additions and 87 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Filament\Imports;
namespace App\Filament\Dashboard\Imports;

use App\Events\ImportedCSVProcessed;
use App\Models\Entry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace App\Filament\Resources;
namespace App\Filament\Dashboard\Resources;

use App\Filament\Resources\CitationResource\Pages;
use App\Filament\Resources\CitationResource\RelationManagers\CollectionRelationManager;
use App\Filament\Resources\CitationResource\RelationManagers\MoleculeRelationManager;
use App\Filament\Dashboard\Resources\CitationResource\Pages;
use App\Filament\Dashboard\Resources\CitationResource\RelationManagers\CollectionRelationManager;
use App\Filament\Dashboard\Resources\CitationResource\RelationManagers\MoleculeRelationManager;
use App\Models\Citation;
use Filament\Forms\Components\TextArea;
use Filament\Forms\Components\TextInput;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\CitationResource\Pages;
namespace App\Filament\Dashboard\Resources\CitationResource\Pages;

use App\Filament\Resources\CitationResource;
use App\Filament\Dashboard\Resources\CitationResource;
use Filament\Resources\Pages\CreateRecord;

class CreateCitation extends CreateRecord
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\CitationResource\Pages;
namespace App\Filament\Dashboard\Resources\CitationResource\Pages;

use App\Filament\Resources\CitationResource;
use App\Filament\Dashboard\Resources\CitationResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\CitationResource\Pages;
namespace App\Filament\Dashboard\Resources\CitationResource\Pages;

use App\Filament\Resources\CitationResource;
use App\Filament\Dashboard\Resources\CitationResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Filament\Resources\CitationResource\RelationManagers;
namespace App\Filament\Dashboard\Resources\CitationResource\RelationManagers;

use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Filament\Resources\CitationResource\RelationManagers;
namespace App\Filament\Dashboard\Resources\CitationResource\RelationManagers;

use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace App\Filament\Resources;
namespace App\Filament\Dashboard\Resources;

use App\Filament\Resources\CollectionResource\Pages;
use App\Filament\Resources\CollectionResource\RelationManagers\CitationsRelationManager;
use App\Filament\Resources\CollectionResource\RelationManagers\EntriesRelationManager;
use App\Filament\Dashboard\Resources\CollectionResource\Pages;
use App\Filament\Dashboard\Resources\CollectionResource\RelationManagers\CitationsRelationManager;
use App\Filament\Dashboard\Resources\CollectionResource\RelationManagers\EntriesRelationManager;
use App\Models\Collection;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\CollectionResource\Pages;
namespace App\Filament\Dashboard\Resources\CollectionResource\Pages;

use App\Filament\Resources\CollectionResource;
use App\Filament\Dashboard\Resources\CollectionResource;
use Filament\Resources\Pages\CreateRecord;

class CreateCollection extends CreateRecord
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace App\Filament\Resources\CollectionResource\Pages;
namespace App\Filament\Dashboard\Resources\CollectionResource\Pages;

use App\Filament\Resources\CollectionResource;
use App\Filament\Resources\CollectionResource\Widgets\EntriesOverview;
use App\Filament\Dashboard\Resources\CollectionResource;
use App\Filament\Dashboard\Resources\CollectionResource\Widgets\EntriesOverview;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\CollectionResource\Pages;
namespace App\Filament\Dashboard\Resources\CollectionResource\Pages;

use App\Filament\Resources\CollectionResource;
use App\Filament\Dashboard\Resources\CollectionResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Filament\Resources\CollectionResource\RelationManagers;
namespace App\Filament\Dashboard\Resources\CollectionResource\RelationManagers;

use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Filament\Resources\CollectionResource\RelationManagers;
namespace App\Filament\Dashboard\Resources\CollectionResource\RelationManagers;

use App\Filament\Imports\EntryImporter;
use Filament\Forms;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Filament\Resources\CollectionResource\Widgets;
namespace App\Filament\Dashboard\Resources\CollectionResource\Widgets;

use App\Models\Collection;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources;
namespace App\Filament\Dashboard\Resources;

use App\Filament\Resources\EntryResource\Pages;
use App\Filament\Dashboard\Resources\EntryResource\Pages;
use App\Models\Entry;
use Filament\Infolists;
use Filament\Infolists\Infolist;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\EntryResource\Pages;
namespace App\Filament\Dashboard\Resources\EntryResource\Pages;

use App\Filament\Resources\EntryResource;
use App\Filament\Dashboard\Resources\EntryResource;
use Filament\Resources\Pages\CreateRecord;

class CreateEntry extends CreateRecord
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\EntryResource\Pages;
namespace App\Filament\Dashboard\Resources\EntryResource\Pages;

use App\Filament\Resources\EntryResource;
use App\Filament\Dashboard\Resources\EntryResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\EntryResource\Pages;
namespace App\Filament\Dashboard\Resources\EntryResource\Pages;

use App\Filament\Resources\EntryResource;
use App\Filament\Dashboard\Resources\EntryResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\EntryResource\Pages;
namespace App\Filament\Dashboard\Resources\EntryResource\Pages;

use App\Filament\Resources\EntryResource;
use App\Filament\Dashboard\Resources\EntryResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace App\Filament\Resources;
namespace App\Filament\Dashboard\Resources;

use App\Filament\Resources\MoleculeResource\Pages;
use App\Filament\Resources\MoleculeResource\RelationManagers\CitationsRelationManager;
use App\Filament\Resources\MoleculeResource\RelationManagers\CollectionsRelationManager;
use App\Filament\Resources\MoleculeResource\RelationManagers\MoleculesRelationManager;
use App\Filament\Resources\MoleculeResource\RelationManagers\PropertiesRelationManager;
use App\Filament\Dashboard\Resources\MoleculeResource\Pages;
use App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers\CitationsRelationManager;
use App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers\CollectionsRelationManager;
use App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers\MoleculesRelationManager;
use App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers\PropertiesRelationManager;
use App\Models\Molecule;
use Filament\Forms\Components\TextArea;
use Filament\Forms\Components\TextInput;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\MoleculeResource\Pages;
namespace App\Filament\Dashboard\Resources\MoleculeResource\Pages;

use App\Filament\Resources\MoleculeResource;
use App\Filament\Dashboard\Resources\MoleculeResource;
use Filament\Resources\Pages\CreateRecord;

class CreateMolecule extends CreateRecord
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\MoleculeResource\Pages;
namespace App\Filament\Dashboard\Resources\MoleculeResource\Pages;

use App\Filament\Resources\MoleculeResource;
use App\Filament\Dashboard\Resources\MoleculeResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Filament\Resources\MoleculeResource\Pages;
namespace App\Filament\Dashboard\Resources\MoleculeResource\Pages;

use App\Filament\Resources\MoleculeResource;
use App\Filament\Dashboard\Resources\MoleculeResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Filament\Resources\MoleculeResource\RelationManagers;
namespace App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers;

use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Filament\Resources\MoleculeResource\RelationManagers;
namespace App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers;

use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Filament\Resources\MoleculeResource\RelationManagers;
namespace App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers;

use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Filament\Resources\MoleculeResource\RelationManagers;
namespace App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers;

use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/ImportEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function fetchCitation($doi, $molecule)

//check if citation already exists
$citation = Citation::where('doi', $doi)->first();
$citationResponse = null;
$citationResponse = null;
if (! $citation) {
// fetch citation from EuropePMC
$europemcUrl = env('EUROPEPMC_WS_API');
Expand Down
36 changes: 27 additions & 9 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace App\Providers;

use BezhanSalleh\PanelSwitch\PanelSwitch;
use Filament\Facades\Filament;
use Filament\Navigation\NavigationGroup;
use Filament\Navigation\UserMenuItem;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
Expand All @@ -22,15 +23,32 @@ public function register(): void
public function boot(): void
{
Filament::serving(function () {
Filament::registerNavigationGroups([
NavigationGroup::make()
->label('Data'),
NavigationGroup::make()
->label('Settings'),
NavigationGroup::make()
->label('Debugger'),

Filament::registerUserMenuItems([
UserMenuItem::make()
->label('Profile')
->url('/user/profile')
->icon('heroicon-s-cog'),
]);
});

PanelSwitch::configureUsing(function (PanelSwitch $panelSwitch) {
$panelSwitch
->modalWidth('sm')
->slideOver()
->icons([
'control-panel' => 'heroicon-s-cog',
'dashboard' => 'heroicon-s-building-office-2',
])
->iconSize(16)
->labels([
'control-panel' => 'Control Panel',
'dashboard' => 'Coconut Dashboard',
])
->visible(fn (): bool => auth()->user()?->hasAnyRole([
'super_admin',
'admin',
'dev',
]));
});
}
}
14 changes: 10 additions & 4 deletions app/Providers/Filament/AdminPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->id('control-panel')
->path('control-panel')
->colors([
'primary' => Color::Teal,
])
Expand Down Expand Up @@ -68,7 +68,13 @@ public function panel(Panel $panel): Panel
Authenticate::class,
])
->databaseNotifications()
->brandLogo(asset('img/logo.png'))
->sidebarCollapsibleOnDesktop();
->brandLogo(asset('img/logo.svg'))
->brandLogoHeight('3rem')
->darkMode(false)
->sidebarCollapsibleOnDesktop()
->renderHook(
'panels::body.end',
fn (): string => view('components.tawk-chat')
);
}
}
Loading

0 comments on commit 4ae8f18

Please sign in to comment.