Skip to content

Commit

Permalink
feat: implement actions to add presentations on dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
alkrauss48 committed Apr 21, 2024
1 parent 761b5ce commit 08936be
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions app/Filament/Pages/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ public function getColumns(): int|string|array
protected function getHeaderActions(): array
{
return [
Actions\Action::make('create')
->label('New Presentation')
->url(route('filament.admin.resources.presentations.create'))
->icon('heroicon-m-plus')
->button(),
Actions\Action::make('Reset Filters')
->color('gray')
->action(function () {
Expand Down
14 changes: 11 additions & 3 deletions app/Filament/Widgets/TopViews.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Enums\PresentationFilter;
use App\Models\AggregateView;
use Filament\Tables;
use Filament\Tables\Actions\Action;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Filament\Widgets\Concerns\InteractsWithPageFilters;
Expand Down Expand Up @@ -78,8 +78,16 @@ public function table(Table $table): Table
'record' => $record->presentation,
])
)
->actions([
Tables\Actions\Action::make('View')
->emptyStateHeading('No presentations found')
->emptyStateDescription(null)
->emptyStateActions([
Action::make('create')
->label('Create Presentation')
->url(route('filament.admin.resources.presentations.create'))
->icon('heroicon-m-plus')
->button(),
])->actions([
Action::make('View')
->url(function (AggregateView $record): string {
if ($record->isInstructions) {
return route('home');
Expand Down

0 comments on commit 08936be

Please # to comment.