Skip to content

Commit d1a4456

Browse files
authored
Merge pull request #36 from openspaceaarhus/add-spaceapi-status
Add SpaceAPI Status to front page
2 parents 83370b6 + 165bd05 commit d1a4456

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

_layouts/default.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ <h1> {{page.title}} </h1>
5151
</div>
5252

5353
</div>
54+
<script src="{{ "/assets/js/script.js" | relative_url }}"></script>
5455
</body>
5556
</html>

assets/js/script.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
document.addEventListener("DOMContentLoaded", function () {
2+
fetch("https://spaceapi.osaa.dk/status/json")
3+
.then(response => response.json())
4+
.then(data => {
5+
if (data.state && data.state.open === true) {
6+
document.getElementById("statusBox").style.display = "block";
7+
}
8+
})
9+
.catch(error => console.error("Error fetching space status:", error));
10+
});

index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@
4444
</div>
4545
</div>
4646

47+
48+
<div class="container">
49+
<div class="row">
50+
<div class="col col-md-12">
51+
<div id="statusBox" style="display: none; background-color: green; color: white; padding: 10px; margin-bottom: 10px;">
52+
Lige nu er spacet åbent.
53+
</div>
54+
</div>
55+
</div>
56+
</div>
57+
4758
<div class="container">
4859
<div class="row">
4960
<div class="col col-md-12 news">

0 commit comments

Comments
 (0)