You've already forked AstralRinth
forked from xxxOFFxxx/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>
66 lines
1.8 KiB
Vue
66 lines
1.8 KiB
Vue
<template>
|
|
<div
|
|
v-if="uptimeSeconds || uptimeSeconds !== 0"
|
|
v-tooltip="`Online for ${verboseUptime}`"
|
|
class="server-action-buttons-anim flex min-w-0 flex-row items-center gap-4"
|
|
data-pyro-uptime
|
|
>
|
|
<div v-if="!noSeparator" class="experimental-styles-within h-6 w-0.5 bg-button-border"></div>
|
|
|
|
<div class="flex gap-2">
|
|
<UiServersIconsTimer class="flex size-5 shrink-0" />
|
|
<time class="truncate text-sm font-semibold" :aria-label="verboseUptime">
|
|
{{ formattedUptime }}
|
|
</time>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from "vue";
|
|
|
|
const props = defineProps<{
|
|
uptimeSeconds: number;
|
|
noSeparator?: boolean;
|
|
}>();
|
|
|
|
const formattedUptime = computed(() => {
|
|
const days = Math.floor(props.uptimeSeconds / (24 * 3600));
|
|
const hours = Math.floor((props.uptimeSeconds % (24 * 3600)) / 3600);
|
|
const minutes = Math.floor((props.uptimeSeconds % 3600) / 60);
|
|
const seconds = props.uptimeSeconds % 60;
|
|
|
|
let formatted = "";
|
|
if (days > 0) {
|
|
formatted += `${days}d `;
|
|
}
|
|
if (hours > 0 || days > 0) {
|
|
formatted += `${hours}h `;
|
|
}
|
|
formatted += `${minutes}m ${seconds}s`;
|
|
|
|
return formatted.trim();
|
|
});
|
|
|
|
const verboseUptime = computed(() => {
|
|
const days = Math.floor(props.uptimeSeconds / (24 * 3600));
|
|
const hours = Math.floor((props.uptimeSeconds % (24 * 3600)) / 3600);
|
|
const minutes = Math.floor((props.uptimeSeconds % 3600) / 60);
|
|
const seconds = props.uptimeSeconds % 60;
|
|
|
|
let verbose = "";
|
|
if (days > 0) {
|
|
verbose += `${days} day${days > 1 ? "s" : ""} `;
|
|
}
|
|
if (hours > 0) {
|
|
verbose += `${hours} hour${hours > 1 ? "s" : ""} `;
|
|
}
|
|
if (minutes > 0) {
|
|
verbose += `${minutes} minute${minutes > 1 ? "s" : ""} `;
|
|
}
|
|
verbose += `${seconds} second${seconds > 1 ? "s" : ""}`;
|
|
|
|
return verbose.trim();
|
|
});
|
|
</script>
|