diff --git a/public/css/app.css b/public/css/app.css index 9aeaa68..8b997c3 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -60,13 +60,13 @@ details h2 { .other-links li { background-color: #5adefc; float: left; - margin-left: 1.5em; + margin-right: 1.5em; border: 2px solid white; border-radius: 1em; } .other-links li:first-of-type { - margin-left: 0; + margin-right: 0; } .other-links li:hover { @@ -113,7 +113,6 @@ details h2 { grid-column-start: 1; grid-column-end: 3; border-top: 5px solid black; - padding: 0 1em; } .checkin { diff --git a/resources/views/tracker.blade.php b/resources/views/tracker.blade.php index 33f7fcd..673f7ba 100644 --- a/resources/views/tracker.blade.php +++ b/resources/views/tracker.blade.php @@ -65,8 +65,8 @@ @endforeach - @if (!$showAllCheckins) -
+ @if ($trip->is_active) + @endif @@ -141,6 +141,11 @@ ).addTo(map).setZIndexOffset(1000); currLocation.bindPopup('Current location
').openPopup(); + /* + * Add all checkins link href. + */ + document.getElementById("allCheckinsLink").href = window.location.pathname + '/all'; + /* * Changes the currently-selected popup. */ diff --git a/routes/web.php b/routes/web.php index 9c78d25..7e0b8f7 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,34 +1,38 @@ input('show', null); - + /* - * If there is a file in the local cache that is less than 3 hours old, + * If there is a file in the local cache that is less than 5 hours old, * use that. */ - $tripFileName = ( $tripId ?? config('app.current_trip_id') ) . '.json'; + $tripFileName = $tripId ?? config('app.current_trip_id') . '.json'; if (Storage::disk('local')->exists($tripFileName)) { $cachedData = json_decode(Storage::disk('local')->get($tripFileName)); - if ($cachedData->trip->is_active) { - $cachedDataUpdatedAt = new DateTime($cachedData->trip->updated_at); - $now = new DateTime(); - if (intval(($now->getTimestamp() - $cachedDataUpdatedAt->getTimestamp()) / 3600) <= 3) { - return view('tracker', ['trip' => $cachedData->trip, 'showAllCheckins' => ($viewMode === 'all')]); - } - } else { - return view('tracker', ['trip' => $cachedData->trip, 'showAllCheckins' => ($viewMode === 'all')]); + $cachedDataUpdatedAt = new DateTime($cachedData->trip->updated_at); + $now = new DateTime(); + if (intval(($now->getTimestamp() - $cachedDataUpdatedAt->getTimestamp()) / 3600) <= 5) { + return view('tracker', ['trip' => $cachedData->trip, 'showAllCheckins' => ($showAll === 'all')]); } } @@ -57,8 +61,8 @@ Route::get('/{tripId?}', function (Request $request, $tripId = null) { } } - return view('tracker', ['trip' => $data->trip, 'showAllCheckins' => ($viewMode === 'all')]); + return view('tracker', ['trip' => $data->trip, 'showAllCheckins' => ($showAll === 'all')]); } else { return 'Something went wrong'; } -})->where('tripId', '[0-9a-z]{20}'); +});