Skip to content

Commit

Permalink
Revert "Merge pull request #3454 from filamentphp/notifications-actio…
Browse files Browse the repository at this point in the history
…n-group"

This reverts commit d02cbfa, reversing
changes made to 83409d9.
  • Loading branch information
danharrin committed Aug 31, 2022
1 parent 19a6e87 commit dee193f
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 96 deletions.
5 changes: 1 addition & 4 deletions packages/notifications/docs/01-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ You're now ready to start [sending notifications](sending-notifications)!
The package uses the following dependencies:

- [Alpine.js](https://alpinejs.dev)
- [Alpine Floating UI](https://github.com/awcodes/alpine-floating-ui)
- [Tailwind CSS](https://tailwindcss.com)

You may install these through NPM:
Expand Down Expand Up @@ -147,14 +146,12 @@ In `/resources/css/app.css`, import [Tailwind CSS](https://tailwindcss.com):

### Configuring scripts

In `/resources/js/app.js`, import [Alpine.js](https://alpinejs.dev), Alpine Floating UI and the `filament/notifications` plugin, and register them:
In `/resources/js/app.js`, import [Alpine.js](https://alpinejs.dev) and the `filament/notifications` plugin, and register it:

```js
import Alpine from 'alpinejs'
import AlpineFloatingUI from '@awcodes/alpine-floating-ui'
import NotificationsAlpinePlugin from '../../vendor/filament/notifications/dist/module.esm'

Alpine.plugin(AlpineFloatingUI)
Alpine.plugin(NotificationsAlpinePlugin)

window.Alpine = Alpine
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 0 additions & 7 deletions packages/notifications/src/Actions/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ public function button(): static
return $this;
}

public function grouped(): static
{
$this->view('notifications::actions.grouped-action');

return $this;
}

public function link(): static
{
$this->view('notifications::actions.link-action');
Expand Down
41 changes: 0 additions & 41 deletions packages/notifications/src/Actions/ActionGroup.php

This file was deleted.

8 changes: 3 additions & 5 deletions packages/notifications/src/Concerns/HasActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
namespace Filament\Notifications\Concerns;

use Closure;
use Filament\Notifications\Actions\ActionGroup;
use Illuminate\Support\Arr;

trait HasActions
{
protected array | ActionGroup | Closure $actions = [];
protected array | Closure $actions = [];

public function actions(array | ActionGroup | Closure $actions): static
public function actions(array | Closure $actions): static
{
$this->actions = $actions;

Expand All @@ -19,6 +17,6 @@ public function actions(array | ActionGroup | Closure $actions): static

public function getActions(): array
{
return Arr::wrap($this->evaluate($this->actions));
return $this->evaluate($this->actions);
}
}
13 changes: 2 additions & 11 deletions packages/notifications/src/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Filament\Notifications;

use Filament\Notifications\Actions\Action;
use Filament\Notifications\Actions\ActionGroup;
use Filament\Notifications\Concerns\HasActions;
use Filament\Notifications\Concerns\HasBody;
use Filament\Notifications\Concerns\HasDuration;
Expand Down Expand Up @@ -44,7 +43,7 @@ public function toArray(): array
{
return [
'id' => $this->getId(),
'actions' => array_map(fn (Action | ActionGroup $action): array => $action->toArray(), $this->getActions()),
'actions' => collect($this->getActions())->toArray(),
'body' => $this->getBody(),
'duration' => $this->getDuration(),
'icon' => $this->getIcon(),
Expand All @@ -56,15 +55,7 @@ public function toArray(): array
public static function fromArray(array $data): static
{
$static = static::make($data['id']);
$static->actions(
array_map(
fn (array $action): Action | ActionGroup => match (array_key_exists('actions', $action)) {
true => ActionGroup::fromArray($action),
false => Action::fromArray($action),
},
$data['actions'],
),
);
$static->actions(array_map(fn (array $action): Action => Action::fromArray($action), $data['actions']));
$static->body($data['body']);
$static->duration($data['duration']);
$static->icon($data['icon']);
Expand Down
2 changes: 0 additions & 2 deletions packages/notifications/stubs/scaffolding/resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import Alpine from 'alpinejs'
import AlpineFloatingUI from '@awcodes/alpine-floating-ui'
import NotificationsAlpinePlugin from '../../vendor/filament/notifications/dist/module.esm'

Alpine.plugin(AlpineFloatingUI)
Alpine.plugin(NotificationsAlpinePlugin)

window.Alpine = Alpine
Expand Down

0 comments on commit dee193f

Please sign in to comment.