Compare commits

..

No commits in common. "85d4c196937bed6b01c51b1061b9afd650daca52" and "77aaf4748fc2069481031090d4b8f808fe01ff11" have entirely different histories.

4 changed files with 21 additions and 41 deletions

View file

@ -34,26 +34,13 @@ class TrackerController extends Controller
if (!$tripId) return view('no-trip');
$viewMode = $request->input('show', null);
$fromCheckin = $request->input('from', null);
$toCheckin = $request->input('to', null);
$tripData = $this->get_trip_data($tripId);
if ($fromCheckin) {
$tripData->checkins = array_filter($tripData->checkins, function($key) use ($fromCheckin) { return $key >= $fromCheckin; }, ARRAY_FILTER_USE_KEY);
}
if ($toCheckin) {
$tripData->checkins = array_filter($tripData->checkins, function($key) use ($toCheckin) { return $key <= $toCheckin; }, ARRAY_FILTER_USE_KEY);
}
return view(
'tracker',
[
'trip' => $tripData,
'showAllCheckins' => ($viewMode === 'all'),
'fromCheckin' => $fromCheckin,
'toCheckin' => $toCheckin
'showAllCheckins' => ($viewMode === 'all')
]
);
}

View file

@ -55,9 +55,6 @@ class Digest extends Mailable
case 'weekly':
$cutoffDateTime->modify('-1 week');
break;
case 'fortnightly':
$cutoffDateTime->modify('-2 weeks');
break;
case 'monthly':
$cutoffDateTime->modify('-1 month');
break;

View file

@ -37,25 +37,21 @@
<p>View the tracker <a href="https://track.bengoldsworthy.net">here.</a></p>
<hr>
<h2>Checkins</h2>
@if($checkins)
<ol>
@foreach($checkins as $checkin)
<li>
<details class="checkin" id="{{ $checkin->id }}">
<summary class="checkin__summary">
<h3 class="checkin__title">{!! $checkin->title ?? "<i>Untitled</i>" !!}</h3>
<p class="checkin__meta">{!! render_date_difference($checkin->date) !!}</p>
</summary>
@if($checkin->note)
{!! $checkin->note !!}
@endif
@if($checkin->image_url)
<img class="popup__image" loading="lazy" src="{{ $checkin->image_url }}">
@endif
</details>
</li>
@endforeach
</ol>
@else
<p>No new checkins</p>
@endif
<ol>
@foreach($checkins as $checkin)
<li>
<details class="checkin" id="{{ $checkin->id }}">
<summary class="checkin__summary">
<h3 class="checkin__title">{!! $checkin->title ?? "<i>Untitled</i>" !!}</h3>
<p class="checkin__meta">{!! render_date_difference($checkin->date) !!}</p>
</summary>
@if($checkin->note)
{!! $checkin->note !!}
@endif
@if($checkin->image_url)
<img class="popup__image" loading="lazy" src="{{ $checkin->image_url }}">
@endif
</details>
</li>
@endforeach
</ol>

View file

@ -31,8 +31,8 @@
</section>
<section id="checkinList">
<h2 class="section__title">@if ($showAllCheckins) Check-ins @else Recent Check-ins @endif</h2>
<ol start="{{ $toCheckin ?? count($trip->checkins) }}" reversed>
@if($showAllCheckins || $toCheckin || $fromCheckin)
<ol start="{{ count($trip->checkins) }}" reversed>
@if($showAllCheckins)
@php $checkinsList = array_reverse($trip->checkins) @endphp
@else
@php $checkinsList = array_slice(array_reverse($trip->checkins), 0, 10) @endphp