diff --git a/bun.lockb b/bun.lockb
index 9b6bf30..fb03fc2 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro
index 8abea3f..ee8d6d6 100644
--- a/src/layouts/Layout.astro
+++ b/src/layouts/Layout.astro
@@ -1,50 +1,48 @@
-
+
-
-
-
-
+
+
+
+
+ src='https://unpkg.com/leaflet@1.9.4/dist/leaflet.js'
+ integrity='sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo='
+ crossorigin=''>
-
-
-
+ type='text/javascript'
+ src='https://cdn.jsdelivr.net/npm/toastify-js'>
+
+
+
-
-
+
+
Konulu Konum
-
+
diff --git a/src/pages/[id].astro b/src/pages/[id].astro
index 35d76e3..28cc2a1 100644
--- a/src/pages/[id].astro
+++ b/src/pages/[id].astro
@@ -68,12 +68,6 @@ const dateFromNow = dayjs.utc(data?.created_at).from(dayjs.utc());
-
-
@@ -146,7 +139,6 @@ const dateFromNow = dayjs.utc(data?.created_at).from(dayjs.utc());
-
diff --git a/src/scripts/initMap.ts b/src/scripts/initMap.ts
index 2f1a77f..bd1f7b2 100644
--- a/src/scripts/initMap.ts
+++ b/src/scripts/initMap.ts
@@ -1,4 +1,5 @@
import L from "leaflet";
+import Toastify from "toastify-js";
type TargetLocation = [lat: number, lng: number] | null;
@@ -59,6 +60,20 @@ const CurrentLocation = L.Control.extend({
locationButton.addEventListener("click", () => {
if (currentLocationMarker) {
map.setView(currentLocationMarker.getLatLng(), 12);
+ } else {
+ Toastify({
+ text: "Konumunuza erişilemiyor, lütfen biraz bekleyip tekrar deneyin.",
+ duration: 3000,
+ gravity: "top",
+ position: "center",
+ stopOnFocus: true,
+ style: {
+ background: "black",
+ borderRadius: "6px",
+ margin: "16px",
+ },
+ onClick: function () {},
+ }).showToast();
}
});
diff --git a/src/scripts/lockedContent.ts b/src/scripts/lockedContent.ts
index 3745ef7..c7b85d1 100644
--- a/src/scripts/lockedContent.ts
+++ b/src/scripts/lockedContent.ts
@@ -2,6 +2,7 @@ import {
calculateDistance,
errorCallback,
} from "@/components/LockedContent/geolocation";
+import { incrementUnlockCounter } from "@/components/LockedContent/serverUtils";
import { onLocationSuccess } from "@/scripts/initMap";
let watchId: number;
@@ -18,6 +19,9 @@ const locationPermissionButton = document.getElementById(
"location-permission-button"
);
+if (locationPermissionButton)
+ locationPermissionButton.addEventListener("click", startWatchingLocation);
+
// Generates a human readable destination text according to
// distance remaining
function generateDistanceText(distance: number) {
@@ -38,6 +42,7 @@ function updateCurrentLocation(position: GeolocationPosition) {
[newPosition.latitude, newPosition.longitude],
JSON.parse(targetLocation)
);
+
if (distance < 100) {
// If user has arrived to destination
// Transform locked button to reveal button
@@ -46,7 +51,6 @@ function updateCurrentLocation(position: GeolocationPosition) {
const lockIcon = document.getElementById("lock-icon");
const buttonText = document.getElementById("button-text");
const description = document.getElementById("locked-content-description");
-
if (unlockButton) {
if (buttonText) buttonText.innerText = "İçeriği Göster";
if (lockIcon) lockIcon.classList.add("hidden");
@@ -71,6 +75,7 @@ function updateCurrentLocation(position: GeolocationPosition) {
const unlockButtonContainer = document.getElementById(
"unlock-button-container"
);
+ incrementUnlockCounter(document.URL.slice(-12));
if (image) image.classList.remove("blur-2xl");
if (unlockButtonContainer) unlockButtonContainer.remove();
});
@@ -82,7 +87,9 @@ function updateCurrentLocation(position: GeolocationPosition) {
descriptionElement.innerText = `Kalan mesafe: ${distanceText}`;
}
- if (locationPermissionButton) locationPermissionButton.remove();
+ if (locationPermissionButton) {
+ locationPermissionButton.remove();
+ }
}
// Update leaflet controls