diff --git a/src/pages/services/data/data-row.tsx b/src/pages/services/data/data-row.tsx index d2c020f..989ac72 100644 --- a/src/pages/services/data/data-row.tsx +++ b/src/pages/services/data/data-row.tsx @@ -10,6 +10,7 @@ import { } from "@liftedinit/ui"; import { DeleteKeyDialog } from "./delete-key-dialog"; import { MarkImmutableDialog } from "./mark-immutable-dialog"; +import { ExpandCode } from "shared"; export function DataRow({ item, @@ -29,7 +30,7 @@ export function DataRow({ return ( {item.key} - {Buffer.from(item.value).toString()} + {isEditable ? ( Modifiable diff --git a/src/pages/services/data/data-table.tsx b/src/pages/services/data/data-table.tsx index 705a7a9..7b46ea5 100644 --- a/src/pages/services/data/data-table.tsx +++ b/src/pages/services/data/data-table.tsx @@ -1,4 +1,4 @@ -import { Table, Tbody, Th, Thead, Tr } from "@liftedinit/ui"; +import { Box, Table, Tbody, Th, Thead, Tr } from "@liftedinit/ui"; import { DataRow } from "./data-row"; export function DataTable({ @@ -13,7 +13,8 @@ export function DataTable({ setKeyvalue: ({ key, value }: { key: string; value: string }) => void; }) { return ( - + +
@@ -36,5 +37,6 @@ export function DataTable({ ))}
Key
+ ); } diff --git a/src/shared/expand-code.tsx b/src/shared/expand-code.tsx new file mode 100644 index 0000000..4934e1d --- /dev/null +++ b/src/shared/expand-code.tsx @@ -0,0 +1,40 @@ +import { Text, Button, Box } from "@liftedinit/ui"; +import { useState } from "react"; + +export function ExpandCode({ content }: any) { + const [isExpanded, setIsExpanded] = useState(false); + + const toggleExpanded = () => { + setIsExpanded(!isExpanded); + } + + const ExpandButton = () => ( + + ); + + return ( + + { + isExpanded ? ( + + {content} + + + ) : content.length > 5000 ? ( + <> + + {content.substring(0, 5000)} + + + + ) : ( + + {content} + + ) + } + + ); +} diff --git a/src/shared/index.ts b/src/shared/index.ts index d4e09d7..6d503b9 100644 --- a/src/shared/index.ts +++ b/src/shared/index.ts @@ -1 +1,2 @@ export * from "./helpers"; +export * from "./expand-code"; \ No newline at end of file