({ project }: { project: AdminProjectType })
| 70 | } |
| 71 | |
| 72 | const TableRow = ({ project }: { project: AdminProjectType }) => { |
| 73 | const [expandedRow, setExpandedRow] = useState<string | null>(null); |
| 74 | |
| 75 | return ( |
| 76 | <> |
| 77 | <Tr |
| 78 | onClick={() => setExpandedRow(project.id === expandedRow ? null : project.id)} |
| 79 | _hover={{ td: { bgColor: "gray.50", cursor: "pointer" } }} |
| 80 | transition="background-color 1.2s" |
| 81 | fontSize="sm" |
| 82 | > |
| 83 | <Td> |
| 84 | <Text as="b"> |
| 85 | <Link |
| 86 | href={{ |
| 87 | pathname: `/p/[projectSlug]/request-logs`, |
| 88 | query: { projectSlug: project.slug }, |
| 89 | }} |
| 90 | > |
| 91 | <Button variant="ghost">{project.name}</Button> |
| 92 | </Link> |
| 93 | </Text> |
| 94 | </Td> |
| 95 | <Td isNumeric> |
| 96 | <Box whiteSpace="nowrap" minW="120px"> |
| 97 | {dayjs(project.createdAt).format("MMMM D h:mm A")} |
| 98 | </Box> |
| 99 | </Td> |
| 100 | <Td>{project.slug}</Td> |
| 101 | <Td> |
| 102 | {project.projectUsers.map((user) => ( |
| 103 | <Text key={user.email}> |
| 104 | {user.name} ({user.email}) |
| 105 | </Text> |
| 106 | ))} |
| 107 | </Td> |
| 108 | <Td isNumeric>{project.fineTunesCount}</Td> |
| 109 | <Td isNumeric> |
| 110 | {project.lastUsageLog[0]?.usageLogCreatedAt |
| 111 | ? dayjs(project.lastUsageLog[0]?.usageLogCreatedAt).format("DD MMM YYYY") |
| 112 | : "-"} |
| 113 | </Td> |
| 114 | </Tr> |
| 115 | <ExtendableArea expandedRow={expandedRow} project={project} /> |
| 116 | </> |
| 117 | ); |
| 118 | }; |
| 119 | |
| 120 | interface ExtendableAreaProps { |
| 121 | expandedRow: string | null; |
nothing calls this directly
no outgoing calls
no test coverage detected