MCPcopy Create free account
hub / github.com/TanStack/query / QueryStatus

Function QueryStatus

packages/query-devtools/src/Devtools.tsx:1862–1977  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

1860}
1861
1862const QueryStatus: Component<QueryStatusProps> = (props) => {
1863 const { selectedQueryHash, panelWidth } = useDevtoolsState()
1864
1865 const theme = useTheme()
1866 const css = useQueryDevtoolsContext().shadowDOMTarget
1867 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1868 : goober.css
1869 const styles = createMemo(() => {
1870 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1871 })
1872
1873 const { colors, alpha } = tokens
1874 const t = (light: string, dark: string) => (theme() === 'dark' ? dark : light)
1875
1876 let tagRef!: HTMLButtonElement
1877
1878 const [mouseOver, setMouseOver] = createSignal(false)
1879 const [focused, setFocused] = createSignal(false)
1880
1881 const showLabel = createMemo(() => {
1882 if (selectedQueryHash()) {
1883 if (panelWidth() < firstBreakpoint && panelWidth() > secondBreakpoint) {
1884 return false
1885 }
1886 }
1887 if (panelWidth() < secondBreakpoint) {
1888 return false
1889 }
1890
1891 return true
1892 })
1893
1894 return (
1895 <button
1896 onFocus={() => setFocused(true)}
1897 onBlur={() => setFocused(false)}
1898 onMouseEnter={() => setMouseOver(true)}
1899 onMouseLeave={() => {
1900 setMouseOver(false)
1901 setFocused(false)
1902 }}
1903 disabled={showLabel()}
1904 ref={tagRef}
1905 aria-label={`${props.label}: ${props.count}`}
1906 class={cx(
1907 styles().queryStatusTag,
1908 !showLabel() &&
1909 css`
1910 cursor: pointer;
1911 &:hover {
1912 background: ${t(
1913 colors.gray[200],
1914 colors.darkGray[400],
1915 )}${alpha[80]};
1916 }
1917 `,
1918 'tsqd-query-status-tag',
1919 `tsqd-query-status-tag-${props.label.toLowerCase()}`,

Callers

nothing calls this directly

Calls 6

useDevtoolsStateFunction · 0.90
useThemeFunction · 0.90
useQueryDevtoolsContextFunction · 0.90
darkStylesFunction · 0.70
lightStylesFunction · 0.70
tFunction · 0.70

Tested by

no test coverage detected