The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | /* oxlint-disable react/no-array-index-key -- Captured table cells have stable positions and may contain identical values. */ |
| 2 | import { useGT } from "gt-react-native"; |
| 3 | import { ScrollView, View } from "react-native"; |
| 4 | import type { parseDelimitedPreview } from "@t3tools/shared/delimitedPreview"; |
| 5 | import { AppText as Text } from "../../components/ui/AppText"; |
| 6 | import { FilePreviewNotice } from "./FilePreviewFeedback"; |
| 7 | |
| 8 | export function DelimitedFilePreview(props: { |
| 9 | readonly table: ReturnType<typeof parseDelimitedPreview>; |
| 10 | }) { |
| 11 | const gt = useGT(); |
| 12 | return ( |
| 13 | <ScrollView className="flex-1"> |
| 14 | {props.table.truncated ? ( |
| 15 | <FilePreviewNotice> |
| 16 | {gt("Table limited to the first 100 rows and 30 columns. Source shows the rest.")} |
| 17 | </FilePreviewNotice> |
| 18 | ) : null} |
| 19 | <ScrollView horizontal> |
| 20 | <View> |
| 21 | {props.table.rows.map((row, rowIndex) => ( |
| 22 | <View key={rowIndex} className={rowIndex === 0 ? "flex-row bg-subtle" : "flex-row"}> |
| 23 | {row.map((cell, columnIndex) => ( |
| 24 | <View key={columnIndex} className="w-48 border-r border-b border-border px-3 py-2"> |
| 25 | <Text |
| 26 | selectable |
| 27 | className={ |
| 28 | rowIndex === 0 |
| 29 | ? "text-sm font-t3-semibold text-foreground" |
| 30 | : "text-sm text-foreground" |
| 31 | } |
| 32 | > |
| 33 | {cell} |
| 34 | </Text> |
| 35 | </View> |
| 36 | ))} |
| 37 | </View> |
| 38 | ))} |
| 39 | </View> |
| 40 | </ScrollView> |
| 41 | </ScrollView> |
| 42 | ); |
| 43 | } |