This commit is contained in:
IsWaffle 2024-12-02 20:16:47 -05:00
parent 5cd19642c7
commit a4beac7863
2 changed files with 11 additions and 10 deletions

View File

@ -27,8 +27,7 @@ class ModerationActionButton extends Component
public function runActionEvent(): void
{
$this->isRunning = true;
defer(fn () => $this->invokeAction());
$this->js('setTimeout(3000, window.location.reload())');
$this->js('setTimeout(function() { $wire.invokeAction(); }, 500)');
}
public function invokeAction(): void
@ -37,12 +36,15 @@ class ModerationActionButton extends Component
case 'delete':
$this->moderatedObject->delete();
break;
case 'enable':
case 'disable':
$this->moderatedObject->toggleDisabled();
break;
}
$this->js('window.location.reload()');
}
}

View File

@ -1,9 +1,8 @@
<div>
<div class="text-blue-600">
<x-dropdown alignment="right" contentClasses="py-1 rounded-full bg-gray-200 dark:bg-gray-800">
<x-slot name="trigger">
{{-- wire:click.prevent here to stop from following mod card links --}}
<button class="relative text-blue-400 dark:text-blue-500 hover:text-blue-600 dark:hover:text-blue-700">
{{-- Icon (shield with keyhole) --}}
{{-- Icon (shield with keyhole)--}}
<svg width="24" height="24" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M3 5.75V11c0 5.001 2.958 8.676 8.725 10.948a.75.75 0 0 0 .55 0C18.042 19.676 21 16 21 11V5.75a.75.75 0 0 0-.75-.75c-2.663 0-5.258-.943-7.8-2.85a.75.75 0 0 0-.9 0C9.008 4.057 6.413 5 3.75 5a.75.75 0 0 0-.75.75ZM13.995 11a2 2 0 0 1-1.245 1.852v2.398a.75.75 0 0 1-1.5 0v-2.394A2 2 0 1 1 13.995 11Z"/>
</svg>
@ -16,12 +15,12 @@
<div class="flex">
<span class="pr-2">
@if ($this->moderatedObject->disabled)
{{-- Icon (circle with checkmark) --}}
{{-- Icon (circle with checkmark)--}}
<svg width="24" height="24" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2Zm3.22 6.97-4.47 4.47-1.97-1.97a.75.75 0 0 0-1.06 1.06l2.5 2.5a.75.75 0 0 0 1.06 0l5-5a.75.75 0 1 0-1.06-1.06Z" />
</svg>
@else
{{-- Icon (circle with dash) --}}
{{-- Icon (circle with dash)--}}
<svg width="24" height="24" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2.001c5.524 0 10 4.477 10 10s-4.476 10-10 10c-5.522 0-10-4.477-10-10s4.478-10 10-10Zm4.25 9.25h-8.5a.75.75 0 0 0 0 1.5h8.5a.75.75 0 0 0 0-1.5Z" />
</svg>
@ -36,7 +35,7 @@
<button wire:click.prevent="confirmDelete" class="p-2 h-full w-full text-red-500 dark:text-red-500 bg-gray-200 dark:bg-gray-800 hover:text-red-400 dark:hover:text-red-400">
<div class="flex">
<span class="pr-2">
{{-- Icon (trash can) --}}
{{-- Icon (trash can)--}}
<svg width="24" height="24" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M21.5 6a1 1 0 0 1-.883.993L20.5 7h-.845l-1.231 12.52A2.75 2.75 0 0 1 15.687 22H8.313a2.75 2.75 0 0 1-2.737-2.48L4.345 7H3.5a1 1 0 0 1 0-2h5a3.5 3.5 0 1 1 7 0h5a1 1 0 0 1 1 1Zm-7.25 3.25a.75.75 0 0 0-.743.648L13.5 10v7l.007.102a.75.75 0 0 0 1.486 0L15 17v-7l-.007-.102a.75.75 0 0 0-.743-.648Zm-4.5 0a.75.75 0 0 0-.743.648L9 10v7l.007.102a.75.75 0 0 0 1.486 0L10.5 17v-7l-.007-.102a.75.75 0 0 0-.743-.648ZM12 3.5A1.5 1.5 0 0 0 10.5 5h3A1.5 1.5 0 0 0 12 3.5Z" />
</svg>
@ -70,7 +69,7 @@
<h2 class="text-2xl">{{ __('Confirm') }} {{ __('Delete') }}</h2>
</x-slot>
<x-slot name="content">
<p>Are you sure you want to {{__('Delete')}} '{{$this->moderatedObject->getFriendlyName()}}'?</p>
<p>Are you sure you want to {{__('delete')}} '{{$this->moderatedObject->getFriendlyName()}}'?</p>
</x-slot>
<x-slot name="footer">
<livewire:mod.moderation-action-button actionType='delete' :moderatedObject="$moderatedObject" />