forked from didirus/AstralRinth
* chore(pyroservers): attempt better error propogation Signed-off-by: Evan Song <theevansong@gmail.com> * chore(pyroservers): introduce deferred modules * fix(pyroservers): synchronize server icon processing Signed-off-by: Evan Song <theevansong@gmail.com> * refactor: server action buttons Signed-off-by: Evan Song <theevansong@gmail.com> * chore: bring back skeleton * fix(startup): populate values on refresh Signed-off-by: Evan Song <theevansong@gmail.com> * chore: properly refresh network Signed-off-by: Evan Song <theevansong@gmail.com> * fix: do not open backup settings modal if fetch failed * fix(platform): only clear selected loader version if selecting a different loader Signed-off-by: Evan Song <theevansong@gmail.com> * feat: parse links in console log * fix: attempt to mitigate power button state flash Signed-off-by: Evan Song <theevansong@gmail.com> * Revert "fix: attempt to mitigate power button state flash" This reverts commit 3ba5c0b4f7f5bacf1576aba5efe42785696a5aed. * refactor: error accumulation builder in PyroServersFetch Signed-off-by: Evan Song <theevansong@gmail.com> * fix: sentence case Signed-off-by: Evan Song <theevansong@gmail.com> * fix(files): await deferred fs Signed-off-by: Evan Song <theevansong@gmail.com> * fix: startup border Signed-off-by: Evan Song <theevansong@gmail.com> * fix: prevent suspended server errors from being overwritten Signed-off-by: Evan Song <theevansong@gmail.com> * fix: add server id copy button to suspended server listing Signed-off-by: Evan Song <theevansong@gmail.com> * fix: refresh behavior Signed-off-by: Evan Song <theevansong@gmail.com> * fix: behavior of server icon in options Signed-off-by: Evan Song <theevansong@gmail.com> * chore: clean Signed-off-by: Evan Song <theevansong@gmail.com> * chore: clean Signed-off-by: Evan Song <theevansong@gmail.com> * fix: prevent error inspector failures from destroying the page Signed-off-by: Evan Song <theevansong@gmail.com> * chore: clean Signed-off-by: Evan Song <theevansong@gmail.com> * chore: remove nexttick wrapper Signed-off-by: Evan Song <theevansong@gmail.com> * fix: ensure file edit gets initted due to deferred module Signed-off-by: Evan Song <theevansong@gmail.com> * refactor: prevent module errors from breaking the layout * chore: clean Signed-off-by: Evan Song <theevansong@gmail.com> --------- Signed-off-by: Evan Song <theevansong@gmail.com>
73 lines
1.9 KiB
Vue
73 lines
1.9 KiB
Vue
<template>
|
|
<div
|
|
:aria-label="`Server is ${getStatusText(state)}`"
|
|
class="relative inline-flex select-none items-center"
|
|
@mouseenter="isExpanded = true"
|
|
@mouseleave="isExpanded = false"
|
|
>
|
|
<div
|
|
:class="[
|
|
'h-4 w-4 rounded-full transition-all duration-300 ease-in-out',
|
|
getStatusClass(state).main,
|
|
]"
|
|
>
|
|
<div
|
|
:class="[
|
|
'absolute inline-flex h-4 w-4 animate-ping rounded-full',
|
|
getStatusClass(state).bg,
|
|
]"
|
|
></div>
|
|
</div>
|
|
<div
|
|
:class="[
|
|
'absolute -left-4 flex w-auto items-center gap-2 rounded-full px-2 py-1 transition-all duration-150 ease-in-out',
|
|
getStatusClass(state).bg,
|
|
isExpanded ? 'translate-x-2 scale-100 opacity-100' : 'translate-x-0 scale-90 opacity-0',
|
|
]"
|
|
>
|
|
<div class="h-3 w-3 rounded-full"></div>
|
|
<span
|
|
:class="[
|
|
'origin-left whitespace-nowrap text-sm font-semibold text-contrast transition-all duration-[200ms] ease-in-out',
|
|
isExpanded ? 'translate-x-0 scale-100' : '-translate-x-1 scale-x-75',
|
|
]"
|
|
>
|
|
{{ getStatusText(state) }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref } from "vue";
|
|
import type { ServerState } from "~/types/servers";
|
|
|
|
const STATUS_CLASSES = {
|
|
running: { main: "bg-brand", bg: "bg-bg-green" },
|
|
stopped: { main: "", bg: "" },
|
|
crashed: { main: "bg-brand-red", bg: "bg-bg-red" },
|
|
unknown: { main: "", bg: "" },
|
|
} as const;
|
|
|
|
const STATUS_TEXTS = {
|
|
running: "Running",
|
|
stopped: "",
|
|
crashed: "Crashed",
|
|
unknown: "Unknown",
|
|
} as const;
|
|
|
|
defineProps<{
|
|
state: ServerState;
|
|
}>();
|
|
|
|
const isExpanded = ref(false);
|
|
|
|
function getStatusClass(state: ServerState) {
|
|
return STATUS_CLASSES[state] ?? STATUS_CLASSES.unknown;
|
|
}
|
|
|
|
function getStatusText(state: ServerState) {
|
|
return STATUS_TEXTS[state] ?? STATUS_TEXTS.unknown;
|
|
}
|
|
</script>
|