File tree Expand file tree Collapse file tree 4 files changed +55
-2
lines changed
Expand file tree Collapse file tree 4 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,21 @@ defineProps<{
88 </script >
99
1010<template >
11- <div class =" grid grid-cols-[1fr_auto_auto_auto] gap-2 px-2 text-secondary hover:n-bg-hover truncate" >
11+ <div
12+ class =" grid gap-2 px-2 text-secondary hover:n-bg-hover truncate"
13+ :style =" {
14+ 'grid-template-columns': '1em 1fr auto auto auto',
15+ }"
16+ >
17+ <div
18+ :style =" {
19+ 'width': '1em',
20+ 'height': '1em',
21+ 'border-radius': '10%',
22+ 'align-self': 'center',
23+ 'background-color': getBackgroundColor(item),
24+ }"
25+ />
1226 <div >
1327 {{ item.queryKey }}
1428 </div >
Original file line number Diff line number Diff line change @@ -119,6 +119,19 @@ function selectQuery(query: Query) {
119119 <div >
120120 {{ selectedQuery?.queryHash }}
121121 </div >
122+ <div >
123+ <strong >Overall status:</strong >
124+ </div >
125+ <div >
126+ <span
127+ class =" rounded whitespace-nowrap select-none mx-0.5 px-1.5 py-0.5"
128+ :style =" {
129+ 'background-color': `${getBackgroundColor(selectedQuery as Query)}`,
130+ }"
131+ >
132+ {{ getQueryStatusLabel(selectedQuery as Query) }}
133+ </span >
134+ </div >
122135 <div >
123136 <strong >Last Updated:</strong >
124137 </div >
Original file line number Diff line number Diff line change 1+ import type { Query } from '@tanstack/query-core'
2+
3+ export function getQueryStatusLabel ( query : Query ) {
4+ return query . state . fetchStatus === 'fetching'
5+ ? 'fetching'
6+ : query . observers . length < 1
7+ ? 'inactive'
8+ : query . state . fetchStatus === 'paused'
9+ ? 'paused'
10+ : toRaw ( query ) ?. isStale ( )
11+ ? 'stale'
12+ : 'fresh'
13+ }
14+
15+ export function getBackgroundColor ( query : Query ) {
16+ return query . state . fetchStatus === 'fetching'
17+ ? 'blue'
18+ : query . observers . length < 1
19+ ? 'gray'
20+ : query . state . fetchStatus === 'paused'
21+ ? 'purple'
22+ : toRaw ( query ) ?. isStale ( )
23+ ? 'orange'
24+ : 'green'
25+ }
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ function addNewPost() {
5555 < div
5656 : style= " {
5757 display: 'grid',
58- gridTemplateColumns: 'auto auto ',
58+ gridTemplateColumns: '1fr 1fr ',
5959 gap: '2rem',
6060 }"
6161 >
@@ -80,6 +80,7 @@ function addNewPost() {
8080 backgroundColor: selectedUserId === user.id ? 'blue' : 'white',
8181 color: selectedUserId === user.id ? 'white' : 'black',
8282 paddingTop: '0.25rem',
83+ borderRadius: '0.125rem',
8384 }"
8485 @click= " selectUser(user)"
8586 >
You can’t perform that action at this time.
0 commit comments