Compare commits

...

3 commits

Author SHA1 Message Date
Ben Goldsworthy 045a42c250 Move trip URL to .env 2022-08-24 10:41:43 +00:00
Ben Goldsworthy 08beeced35 Fix details toggling 2022-08-24 10:41:23 +00:00
Ben Goldsworthy 838dda07c4 Fix mobile map height 2022-08-24 10:40:58 +00:00
4 changed files with 22 additions and 8 deletions

View file

@ -58,6 +58,8 @@ return [
'asset_url' => env('ASSET_URL'),
'trip' => env('TRIP'),
/*
|--------------------------------------------------------------------------
| Application Timezone

View file

@ -24,7 +24,7 @@
}
#map {
min-height: 800px;
height: 400px;
grid-column-start: 1;
grid-column-end: 3;
}
@ -44,6 +44,8 @@ details h2 {
}
#map {
height: auto;
min-height: 800px;
grid-column-end: 2;
}

View file

@ -12,10 +12,10 @@
<script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js"
integrity="sha512-BB3hKbKWOc9Ez/TAwyWxNXeoV9c1v6FIeYiBieIWkpLjauysF18NzgR1MBNBXf8/KABdlkX68nAhlwcDFLGPCQ=="
crossorigin=""></script>
<link rel="stylesheet" href="{{ url('/css/app.css') }}" />
<link rel="stylesheet" href="/css/app.css" />
</head>
<body class="antialiased">
<body>
<header>
<h1>Where in the World is Ben?</h1>
@ -32,8 +32,8 @@
<section id="checkinList">
<ol>
@foreach($trip->checkins as $checkin)
<li id="{{ $checkin->id }}" onClick="openCheckin(this.id)">
<details>
<li>
<details id="{{ $checkin->id }}" ontoggle="toggleCheckin(this.open, this.id)">
<summary><h2>{{ $checkin->title ?? "[No title]" }}</h2> <span>{{ $checkin->date }}</span></summary>
{{ $checkin->note ?? "[No note]" }}
</details>
@ -71,8 +71,18 @@
checkinMarkers[{{ $checkin->id }}] = marker;
@endforeach
function openCheckin(checkinId) {
checkinMarkers[checkinId].openPopup();
function toggleCheckin(isOpen, checkinId) {
if (isOpen) {
var checkins = document.querySelectorAll('details');
checkinMarkers[checkinId].openPopup();
checkins.forEach(checkin => {
if (checkin.id != checkinId && checkin.open) checkin.open = false;
});
} else {
checkinMarkers[checkinId].closePopup();
}
}
</script>
</footer>

View file

@ -20,7 +20,7 @@ Route::get('/', function () {
'timeout' => 3.0
]);
$response = $client->get('trip/q0mwldvenxq09p2x18nj/user/zmld8ko6qy7d9j3xvq10/json');
$response = $client->get('trip/'.config('app.trip').'/user/zmld8ko6qy7d9j3xvq10/json');
if ($response->getStatusCode() == 200) {
$data = json_decode($response->getBody());