Skip to content

Commit 5a0fc71

Browse files
committed
chore: remove unused code
1 parent 1baec13 commit 5a0fc71

File tree

1 file changed

+1
-47
lines changed
  • apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/_overview/components/table/components/log-details/components

1 file changed

+1
-47
lines changed

apps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/_overview/components/table/components/log-details/components/log-section.tsx

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,4 @@
11
import { CopyButton } from "@unkey/ui";
2-
import React from "react";
3-
4-
// Helper function to extract text from React elements
5-
const extractTextFromReactElement = (element: React.ReactNode): string => {
6-
if (typeof element === "string" || typeof element === "number") {
7-
return String(element);
8-
}
9-
10-
if (element === null || element === undefined) {
11-
return "";
12-
}
13-
14-
if (React.isValidElement(element)) {
15-
const reactElement = element as React.ReactElement<{
16-
value?: string | Date | number;
17-
children?: React.ReactNode;
18-
href?: string;
19-
title?: string;
20-
}>;
21-
22-
if (reactElement.props.value) {
23-
if (reactElement.props.value instanceof Date) {
24-
return reactElement.props.value.toISOString();
25-
}
26-
return String(reactElement.props.value);
27-
}
28-
29-
if (reactElement.props.children) {
30-
if (typeof reactElement.props.children === "string") {
31-
return reactElement.props.children;
32-
}
33-
if (Array.isArray(reactElement.props.children)) {
34-
return reactElement.props.children
35-
.map((child: React.ReactNode) => extractTextFromReactElement(child))
36-
.join("");
37-
}
38-
return extractTextFromReactElement(reactElement.props.children);
39-
}
40-
41-
if (reactElement.props.href || reactElement.props.title) {
42-
return reactElement.props.title || reactElement.props.href || "";
43-
}
44-
}
45-
46-
return String(element);
47-
};
482

493
export const LogSection = ({
504
details,
@@ -64,7 +18,7 @@ export const LogSection = ({
6418
return key;
6519
}
6620
if (typeof value === "object" && value !== null && "props" in value) {
67-
return `${key}: ${extractTextFromReactElement(value)}`;
21+
return `${key}: ${value}`;
6822
}
6923
return `${key}: ${value}`;
7024
})

0 commit comments

Comments
 (0)