|
1 | 1 | <div class="space-y-6" @if($pollingInterval) wire:poll.{{ $pollingInterval }}="refreshComments" @endif> |
2 | | - {{-- Comment Form --}} |
3 | | - @auth |
4 | | - <div class="bg-white dark:bg-gray-900 rounded-lg dark:border-gray-700 relative"> |
5 | | - <div x-load |
6 | | - x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('forum-mentions', 'tapp/filament-forum') }}" |
7 | | - x-data="forumMentions({ |
8 | | - mentionables: @js($this->getMentionablesData()) |
9 | | - })"> |
10 | | - <form wire:submit="create" class="space-y-4"> |
11 | | - {{ $this->commentForm }} |
12 | | - |
13 | | - <div class="flex justify-end"> |
14 | | - <x-filament::button type="submit" wire:loading.attr="disabled"> |
15 | | - <x-filament::loading-indicator wire:loading wire:target="create" class="h-4 w-4 mr-2" /> |
16 | | - {{ __('filament-forum::filament-forum.comments.post-comment') }} |
17 | | - </x-filament::button> |
18 | | - </div> |
19 | | - </form> |
| 2 | + {{-- Comments Header + Collapsible Form --}} |
| 3 | + <div x-data="{ showCommentForm: false }" @comment-created.window="showCommentForm = false"> |
| 4 | + <div class="flex items-center justify-between mb-4"> |
| 5 | + <h3 class="text-base font-medium text-gray-100"> |
| 6 | + {{ trans_choice('filament-forum::filament-forum.comments.count', $comments->count(), ['count' => $comments->count()]) }} |
| 7 | + </h3> |
| 8 | + @auth |
| 9 | + <x-filament::button |
| 10 | + x-on:click="showCommentForm = !showCommentForm" |
| 11 | + icon="heroicon-o-chat-bubble-left" |
| 12 | + size="sm" |
| 13 | + color="gray" |
| 14 | + x-show="!showCommentForm" |
| 15 | + > |
| 16 | + {{ __('filament-forum::filament-forum.comments.add-comment') }} |
| 17 | + </x-filament::button> |
| 18 | + <x-filament::button |
| 19 | + x-on:click="showCommentForm = false" |
| 20 | + size="sm" |
| 21 | + color="gray" |
| 22 | + x-show="showCommentForm" |
| 23 | + x-cloak |
| 24 | + > |
| 25 | + {{ __('filament-forum::filament-forum.comments.cancel') }} |
| 26 | + </x-filament::button> |
| 27 | + @endauth |
| 28 | + </div> |
20 | 29 |
|
21 | | - {{-- Mentions Dropdown --}} |
22 | | - <div x-show="showDropdown" |
23 | | - x-cloak |
24 | | - class="mention-dropdown" |
25 | | - style="position: absolute; z-index: 9999;" |
26 | | - :style="`top: ${dropdownPosition.top}px; left: ${dropdownPosition.left}px;`"> |
27 | | - <template x-for="(user, index) in filteredMentionables" :key="user.id"> |
28 | | - <div class="mention-item" |
29 | | - :class="{ 'bg-gray-100 dark:bg-gray-600': index === selectedIndex }" |
30 | | - @click.stop="selectMention(user)"> |
31 | | - <div class="avatar"> |
32 | | - <template x-if="user.avatar"> |
33 | | - <img :src="user.avatar" :alt="user.name" class="w-full h-full rounded-full"> |
34 | | - </template> |
35 | | - <template x-if="!user.avatar"> |
36 | | - <span x-text="user.name.charAt(0).toUpperCase()" class="text-gray-600 dark:text-gray-300"></span> |
37 | | - </template> |
38 | | - </div> |
39 | | - <span class="name" x-html="highlightQuery(user.name, currentQuery || '')"></span> |
40 | | - </div> |
41 | | - </template> |
42 | | - |
43 | | - <template x-if="filteredMentionables.length === 0"> |
44 | | - <div class="mention-item text-gray-500 dark:text-gray-400"> |
45 | | - No users found |
| 30 | + @auth |
| 31 | + <div x-show="showCommentForm" x-collapse x-cloak> |
| 32 | + <div class="relative mb-4" |
| 33 | + x-load |
| 34 | + x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('forum-mentions', 'tapp/filament-forum') }}" |
| 35 | + x-data="forumMentions({ |
| 36 | + mentionables: @js($this->getMentionablesData()) |
| 37 | + })"> |
| 38 | + <form wire:submit="create" class="space-y-3"> |
| 39 | + {{ $this->commentForm }} |
| 40 | + |
| 41 | + <div class="flex justify-end"> |
| 42 | + <x-filament::button type="submit" color="gray" wire:loading.attr="disabled"> |
| 43 | + <x-filament::loading-indicator wire:loading wire:target="create" class="h-4 w-4 mr-2" /> |
| 44 | + {{ __('filament-forum::filament-forum.comments.post-comment') }} |
| 45 | + </x-filament::button> |
46 | 46 | </div> |
47 | | - </template> |
| 47 | + </form> |
| 48 | + |
| 49 | + {{-- Mentions Dropdown --}} |
| 50 | + <div x-show="showDropdown" |
| 51 | + x-cloak |
| 52 | + class="mention-dropdown" |
| 53 | + style="position: absolute; z-index: 9999;" |
| 54 | + :style="`top: ${dropdownPosition.top}px; left: ${dropdownPosition.left}px;`"> |
| 55 | + <template x-for="(user, index) in filteredMentionables" :key="user.id"> |
| 56 | + <div class="mention-item" |
| 57 | + :class="{ 'bg-gray-100 dark:bg-gray-600': index === selectedIndex }" |
| 58 | + @click.stop="selectMention(user)"> |
| 59 | + <div class="avatar"> |
| 60 | + <template x-if="user.avatar"> |
| 61 | + <img :src="user.avatar" :alt="user.name" class="w-full h-full rounded-full"> |
| 62 | + </template> |
| 63 | + <template x-if="!user.avatar"> |
| 64 | + <span x-text="user.name.charAt(0).toUpperCase()" class="text-gray-600 dark:text-gray-300"></span> |
| 65 | + </template> |
| 66 | + </div> |
| 67 | + <span class="name" x-html="highlightQuery(user.name, currentQuery || '')"></span> |
| 68 | + </div> |
| 69 | + </template> |
| 70 | + |
| 71 | + <template x-if="filteredMentionables.length === 0"> |
| 72 | + <div class="mention-item text-gray-500 dark:text-gray-400"> |
| 73 | + No users found |
| 74 | + </div> |
| 75 | + </template> |
| 76 | + </div> |
48 | 77 | </div> |
49 | 78 | </div> |
50 | | - </div> |
51 | | - @else |
52 | | - <div class="bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4 text-center"> |
53 | | - <p class="text-gray-600 dark:text-gray-400"> |
54 | | - {{ __('filament-forum::filament-forum.comments.login-to-comment') }} |
55 | | - </p> |
56 | | - </div> |
57 | | - @endauth |
| 79 | + @else |
| 80 | + <div class="bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4 text-center mb-4"> |
| 81 | + <p class="text-gray-600 dark:text-gray-400"> |
| 82 | + {{ __('filament-forum::filament-forum.comments.login-to-comment') }} |
| 83 | + </p> |
| 84 | + </div> |
| 85 | + @endauth |
| 86 | + </div> |
58 | 87 |
|
59 | 88 | {{-- Comments List --}} |
60 | 89 | <div class="space-y-4"> |
61 | | - {{-- Comments Count --}} |
62 | | - @if($comments->count() > 0) |
63 | | - <div class="flex items-center justify-between mb-4"> |
64 | | - <h3 class="text-base font-medium text-gray-900 dark:text-gray-100"> |
65 | | - {{ trans_choice('filament-forum::filament-forum.comments.count', $comments->count(), ['count' => $comments->count()]) }} |
66 | | - </h3> |
67 | | - </div> |
68 | | - @endif |
69 | 90 |
|
70 | 91 | @forelse($comments as $comment) |
71 | 92 | <div class="bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 p-4" wire:key="comment-{{ $comment->id }}"> |
@@ -135,7 +156,7 @@ class="p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition |
135 | 156 | > |
136 | 157 | {{ __('filament-forum::filament-forum.comments.cancel') }} |
137 | 158 | </x-filament::button> |
138 | | - <x-filament::button type="submit" wire:loading.attr="disabled"> |
| 159 | + <x-filament::button type="submit" color="gray" wire:loading.attr="disabled"> |
139 | 160 | <x-filament::loading-indicator wire:loading wire:target="updateComment" class="h-4 w-4 mr-2" /> |
140 | 161 | {{ __('filament-forum::filament-forum.comments.save') }} |
141 | 162 | </x-filament::button> |
@@ -215,8 +236,8 @@ class="flex items-center space-x-2 p-2 bg-gray-50 dark:bg-gray-800 rounded borde |
215 | 236 | </div> |
216 | 237 | @empty |
217 | 238 | <div class="text-center py-8"> |
218 | | - <x-heroicon-o-chat-bubble-left class="w-12 h-12 text-gray-400 mx-auto mb-3" /> |
219 | | - <p class="text-gray-500 dark:text-gray-400"> |
| 239 | + <x-heroicon-o-chat-bubble-left class="w-12 h-12 text-gray-300 mx-auto mb-3" /> |
| 240 | + <p class="text-gray-300"> |
220 | 241 | {{ __('filament-forum::filament-forum.comments.no-comments') }} |
221 | 242 | </p> |
222 | 243 | </div> |
|
0 commit comments