Skip to content

Commit

Permalink
Leaflet
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Aug 1, 2024
1 parent dd0ccdd commit 8b52eaa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion engine/src/routes/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>enstate.rs - Lightweight ENS API</title>
<title>v3x.property - Asset Tracking API</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/docs/favicon.png" />
Expand Down
13 changes: 3 additions & 10 deletions web/src/components/ActiveSessionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { getRelativeTimeString } from '../util/date';
import { LeafletPreview } from './LeafletPreview';

const ActiveSession: FC<{ session: SessionResponse }> = ({ session }) => {
const { data: sessions, mutate: updateSessions } = useSessions();
const { mutate: updateSessions } = useSessions();
const { token } = useAuth();
const { data: geoip } = useGeoIp('77.162.232.110' /* session.user_ip */);
const { data: geoip } = useGeoIp(session.user_ip);
const user_agent = UAParser(session.user_agent);
const last_accessed = new Date(session.last_access);
const last_accessed_formatted = getRelativeTimeString(last_accessed);
Expand All @@ -28,16 +28,10 @@ const ActiveSession: FC<{ session: SessionResponse }> = ({ session }) => {
{geoip?.latitude && (
<div className="h-full">
<div className="w-32 h-32 aspect-square bg-gray-100 rounded-lg border border-neutral-400 overflow-hidden">
{/* <iframe src={mapUrl} className="w-full h-full" /> */}
<LeafletPreview
latitude={latitude}
longitude={longitude}
/>
{/* <img
alt=""
src={mapUrl}
className="w-full h-full object-contain"
/> */}
</div>
</div>
)}
Expand Down Expand Up @@ -105,8 +99,7 @@ const ActiveSession: FC<{ session: SessionResponse }> = ({ session }) => {
};

export const ActiveSessionsTable: FC = () => {
const { data: sessions, mutate: updateSessions } = useSessions();
const { token } = useAuth();
const { data: sessions } = useSessions();

return (
<div className="p-2 space-y-2">
Expand Down
5 changes: 3 additions & 2 deletions web/src/components/LeafletPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const LeafletPreview: FC<{ latitude: number; longitude: number }> = ({
lat: latitude,
lng: longitude,
}}
zoom={8}
zoom={5}
scrollWheelZoom={false}
className="w-full h-full"
dragging={false}
Expand All @@ -32,7 +32,8 @@ export const LeafletPreview: FC<{ latitude: number; longitude: number }> = ({
>
<TileLayer
// attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png"
// url="https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png"
url="https://tiles.stadiamaps.com/tiles/stamen_terrain_background/{z}/{x}/{y}{r}.png"
/>
</MapContainer>
);
Expand Down

0 comments on commit 8b52eaa

Please sign in to comment.