File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 {{ title }}
1515 </slot >
1616 <slot v-if =" status && status.enabled" name =" status" :data =" data" >
17- <ServiceBaseStatus :ping =" data ?.ping " />
17+ <ServiceBaseStatus :ping =" { ... data ?.ping , animation: status ?. animation } " />
1818 </slot >
1919 </h3 >
2020
Original file line number Diff line number Diff line change 11<template >
2- <span class =" relative inline-flex z-1 h-2.5 w-2.5 rounded-full bg-green-400" :class =" color " >
3- <span class =" absolute -z-1 inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75" :class =" color " />
2+ <span class =" relative inline-flex z-1 h-2.5 w-2.5 rounded-full bg-green-400" :class =" colorClasses " >
3+ <span v-if = " !ping || ping.animation !== false " class =" absolute -z-1 inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75" :class =" colorClasses " />
44 </span >
55</template >
66
77<script setup lang="ts">
88export interface Props {
99 ping? : {
10- status: boolean
10+ status? : boolean
11+ animation? : boolean
1112 time: number
1213 }
1314}
1415
15- const props = defineProps <Props >()
16- const color = computed (() => {
17- if (! props .ping ) {
18- return ' bg-neutral-400'
19- }
20-
21- return props .ping .status ? ' bg-green-400' : ' bg-red-400'
16+ const props = withDefaults (defineProps <Props >(), {
17+ ping : () => ({
18+ status: undefined ,
19+ animation: true ,
20+ time: 0 ,
21+ }),
2222})
23+
24+ const colorClasses = computed (() => [
25+ { ' bg-green-400' : props .ping .status },
26+ { ' bg-red-400' : props .ping .status === false },
27+ { ' bg-neutral-400' : props .ping .status === undefined },
28+ ])
2329 </script >
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { z } from 'zod'
33export const statusSchema = z . object ( {
44 enabled : z . boolean ( ) . optional ( ) ,
55 interval : z . number ( ) . optional ( ) ,
6+ animation : z . boolean ( ) . optional ( ) ,
67} )
78
89export const iconSchema = z . object ( {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import type { Tag } from '~/types/config'
33export interface ServiceStatus {
44 enabled ?: boolean
55 interval ?: number
6+ animation ?: boolean
67}
78
89export interface ServiceIcon {
You can’t perform that action at this time.
0 commit comments