Skip to content

Commit b8cbc6d

Browse files
committed
wip
1 parent 3365b3e commit b8cbc6d

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

src/Resources/UserResource/Pages/ViewUser.php

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ protected function getHeaderActions(): array
4848

4949
return redirect()->away($url);
5050
})
51-
->visible(fn (User $record): bool => $record->userIsRegistered() === false)
51+
->visible(fn(User $record): bool => $record->userIsRegistered() === false)
5252
->requiresConfirmation()
5353
->modalDescription(__('This action will open the registration link for this user. By confirming, you will be redirected to the registration page and logged out of your current session.')),
5454

5555
Actions\ActionGroup::make([
5656
Actions\Action::make('send_verify_user_email')
57-
->visible(fn (User $record): bool => $record->hasVerifiedEmail() === false)
57+
->visible(fn(User $record): bool => $record->hasVerifiedEmail() === false)
5858
->label(__('Send Verification Email'))
5959
->action(function ($record) {
6060
$notification = new VerifyEmail;
@@ -125,8 +125,8 @@ public function getSubheading(): string | Htmlable | null
125125
public function table(Table $table): Table
126126
{
127127
return $table
128-
->query(fn (): Builder => $this->record->traffic()->whereNot('path', 'livewire/update')->orderByDesc('created_at')->getQuery())
129-
->heading(fn ($table): Htmlable => new HtmlString(Blade::render('<filament::icon icon="heroicon-m-user"/>' . __('User Traffic (:count)', [
128+
->query(fn(): Builder => $this->record->traffic()->whereNot('path', 'livewire/update')->orderByDesc('created_at')->getQuery())
129+
->heading(fn($table): Htmlable => new HtmlString(Blade::render('<filament::icon icon="heroicon-m-user"/>' . __('User Traffic (:count)', [
130130
'count' => $table->getQuery()->count(),
131131
]))))
132132
->searchable()
@@ -139,8 +139,8 @@ public function table(Table $table): Table
139139
->headerActions([
140140
Action::make('reset')
141141
->label(__('Reset position'))
142-
->icon(fn (): BackedEnum => Heroicon::ArrowUturnLeft)
143-
->url(fn (): string => $this->getUrl([
142+
->icon(fn(): BackedEnum => Heroicon::ArrowUturnLeft)
143+
->url(fn(): string => $this->getUrl([
144144
'record' => $this->record,
145145
]))
146146
->visible(function () {
@@ -160,35 +160,36 @@ public function table(Table $table): Table
160160

161161
Action::make('clear_activity')
162162
->label(__('Clear Activity'))
163-
->icon(fn (): BackedEnum => Heroicon::Trash)
163+
->color(fn(): string => 'danger')
164+
->icon(fn(): BackedEnum => Heroicon::Trash)
164165
->action(function (Model $record): void {
165166
$record->traffic()->delete();
166167
})
167168
->requiresConfirmation()
168169
->modalDescription(__('This action will delete all traffic records for this user. This action cannot be undone.'))
169-
->visible(fn (User $record): bool => $record->traffic()->exists() && $record->traffic()->whereNot('path', 'livewire/update')->exists()),
170+
->visible(fn(User $record): bool => $record->traffic()->exists() && $record->traffic()->whereNot('path', 'livewire/update')->exists()),
170171
])
171172
->recordAction('view')
172173
->recordActions([
173174
Action::make('visit')
174175
->button()
175176
->hiddenLabel()
176-
->color(fn (): string => 'primary')
177-
->tooltip(fn (): string => __('Visit Path'))
178-
->icon(fn (): BackedEnum => Heroicon::ArrowTopRightOnSquare)
179-
->url(fn (UserTraffic $record): string => $record->getAttribute('full_url'), true),
177+
->color(fn(): string => 'primary')
178+
->tooltip(fn(): string => __('Visit Path'))
179+
->icon(fn(): BackedEnum => Heroicon::ArrowTopRightOnSquare)
180+
->url(fn(UserTraffic $record): string => $record->getAttribute('full_url'), true),
180181

181182
Action::make('view')
182183
->button()
183184
->hiddenLabel()
184-
->color(fn (): string => 'gray')
185-
->tooltip(fn (): string => __('View Traffic'))
186-
->icon(fn (): BackedEnum => Heroicon::Eye)
185+
->color(fn(): string => 'gray')
186+
->tooltip(fn(): string => __('View Traffic'))
187+
->icon(fn(): BackedEnum => Heroicon::Eye)
187188
->slideOver()
188189
->modal()
189-
->modalIcon(fn (): BackedEnum => Heroicon::Eye)
190-
->modalHeading(fn (): string => __('Traffic Details'))
191-
->modalDescription(fn (UserTraffic $record): Htmlable => new HtmlString(__('Traffic details for :path', [
190+
->modalIcon(fn(): BackedEnum => Heroicon::Eye)
191+
->modalHeading(fn(): string => __('Traffic Details'))
192+
->modalDescription(fn(UserTraffic $record): Htmlable => new HtmlString(__('Traffic details for :path', [
192193
'path' => '<a href="' . e($record->getAttribute('full_url')) . '" target="_blank" class="text-primary-600 underline">' . e($record->getAttribute('path')) . '</a>',
193194
])))
194195
->schema([
@@ -201,7 +202,7 @@ public function table(Table $table): Table
201202
TextEntry::make('method')
202203
->label(__('Method'))
203204
->badge()
204-
->color(fn (string $state): string => match ($state) {
205+
->color(fn(string $state): string => match ($state) {
205206
'GET' => 'success',
206207
'POST' => 'primary',
207208
'PUT' => 'warning',
@@ -254,8 +255,8 @@ public function table(Table $table): Table
254255

255256
])
256257
->modalFooterActionsAlignment(Alignment::Center)
257-
->modalSubmitAction(fn (Action $action) => $action->visible(false))
258-
->modalCancelActionLabel(fn (): string => __('Close')),
258+
->modalSubmitAction(fn(Action $action) => $action->visible(false))
259+
->modalCancelActionLabel(fn(): string => __('Close')),
259260
]);
260261
}
261262
}

0 commit comments

Comments
 (0)