Improve mobile dashboard menus and keyword actions

This commit is contained in:
Dwindi Ramadhana
2026-02-21 00:32:33 +07:00
parent 05376bff2b
commit 9be883cbaf
2 changed files with 58 additions and 21 deletions

View File

@@ -86,7 +86,7 @@
<th class="px-4 py-3 text-left">Keyword</th>
<th class="px-4 py-3 text-left">Language</th>
<th class="px-4 py-3 text-left">Status</th>
<th class="px-4 py-3 text-right">Actions</th>
<th class="hidden px-4 py-3 text-right md:table-cell">Actions</th>
</tr>
</thead>
<tbody id="keyword-table">
@@ -104,7 +104,44 @@
</div>
</div>
</td>
<td class="px-4 py-3 font-semibold text-white">{{ $item->keyword }}</td>
<td class="px-4 py-3 font-semibold text-white">
{{ $item->keyword }}
@php
$isActiveMobile = (bool) ($item->is_active ?? true);
$canActivateMobile = $isActiveMobile || $isPersonal || !$limitReached;
@endphp
<div class="mt-3 flex flex-wrap gap-2 md:hidden">
<button
type="button"
class="edit-btn rounded-full border border-white/10 px-3 py-1.5 text-xs text-gray-200 hover:bg-white/10"
data-id="{{ $item->id }}"
data-emoji="{{ $item->emoji_slug }}"
data-keyword="{{ $item->keyword }}"
data-lang="{{ $item->lang }}"
>
Edit
</button>
<form method="POST" action="{{ route('dashboard.keywords.toggle_active', $item->id) }}" class="inline">
@csrf
@method('PUT')
<input type="hidden" name="is_active" value="{{ $isActiveMobile ? '0' : '1' }}">
<button
type="submit"
class="rounded-full border border-white/10 px-3 py-1.5 text-xs text-gray-200 hover:bg-white/10 {{ (!$canActivateMobile && !$isActiveMobile) ? 'opacity-50 cursor-not-allowed' : '' }}"
{{ (!$canActivateMobile && !$isActiveMobile) ? 'disabled' : '' }}
>
{{ $isActiveMobile ? 'Deactivate' : 'Activate' }}
</button>
</form>
<form method="POST" action="{{ route('dashboard.keywords.delete', $item->id) }}" class="inline">
@csrf
@method('DELETE')
<button type="submit" class="rounded-full border border-white/10 px-3 py-1.5 text-xs text-gray-200 hover:bg-white/10">
Delete
</button>
</form>
</div>
</td>
<td class="px-4 py-3 text-xs uppercase tracking-[0.15em] text-gray-400">{{ $item->lang ?? 'und' }}</td>
<td class="px-4 py-3">
@php
@@ -115,7 +152,7 @@
{{ $isActive ? 'Active' : 'Inactive' }}
</span>
</td>
<td class="px-4 py-3 text-right">
<td class="hidden px-4 py-3 text-right md:table-cell">
<button
type="button"
class="edit-btn rounded-full border border-white/10 px-3 py-1 text-xs text-gray-200 hover:bg-white/10"