()
| 2382 | } |
| 2383 | |
| 2384 | const MutationDetails = () => { |
| 2385 | const theme = useTheme() |
| 2386 | const css = useQueryDevtoolsContext().shadowDOMTarget |
| 2387 | ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget }) |
| 2388 | : goober.css |
| 2389 | const styles = createMemo(() => { |
| 2390 | return theme() === 'dark' ? darkStyles(css) : lightStyles(css) |
| 2391 | }) |
| 2392 | |
| 2393 | const { colors } = tokens |
| 2394 | const t = (light: string, dark: string) => (theme() === 'dark' ? dark : light) |
| 2395 | |
| 2396 | const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => { |
| 2397 | const mutations = mutationCache().getAll() |
| 2398 | const mutation = mutations.find( |
| 2399 | (m) => m.mutationId === selectedMutationId(), |
| 2400 | ) |
| 2401 | if (!mutation) return false |
| 2402 | return mutation.state.isPaused |
| 2403 | }) |
| 2404 | |
| 2405 | const status = createSubscribeToMutationCacheBatcher((mutationCache) => { |
| 2406 | const mutations = mutationCache().getAll() |
| 2407 | const mutation = mutations.find( |
| 2408 | (m) => m.mutationId === selectedMutationId(), |
| 2409 | ) |
| 2410 | if (!mutation) return 'idle' |
| 2411 | return mutation.state.status |
| 2412 | }) |
| 2413 | |
| 2414 | const color = createMemo(() => |
| 2415 | getMutationStatusColor({ |
| 2416 | isPaused: isPaused(), |
| 2417 | status: status(), |
| 2418 | }), |
| 2419 | ) |
| 2420 | |
| 2421 | const activeMutation = createSubscribeToMutationCacheBatcher( |
| 2422 | (mutationCache) => |
| 2423 | mutationCache() |
| 2424 | .getAll() |
| 2425 | .find((mutation) => mutation.mutationId === selectedMutationId()), |
| 2426 | false, |
| 2427 | ) |
| 2428 | |
| 2429 | const getQueryStatusColors = () => { |
| 2430 | if (color() === 'gray') { |
| 2431 | return css` |
| 2432 | background-color: ${t(colors[color()][200], colors[color()][700])}; |
| 2433 | color: ${t(colors[color()][700], colors[color()][300])}; |
| 2434 | border-color: ${t(colors[color()][400], colors[color()][600])}; |
| 2435 | ` |
| 2436 | } |
| 2437 | return css` |
| 2438 | background-color: ${t(colors[color()][100], colors[color()][900])}; |
| 2439 | color: ${t(colors[color()][700], colors[color()][300])}; |
| 2440 | border-color: ${t(colors[color()][400], colors[color()][600])}; |
| 2441 | ` |
nothing calls this directly
no test coverage detected