|
804 | 804 | return $groups; |
805 | 805 | }); |
806 | 806 |
|
| 807 | +// Computed helper: initial collapsed state (auto-collapse groups with 4+ events) |
| 808 | +$initialCollapsedGroups = computed(function () { |
| 809 | + $groups = $this->groupedEvents; |
| 810 | + $collapsed = []; |
| 811 | +
|
| 812 | + foreach ($groups as $group) { |
| 813 | + // Auto-collapse if 4 or more events in group |
| 814 | + if (count($group['events']) >= 4) { |
| 815 | + $collapsed[$group['key']] = true; |
| 816 | + } |
| 817 | + } |
| 818 | +
|
| 819 | + return $collapsed; |
| 820 | +}); |
| 821 | +
|
807 | 822 | // Computed helper: are all groups currently expanded? |
808 | 823 | $areAllGroupsExpanded = computed(function () { |
809 | 824 | $groups = $this->groupedEvents; |
@@ -1001,7 +1016,7 @@ class="btn-ghost btn-sm" |
1001 | 1016 | $hour = $userTime->format('H'); |
1002 | 1017 | $showHourMarker = $previousHour !== $hour; |
1003 | 1018 | $previousHour = $hour; |
1004 | | - $isCollapsed = ($this->collapsedGroups[$eventGroup['key']] ?? false); |
| 1019 | + $isCollapsed = ($this->collapsedGroups[$eventGroup['key']] ?? $this->initialCollapsedGroups[$eventGroup['key']] ?? false); |
1005 | 1020 | @endphp |
1006 | 1021 |
|
1007 | 1022 | <!-- Hour marker inside spine --> |
@@ -1030,9 +1045,22 @@ class="btn-ghost btn-sm" |
1030 | 1045 | <div class="{{ $isCollapsed ? 'py-3' : '' }}"> |
1031 | 1046 | <div class="min-w-0"> |
1032 | 1047 | @if ($isCollapsed) |
| 1048 | + @php $firstEvent = $eventGroup['events'][0]; @endphp |
1033 | 1049 | <div class="truncate"> |
1034 | | - <span class="font-semibold">{{ $eventGroup['formatted_action'] }}</span> |
1035 | | - <span class="text-base-content/90">{{ ' ' . $eventGroup['count'] . ' ' . $eventGroup['object_type_plural'] }}</span> |
| 1050 | + <span class="font-semibold">{{ $this->formatAction($firstEvent->action) }}</span> |
| 1051 | + @if (should_display_action_with_object($firstEvent->action, $firstEvent->service)) |
| 1052 | + @if ($firstEvent->target) |
| 1053 | + <span class="font-bold">{{ ' ' . $firstEvent->target->title }}</span> |
| 1054 | + @elseif ($firstEvent->actor) |
| 1055 | + <span class="font-bold">{{ ' ' . $firstEvent->actor->title }}</span> |
| 1056 | + @endif |
| 1057 | + @endif |
| 1058 | + @if ($eventGroup['count'] > 1) |
| 1059 | + <span class="text-base-content/70">{{ ' + ' . ($eventGroup['count'] - 1) . ' other' . ($eventGroup['count'] > 2 ? 's' : '') }}</span> |
| 1060 | + @endif |
| 1061 | + </div> |
| 1062 | + <div class="mt-1 text-sm text-base-content/70"> |
| 1063 | + {{ to_user_timezone($firstEvent->time, auth()->user())->format('H:i') }} |
1036 | 1064 | </div> |
1037 | 1065 | @else |
1038 | 1066 | @php $firstEvent = $eventGroup['events'][0]; @endphp |
@@ -1070,11 +1098,9 @@ class="btn-ghost btn-sm" |
1070 | 1098 | </div> |
1071 | 1099 | </div> |
1072 | 1100 | <div class="{{ $isCollapsed ? 'py-3' : 'py-2' }} text-right pr-2"> |
1073 | | - @if (! $isCollapsed) |
1074 | | - @php $firstEvent = $eventGroup['events'][0]; @endphp |
1075 | | - @if (! is_null($firstEvent->value)) |
1076 | | - <span class="text-lg font-bold {{ $this->valueColorClass($firstEvent) }}">{!! $this->formatValueDisplay($firstEvent) !!}</span> |
1077 | | - @endif |
| 1101 | + @php $displayEvent = $eventGroup['events'][0]; @endphp |
| 1102 | + @if (! is_null($displayEvent->value)) |
| 1103 | + <span class="text-lg font-bold {{ $this->valueColorClass($displayEvent) }}">{!! $this->formatValueDisplay($displayEvent) !!}</span> |
1078 | 1104 | @endif |
1079 | 1105 | </div> |
1080 | 1106 | </div> |
|
0 commit comments