feat: add map

This commit is contained in:
TheClashFruit 2023-09-18 18:10:55 +02:00
parent f879003a9f
commit a806fc043c
Signed by: TheClashFruit
GPG key ID: CF4A319B9A73290C
3 changed files with 44 additions and 21 deletions

View file

@ -7,6 +7,29 @@
<title>Clyde's Real Survival SMP &bull; {{ pageTitle }}</title>
{% if pageTitle == 'Map' %}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<style>
#map { height: 100vh; }
#homeLink {
position: absolute;
top: 16px;
left: 16px;
padding: 8px 16px;
z-index: 400;
background-color: #fff;
border-radius: 32px;
text-decoration: none;
color: #000;
}
</style>
{% endif %}
<link rel="icon" href="/favicon.ico">
<link rel="stylesheet" href="/css/style.min.css">
</head>

View file

@ -1,24 +1,24 @@
{% include 'includes/head.twig' with {'pageTitle': 'Map'} %}
<div class="pageHero" id="hero">
<div class="blurFiler">
<div class="container">
<h1>Clyde's Real Survival SMP</h1>
<div id="map"></div>
<a id="homeLink" href="/">Go Home</a>
<div class="serverInfo">
Online: <label>0</label> / <label>20</label>
</div>
</div>
</div>
</div>
<script>
let map = L.map('map', {
zoomControl: false,
scrollWheelZoom: false,
doubleClickZoom: false,
}).setView([-36.3, -41.3], 4);
{% include 'includes/nav.twig' with {'page': 'map',} %}
L.tileLayer('https://cdn.theclashfruit.me/crss/map/tile_{x}x{y}y.png', {
attribution: '&copy; <a href="https://crss.blurryface.xyz/">CRSS</a> players',
noWrap: true
}).addTo(map);
<main class="pageContent" id="content">
<div class="container">
<p>⚒️ Under Construction</p>
</div>
</main>
{% include 'includes/footer.twig' %}
L.marker([-36.3, -41.3])
.addTo(map)
.bindPopup('Spawn Town in Republic of Panorama');
</script>
{% include 'includes/foot.twig' %}

View file

@ -24,7 +24,7 @@
$stmt->execute();
}
function getUserRecordFromUsername($username): bool|array|null {
function getUserRecordFromUsername($username): array | null {
$sql = 'SELECT * FROM users WHERE username = ?';
$stmt = $this->conn->prepare($sql);
@ -41,7 +41,7 @@
}
}
function getUserRecordFromId($id): bool|array|null {
function getUserRecordFromId($id): array | null {
$sql = 'SELECT * FROM users WHERE id = ?';
$stmt = $this->conn->prepare($sql);