({
nodeEntry,
isSelected,
toggleSelected,
expandable,
}: {
nodeEntry: NodeEntryRow;
isSelected: boolean;
toggleSelected: () => void;
expandable: boolean;
})
| 46 | }; |
| 47 | |
| 48 | export const TableRow = ({ |
| 49 | nodeEntry, |
| 50 | isSelected, |
| 51 | toggleSelected, |
| 52 | expandable, |
| 53 | }: { |
| 54 | nodeEntry: NodeEntryRow; |
| 55 | isSelected: boolean; |
| 56 | toggleSelected: () => void; |
| 57 | expandable: boolean; |
| 58 | }) => { |
| 59 | const createdAt = dayjs(nodeEntry.creationTime).format("MMMM D h:mm A"); |
| 60 | const fullTime = dayjs(nodeEntry.creationTime).toString(); |
| 61 | |
| 62 | const isClientInitialized = useIsClientInitialized(); |
| 63 | if (!isClientInitialized) return null; |
| 64 | |
| 65 | return ( |
| 66 | <> |
| 67 | <Tr |
| 68 | onClick={toggleSelected} |
| 69 | key={nodeEntry.id} |
| 70 | _hover={{ td: { bgColor: isSelected ? "gray.200" : "gray.50", cursor: "pointer" } }} |
| 71 | bgColor={isSelected ? "gray.100" : undefined} |
| 72 | transition={!expandable ? "background-color 1.2s" : undefined} |
| 73 | sx={ |
| 74 | expandable |
| 75 | ? { |
| 76 | "> td": { borderBottom: "none" }, |
| 77 | } |
| 78 | : undefined |
| 79 | } |
| 80 | fontSize="sm" |
| 81 | > |
| 82 | <Td> |
| 83 | <Tooltip label={fullTime} placement="top-start"> |
| 84 | <Box whiteSpace="nowrap" minW="120px"> |
| 85 | {createdAt} |
| 86 | </Box> |
| 87 | </Tooltip> |
| 88 | </Td> |
| 89 | <Td isNumeric> |
| 90 | {nodeEntry.inputTokens?.toLocaleString() ?? <Text color="gray.500">counting</Text>} |
| 91 | </Td> |
| 92 | <Td isNumeric> |
| 93 | {nodeEntry.outputTokens?.toLocaleString() ?? <Text color="gray.500">counting</Text>} |
| 94 | </Td> |
| 95 | <Td isNumeric> |
| 96 | <EntrySplit split={nodeEntry.split} /> |
| 97 | </Td> |
| 98 | </Tr> |
| 99 | {expandable && <ExpandableRow nodeEntry={nodeEntry} expanded={isSelected} />} |
| 100 | </> |
| 101 | ); |
| 102 | }; |
| 103 | |
| 104 | const ExpandableRow = ({ nodeEntry, expanded }: { nodeEntry: NodeEntryRow; expanded: boolean }) => { |
| 105 | const isRelabeled = nodeEntry.originalOutputHash !== nodeEntry.outputHash; |
nothing calls this directly
no test coverage detected