(props)
| 1424 | } |
| 1425 | |
| 1426 | const MutationRow: Component<{ mutation: Mutation }> = (props) => { |
| 1427 | const { selectedMutationId, setSelectedMutationId } = useDevtoolsState() |
| 1428 | |
| 1429 | const theme = useTheme() |
| 1430 | const themed = createThemed(theme) |
| 1431 | |
| 1432 | const mutationState = createSubscribeToMutationCacheBatcher( |
| 1433 | () => props.mutation.state, |
| 1434 | ) |
| 1435 | |
| 1436 | const isPaused = createSubscribeToMutationCacheBatcher( |
| 1437 | () => props.mutation.state.isPaused, |
| 1438 | ) |
| 1439 | |
| 1440 | const status = createSubscribeToMutationCacheBatcher( |
| 1441 | () => props.mutation.state.status, |
| 1442 | ) |
| 1443 | |
| 1444 | const color = createMemo(() => |
| 1445 | getMutationStatusColor({ |
| 1446 | isPaused: isPaused(), |
| 1447 | status: status(), |
| 1448 | }), |
| 1449 | ) |
| 1450 | |
| 1451 | return ( |
| 1452 | <Show when={mutationState()}> |
| 1453 | <button |
| 1454 | onClick={() => { |
| 1455 | setSelectedMutationId( |
| 1456 | props.mutation.mutationId === selectedMutationId() |
| 1457 | ? null |
| 1458 | : props.mutation.mutationId, |
| 1459 | ) |
| 1460 | }} |
| 1461 | class={`${themed('tsqd-style-query-row')} ${selectedMutationId() === props.mutation.mutationId ? themed('tsqd-style-selected-query-row') : ''} tsqd-query-row`} |
| 1462 | aria-label={`Mutation submitted at ${new Date( |
| 1463 | props.mutation.state.submittedAt, |
| 1464 | ).toLocaleString()}`} |
| 1465 | > |
| 1466 | <div |
| 1467 | class={`${themed(`tsqd-style-observer-count-${color()}`)} tsqd-query-observer-count`} |
| 1468 | > |
| 1469 | <Show when={color() === 'purple'}> |
| 1470 | <PauseCircle /> |
| 1471 | </Show> |
| 1472 | <Show when={color() === 'green'}> |
| 1473 | <CheckCircle /> |
| 1474 | </Show> |
| 1475 | <Show when={color() === 'red'}> |
| 1476 | <XCircle /> |
| 1477 | </Show> |
| 1478 | <Show when={color() === 'yellow'}> |
| 1479 | <LoadingCircle /> |
| 1480 | </Show> |
| 1481 | </div> |
| 1482 | <code class="tsqd-query-hash"> |
| 1483 | <Show when={props.mutation.options.mutationKey}> |
nothing calls this directly
no test coverage detected