(props)
| 1440 | } |
| 1441 | |
| 1442 | const MutationRow: Component<{ mutation: Mutation }> = (props) => { |
| 1443 | const theme = useTheme() |
| 1444 | const css = useQueryDevtoolsContext().shadowDOMTarget |
| 1445 | ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget }) |
| 1446 | : goober.css |
| 1447 | const styles = createMemo(() => { |
| 1448 | return theme() === 'dark' ? darkStyles(css) : lightStyles(css) |
| 1449 | }) |
| 1450 | |
| 1451 | const { colors, alpha } = tokens |
| 1452 | const t = (light: string, dark: string) => (theme() === 'dark' ? dark : light) |
| 1453 | |
| 1454 | const mutationState = createSubscribeToMutationCacheBatcher( |
| 1455 | (mutationCache) => { |
| 1456 | const mutations = mutationCache().getAll() |
| 1457 | const mutation = mutations.find( |
| 1458 | (m) => m.mutationId === props.mutation.mutationId, |
| 1459 | ) |
| 1460 | return mutation?.state |
| 1461 | }, |
| 1462 | ) |
| 1463 | |
| 1464 | const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => { |
| 1465 | const mutations = mutationCache().getAll() |
| 1466 | const mutation = mutations.find( |
| 1467 | (m) => m.mutationId === props.mutation.mutationId, |
| 1468 | ) |
| 1469 | if (!mutation) return false |
| 1470 | return mutation.state.isPaused |
| 1471 | }) |
| 1472 | |
| 1473 | const status = createSubscribeToMutationCacheBatcher((mutationCache) => { |
| 1474 | const mutations = mutationCache().getAll() |
| 1475 | const mutation = mutations.find( |
| 1476 | (m) => m.mutationId === props.mutation.mutationId, |
| 1477 | ) |
| 1478 | if (!mutation) return 'idle' |
| 1479 | return mutation.state.status |
| 1480 | }) |
| 1481 | |
| 1482 | const color = createMemo(() => |
| 1483 | getMutationStatusColor({ |
| 1484 | isPaused: isPaused(), |
| 1485 | status: status(), |
| 1486 | }), |
| 1487 | ) |
| 1488 | |
| 1489 | const getObserverCountColorStyles = () => { |
| 1490 | if (color() === 'gray') { |
| 1491 | return css` |
| 1492 | background-color: ${t(colors[color()][200], colors[color()][700])}; |
| 1493 | color: ${t(colors[color()][700], colors[color()][300])}; |
| 1494 | ` |
| 1495 | } |
| 1496 | |
| 1497 | return css` |
| 1498 | background-color: ${t( |
| 1499 | colors[color()][200] + alpha[80], |
nothing calls this directly
no test coverage detected
searching dependent graphs…