11@php
22 $toolbarButtons = $this -> getToolbarButtons ();
3- $hasToolBar = filled ($toolbarButtons );
3+ $hasToolBar = is_array ($toolbarButtons );
44@endphp
55
6- <div class =" comm:flex comm:items-start comm:gap-x-4 comm:border comm:border-gray-300 comm:dark:border-gray-700 comm:p-4 comm:rounded-lg comm:shadow-sm comm:mb-2" id =" filament-comment-{{ $comment -> getId () } }" >
6+ <div
7+ class =" comm:flex comm:items-start comm:gap-x-4 comm:border comm:border-gray-300 comm:dark:border-gray-700 comm:p-4 comm:rounded-lg comm:shadow-sm comm:mb-2"
8+ id =" filament-comment-{{ $comment -> getId () } }"
9+ >
710 @if ($avatar = $comment -> getAuthorAvatar () )
811 <img
912 src =" {{ $comment -> getAuthorAvatar () } }"
@@ -58,7 +61,7 @@ class="comm:mt-2"
5861 x-data =" editor(@js ($commentBody ), @js ($mentionables ), 'comment', null, @js ($hasToolBar ), @js ($this -> getTipTapCssClasses () ), @js ($commentionsComponentPrefix . ' comment' ), @js ([' prompt' => __ (' commentions::comments.toolbar.link_prompt' ), ' invalid' => __ (' commentions::comments.toolbar.link_invalid' )] ))"
5962 >
6063 @if ($this -> ratingsAreEnabled () )
61- @include (' commentions::partials.rating-input' , [' maxRating' => $this -> getMaxRating ()] )
64+ @include (' commentions::partials.ratings. rating-input' , [' maxRating' => $this -> getMaxRating ()] )
6265 @endif
6366 {{-- tiptap editor --}}
6467 <div @class ([
@@ -90,56 +93,16 @@ class="comm:mt-2"
9093 </div >
9194 </div >
9295 @else
93- @if ($comment -> isComment () && $comment -> rating )
94- <div
95- class =" comm:mt-1 comm:flex comm:items-center comm:gap-0.5"
96- role =" img"
97- title =" {{ $comment -> rating } } /{{ $this -> getMaxRating () } }"
98- aria-label =" {{ __ (' commentions::comments.rating_display_label' , [' rating' => $comment -> rating , ' max' => $this -> getMaxRating ()]) } }"
99- >
100- @for ($ratingStar = 1 ; $ratingStar <= $this -> getMaxRating (); $ratingStar ++ )
101- <x-filament::icon
102- icon =" heroicon-s-star"
103- @class ([
104- ' comm:h-4 comm:w-4' ,
105- ' comm:text-amber-400' => $ratingStar <= $comment -> rating ,
106- ' comm:text-gray-300 comm:dark:text-gray-600' => $ratingStar > $comment -> rating ,
107- ] )
108- />
109- @endfor
110- </div >
111- @endif
96+ @include (' commentions::partials.ratings.show-comment-rating' , [' comment' => $comment ] )
11297
11398 <div @class ([
11499 ' comm:mt-1 comm:space-y-6 comm:text-sm comm:text-gray-800 comm:dark:text-gray-200 commentions-comment-body comm:break-words' ,
115100 ' tip-tap-toolbar-enabled' => config (' commentions.toolbar.enabled' , true ),
116101 ] )>{!! $comment -> getParsedBody () ! !} </div >
117102
118- @if ($comment -> isComment () && $comment -> attachments -> isNotEmpty () )
119- <div class =" comm:mt-2 comm:flex comm:flex-wrap comm:gap-2" >
120- @foreach ($comment -> attachments as $attachment )
121- @if ($attachment -> isImage () )
122- <a href =" {{ $attachment -> getUrl () } }" target =" _blank" rel =" noopener" >
123- <img
124- src =" {{ $attachment -> getUrl () } }"
125- alt =" {{ $attachment -> filename } }"
126- class =" comm:h-20 comm:w-20 comm:rounded-lg comm:border comm:border-gray-200 comm:dark:border-gray-700 comm:object-cover"
127- />
128- </a >
129- @else
130- <a
131- href =" {{ $attachment -> getUrl () } }"
132- target =" _blank"
133- rel =" noopener"
134- class =" comm:inline-flex comm:items-center comm:gap-1 comm:rounded-lg comm:border comm:border-gray-200 comm:dark:border-gray-700 comm:px-2 comm:py-1 comm:text-xs comm:text-gray-700 comm:dark:text-gray-200 comm:hover:bg-gray-100 comm:dark:hover:bg-gray-800"
135- >
136- <x-filament::icon icon =" heroicon-s-paper-clip" class =" comm:h-4 comm:w-4" />
137- <span class =" comm:max-w-[12rem] comm:truncate" >{{ $attachment -> filename } } </span >
138- </a >
139- @endif
140- @endforeach
141- </div >
142- @endif
103+ @include (' commentions::partials.attachments.show-comment-attachments' , [
104+ ' comment' => $comment ,
105+ ] )
143106
144107 @if ($comment -> isComment () )
145108 <livewire:dynamic-component
@@ -151,5 +114,5 @@ class="comm:inline-flex comm:items-center comm:gap-1 comm:rounded-lg comm:border
151114 @endif
152115 </div >
153116
154- <x-filament-actions::modals />
117+ <x-filament-actions::modals />
155118</div >
0 commit comments