diff --git a/app/Http/Controllers/Pigeon/PigeonGetNewsController.php b/app/Http/Controllers/Pigeon/PigeonGetNewsController.php index 0f1103a..1653ec7 100644 --- a/app/Http/Controllers/Pigeon/PigeonGetNewsController.php +++ b/app/Http/Controllers/Pigeon/PigeonGetNewsController.php @@ -19,7 +19,7 @@ public function __invoke( { $userLat = $request->input('lat'); $userLng = $request->input('lng'); - + $kmDistance = $distanceComputer ->from($userLat, $userLng) ->to($news->lat, $news->lng) @@ -30,7 +30,7 @@ public function __invoke( ->getDurationInMinutes(); $request->user()->pigeon->news()->attach($news, [ - 'arrival_date' => now()->addMinutes($timeInMinutes), + 'arrival_date' => config('pigeon.demo_flight_seconds') ? now()->addSeconds(config('pigeon.demo_flight_seconds')) : now()->addMinutes($timeInMinutes), ]); return redirect()->route('news.index'); diff --git a/config/pigeon.php b/config/pigeon.php index 79ca828..399348c 100644 --- a/config/pigeon.php +++ b/config/pigeon.php @@ -1,5 +1,5 @@ (int) env('PIGEON_FLIGHT_MINUTES', 10), + 'demo_flight_seconds' => env('PIGEON_DEMO_FLIGHT_SECONDS'), ]; diff --git a/resources/js/Components/Pigeon/PigeonPerch.vue b/resources/js/Components/Pigeon/PigeonPerch.vue index f7a9ad9..0edea9a 100644 --- a/resources/js/Components/Pigeon/PigeonPerch.vue +++ b/resources/js/Components/Pigeon/PigeonPerch.vue @@ -59,7 +59,9 @@ onUnmounted(() => { }) const timeLeft = computed(() => { - return DateTime.fromISO("2017-05-15T00:00:00").plus({second: secondsLeft.value}).toLocaleString(DateTime.TIME_24_WITH_SECONDS); + return DateTime.fromISO("2017-05-15T00:00:00") + .plus({second: secondsLeft.value > 0 ? secondsLeft.value : 0}) + .toLocaleString(DateTime.TIME_24_WITH_SECONDS); }) diff --git a/resources/js/Pages/News/Index.vue b/resources/js/Pages/News/Index.vue index fb8d806..6a5d5de 100644 --- a/resources/js/Pages/News/Index.vue +++ b/resources/js/Pages/News/Index.vue @@ -31,7 +31,8 @@ const parentElementSize = useElementSize(parentElement); let newsStatePollingInterval: number; onMounted(() => { - newsStatePollingInterval = setInterval(() => router.reload({only: ['news', 'pigeon']}), 10_000); + // dirty but poc + newsStatePollingInterval = setInterval(() => router.reload({only: ['news', 'pigeon']}), 1_000); }) onUnmounted(() => {