Skip to content

Commit 662b36d

Browse files
committed
feat: Uodate UI/UX: add "Checked at" indicator to each service, add btn to open service to each service, let refersh-icon spim with cubic-bezier while services are checked ...
1 parent 01c5b6c commit 662b36d

File tree

2 files changed

+36
-8
lines changed

2 files changed

+36
-8
lines changed

config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
return [
4-
'version' => 'v1.2.0',
4+
'version' => 'v1.2.1',
55
'services' => [
66
[
77
'address' => 'https://mtex.dev',

index.php

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@
3939
<meta name="viewport" content="width=device-width, initial-scale=1.0">
4040
<title>MTEX Status</title>
4141
<script src="https://cdn.tailwindcss.com"></script>
42+
<style>
43+
@keyframes custom-spin {
44+
from { transform: rotate(0deg); }
45+
to { transform: rotate(360deg); }
46+
}
47+
.animate-spin-custom {
48+
animation: custom-spin 1s cubic-bezier(.17,.63,.82,.42) infinite;
49+
}
50+
</style>
4251
</head>
4352
<body class="bg-neutral-950 text-neutral-100 min-h-screen">
4453
<div class="max-w-5xl mx-auto px-6 py-12">
@@ -50,11 +59,11 @@
5059
</div>
5160
<div class="flex items-center gap-2 text-sm text-neutral-500">
5261
<div class="w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"></div>
53-
<span id="last-update">Live · Updated <?php echo date('H:i:s'); ?></span>
62+
<span id="last-update">Live · Initializing...</span>
5463
</div>
5564
</div>
56-
<button onclick="checkAllServices()" class="p-2 hover:bg-neutral-900 rounded-lg transition-colors text-neutral-400 hover:text-white" title="Refresh Status">
57-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
65+
<button id="refresh-btn" onclick="checkAllServices()" class="p-2 hover:bg-neutral-900 rounded-lg transition-colors text-neutral-400 hover:text-white" title="Refresh Status">
66+
<svg id="refresh-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
5867
<path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" />
5968
</svg>
6069
</button>
@@ -77,7 +86,7 @@ class="service-card bg-neutral-900 border border-neutral-800 rounded-xl p-6 hove
7786
</div>
7887
<p class="text-sm text-neutral-400 mb-3"><?php echo $service['description']; ?></p>
7988
<div class="flex items-center gap-4 text-xs">
80-
<a href="<?php echo $service['github']; ?>"
89+
<a href="<?php echo $service['github']; ?>" target="_blank"
8190
class="text-neutral-500 hover:text-neutral-300 transition-colors flex items-center gap-1.5">
8291
<svg class="w-3.5 h-3.5" fill="currentColor" viewBox="0 0 24 24">
8392
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
@@ -86,8 +95,15 @@ class="text-neutral-500 hover:text-neutral-300 transition-colors flex items-cent
8695
</a>
8796
<span class="text-neutral-700">·</span>
8897
<span class="text-neutral-600 font-mono"><?php echo $service['address']; ?></span>
98+
<span class="text-neutral-700">·</span>
99+
<span class="last-check text-neutral-600 italic">Never checked</span>
89100
</div>
90101
</div>
102+
<a href="<?php echo $service['address']; ?>" target="_blank" class="p-2 bg-neutral-800 hover:bg-neutral-700 rounded-lg text-neutral-400 hover:text-white transition-all">
103+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-5">
104+
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25" />
105+
</svg>
106+
</a>
91107
</div>
92108
</div>
93109
<?php endforeach; ?>
@@ -110,17 +126,21 @@ class="text-neutral-500 hover:text-neutral-300 transition-colors flex items-cent
110126
const isDeployed = card.dataset.deployed === 'true';
111127
const dot = card.querySelector('.status-dot');
112128
const label = card.querySelector('.status-text');
129+
const checkTime = card.querySelector('.last-check');
113130

114131
if (!isDeployed) {
115132
updateUI(card, dot, label, 'maintenance', 'bg-amber-500', 'border-amber-500/20');
116133
return;
117134
}
118135

119136
try {
120-
const response = await fetch(address, { mode: 'no-cors', cache: 'no-cache' });
137+
await fetch(address, { mode: 'no-cors', cache: 'no-cache' });
121138
updateUI(card, dot, label, 'online', 'bg-emerald-500', 'border-emerald-500/20');
122139
} catch (error) {
123140
updateUI(card, dot, label, 'offline', 'bg-red-500', 'border-red-500/20');
141+
} finally {
142+
const now = new Date();
143+
checkTime.textContent = `Checked at ${now.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit', second: '2-digit' })}`;
124144
}
125145
}
126146

@@ -130,11 +150,19 @@ function updateUI(card, dot, label, stateKey, colorClass, borderClass) {
130150
card.className = `service-card bg-neutral-900 border ${borderClass} rounded-xl p-6 hover:bg-neutral-900/80 transition-all`;
131151
}
132152

133-
function checkAllServices() {
153+
async function checkAllServices() {
154+
const icon = document.getElementById('refresh-icon');
155+
icon.classList.add('animate-spin-custom');
156+
134157
const now = new Date();
135158
const timeString = now.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit', second: '2-digit' });
136159
document.getElementById('last-update').textContent = `Live · Updated ${timeString}`;
137-
document.querySelectorAll('.service-card').forEach(checkService);
160+
161+
const cards = document.querySelectorAll('.service-card');
162+
const promises = Array.from(cards).map(card => checkService(card));
163+
164+
await Promise.all(promises);
165+
icon.classList.remove('animate-spin-custom');
138166
}
139167

140168
window.onload = checkAllServices;

0 commit comments

Comments
 (0)