feat : new ui et message discord
This commit is contained in:
@@ -1,49 +1,45 @@
|
||||
<template>
|
||||
<div class="bg-m-secondary w-[250px] h-[292px] rounded-md mx-4 shadow-md/50 shadow-black">
|
||||
<p class="font-bold text-3xl text-m-tertiary my-1 mx-3">
|
||||
Status
|
||||
</p>
|
||||
<div class="status-card card-glow">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title">Status</h2>
|
||||
<span class="font-mono text-[10px] text-m-muted tracking-widest uppercase">Services</span>
|
||||
</div>
|
||||
|
||||
<template v-if="loading">
|
||||
<div
|
||||
v-for="n in 3"
|
||||
:key="`skeleton-${n}`"
|
||||
class="relative w-[200px] h-[68px] rounded-md mx-[25px] mb-3"
|
||||
class="status-row animate-shimmer"
|
||||
>
|
||||
<ButtonSkeleton custom-class="h-full w-full" />
|
||||
<div class="absolute inset-0 p-2">
|
||||
<TextSkeleton custom-class="h-5 w-24 mb-2" />
|
||||
<div class="flex items-center gap-2">
|
||||
<CircleSkeleton custom-class="h-6 w-6" />
|
||||
<TextSkeleton custom-class="h-5 w-20" />
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<CircleSkeleton custom-class="h-3 w-3" />
|
||||
<TextSkeleton custom-class="h-4 w-20" />
|
||||
</div>
|
||||
<TextSkeleton custom-class="h-4 w-16" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div
|
||||
v-else
|
||||
class="bg-m-tertiary w-[200px] h-[68px] rounded-md shadow-md/50 shadow-m-black mx-[25px] mb-3"
|
||||
v-for="row in rows"
|
||||
:key="`${row.label}-${row.url}`"
|
||||
class="status-row"
|
||||
:class="row.status === 200 ? 'row-ok' : 'row-error'"
|
||||
>
|
||||
<p class="font-bold text-xl text-m-text mt-2 mx-2 mb-1">
|
||||
{{ row.label }}
|
||||
</p>
|
||||
<div class="mx-2 flex items-center">
|
||||
<span
|
||||
class="inline-block h-[24px] w-[24px] rounded-full mr-2"
|
||||
:class="statusClass(row.status)"
|
||||
/>
|
||||
<span class="font-semibold text-lg">
|
||||
{{ statusLabel(row.status) }}
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="status-dot" :class="row.status === 200 ? 'dot-ok' : 'dot-error'" />
|
||||
<span class="font-display text-sm font-semibold text-m-text">
|
||||
{{ row.label }}
|
||||
</span>
|
||||
</div>
|
||||
<span class="font-mono text-xs" :class="row.status === 200 ? 'text-m-success' : 'text-m-error'">
|
||||
{{ statusLabel(row.status) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ButtonSkeleton from "~/components/skeleton/ButtonSkeleton.vue"
|
||||
import CircleSkeleton from "~/components/skeleton/CircleSkeleton.vue"
|
||||
import TextSkeleton from "~/components/skeleton/TextSkeleton.vue"
|
||||
import {onBeforeUnmount, onMounted, ref} from "vue"
|
||||
@@ -77,16 +73,10 @@ const loading = ref(true)
|
||||
const initialized = ref(false)
|
||||
let timer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
const statusClass = (status: number) => {
|
||||
if (status === 200) return "bg-m-success"
|
||||
if (status === 0) return "bg-m-error"
|
||||
return "bg-m-error"
|
||||
}
|
||||
|
||||
const statusLabel = (status: number) => {
|
||||
if (status === 200) return "HTTP 200"
|
||||
if (status === 0) return "Injoignable"
|
||||
return `KO (HTTP ${status})`
|
||||
return `KO (${status})`
|
||||
}
|
||||
|
||||
const checkStatus = async () => {
|
||||
@@ -125,3 +115,67 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.status-card {
|
||||
background: rgb(var(--m-secondary));
|
||||
border-radius: 12px;
|
||||
padding: 1.25rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.625rem;
|
||||
transition: background-color 0.4s ease;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
color: rgb(var(--m-text));
|
||||
}
|
||||
|
||||
.status-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 8px;
|
||||
background: rgb(var(--m-tertiary));
|
||||
border: 1px solid transparent;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.row-ok {
|
||||
border-color: rgb(var(--m-success) / 0.08);
|
||||
}
|
||||
|
||||
.row-error {
|
||||
border-color: rgb(var(--m-error) / 0.1);
|
||||
background: rgb(var(--m-error) / 0.04);
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.dot-ok {
|
||||
background: rgb(var(--m-success));
|
||||
box-shadow: 0 0 6px rgb(var(--m-success) / 0.5);
|
||||
}
|
||||
|
||||
.dot-error {
|
||||
background: rgb(var(--m-error));
|
||||
box-shadow: 0 0 6px rgb(var(--m-error) / 0.5);
|
||||
animation: pulse-glow 2s ease-in-out infinite;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user