diff --git a/src/components/locked-content-lit.ts b/src/components/locked-content-lit.ts index 5ec34b2..8044ee3 100644 --- a/src/components/locked-content-lit.ts +++ b/src/components/locked-content-lit.ts @@ -1,4 +1,4 @@ -import { LitElement, html, unsafeCSS, type CSSResultGroup } from "lit"; +import { LitElement, html, nothing, unsafeCSS, type CSSResultGroup } from "lit"; import { customElement, property, state } from "lit/decorators.js"; import L, { type LatLngTuple } from "leaflet"; @@ -35,7 +35,9 @@ export class LockedContent extends LitElement { @state() protected _unlocked = false; @state() - protected _targetProximity?: string; + protected _arrived = false; + @state() + protected _targetProximityText?: string; @state() protected _watchId?: number; @@ -57,13 +59,13 @@ export class LockedContent extends LitElement { const betweenMeters = currentLatLng.distanceTo(targetLatLng); if (betweenMeters > 1000) { - this._targetProximity = `${(betweenMeters / 1000).toFixed()} KM`; + this._targetProximityText = `${(betweenMeters / 1000).toFixed()} KM`; } else if (betweenMeters > 100) { - this._targetProximity = `${betweenMeters.toFixed(0)} M`; + this._targetProximityText = `${betweenMeters.toFixed(0)} M`; } else { if (this._watchId) { navigator.geolocation.clearWatch(this._watchId); - this._unlocked = true; + this._arrived = true; } } } @@ -145,7 +147,7 @@ export class LockedContent extends LitElement {

İçeriği görmek için konuma gitmelisin! Kalan mesafe: - ${this._targetProximity} + ${this._targetProximityText}

@@ -155,6 +157,10 @@ export class LockedContent extends LitElement { unlockedButtonTemplate() { return html`
`;