summaryrefslogtreecommitdiff
path: root/web/src/pages/index.astro
blob: f1dc6e7eb7432642e1b20fadcedd0637b83d77f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
import Layout from '../layouts/Layout.astro';
import { PendingQuotes } from '../components/Quotes';

---

<Layout>
	<div class="container">
		<h1 id="version">AleeBot</h1>
		<PendingQuotes client:load />
	</div>
</Layout>

<style>
	@import url('https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,100..900;1,100..900&display=swap');
	html,
	body {
		margin: 0;
		width: 100%;
		height: 100%;
		font-family: "Exo 2", sans-serif;
	}

	.container {
		margin: 2em;
	}

</style>

<script>
	import { API_URL } from "astro:env/client"
	document.addEventListener('DOMContentLoaded', async () => {
		try {
			const version = await fetch(`${API_URL}/api/version`).then((res) => res.json());
			const versionElement = document.getElementById('version');
			if (versionElement) {
				versionElement.textContent = `AleeBot ${version}`;
			} else {
				console.error('Element with ID "version" not found.');
			}
		} catch (e) {
			console.error('Failed to fetch version:', e);
		}
	});
</script>