Skip to content

Commit

Permalink
poc of nanoui cringe
Browse files Browse the repository at this point in the history
  • Loading branch information
Furrior committed Feb 2, 2025
1 parent 35d270f commit 75efc80
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 18 deletions.
49 changes: 31 additions & 18 deletions app/public/nanoui/index.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
<html>
<head>
<title>TGUI at home</title>
<link rel="stylesheet" href="css/shared.css">
<link rel="stylesheet" href="css/layout_default.css">
<link rel="stylesheet" href="css/icons.css">
</head>
<body>
<div id='uiWrapper'>
<div id='uiTitleWrapper'>
<div id="uiTitle" class="icon">
<span id="uiStatusIcon" class="icon24 uiStatusGood"></span>
<span id="uiTitleText">We have TGUI at home</span>
</div>
</div>
<div id='uiContent'>
<div id='uiLoadingNotice'>Loading...</div>
</div>
<head>
<title>TGUI at home</title>
<link rel="stylesheet" href="css/shared.css" />
<link rel="stylesheet" href="css/layout_default.css" />
<link rel="stylesheet" href="css/icons.css" />
<script src="js/index.js"></script>
</head>
<body>
<div id="uiWrapper">
<div id="uiTitleWrapper">
<div id="uiTitle" class="icon">
<span id="uiStatusIcon" class="icon24 uiStatusGood"></span>
<span id="uiTitleText">We have TGUI at home</span>
</div>
</body>
</div>
<div id="uiContent">
<div style="padding: 20px;">
<input
type="text"
id="ckeyInput"
placeholder="Enter ckey..."
style="padding: 8px; margin-right: 10px;"
>
<button class="width75btn"
onclick="fetchPlayer()"
>
Search
</button>
</div>
</div>
</div>
</body>
</html>
35 changes: 35 additions & 0 deletions app/public/nanoui/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function displayPlayerInfo(playerData) {
const uiContent = document.getElementById("uiContent");
uiContent.innerHTML = `
<div>Ckey: ${playerData.ckey}</div>
<div>Discord ID: ${playerData.discord_id}</div>
`;
}

function displayError(error) {
const uiContent = document.getElementById("uiContent");
uiContent.innerHTML = `Error: ${error.message}`;
}

function fetchPlayer() {
const ckeyInput = document.getElementById("ckeyInput");
const ckey = ckeyInput.value.trim();
const uiContent = document.getElementById("uiContent");

if (!ckey) {
displayError(new Error("Please enter a ckey"));
return;
}

uiContent.innerHTML = "Loading...";

fetch(`http://127.0.0.1:8000/v1/player?ckey=${encodeURIComponent(ckey)}`)
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
})
.then(displayPlayerInfo)
.catch(displayError);
}

0 comments on commit 75efc80

Please sign in to comment.