fmt: use biome
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { Component, createSignal, For, Show } from 'solid-js';
|
||||
import type { RequestLog } from '../types';
|
||||
import { Button } from './ui/Button';
|
||||
import { CardContent, CardFooter, CardHeader } from './ui/Card';
|
||||
import { Modal, ModalContent } from './ui/Modal';
|
||||
import { Component, createSignal, For, Show } from "solid-js";
|
||||
import type { RequestLog } from "../types";
|
||||
import { Button } from "./ui/Button";
|
||||
import { CardContent, CardFooter, CardHeader } from "./ui/Card";
|
||||
import { Modal, ModalContent } from "./ui/Modal";
|
||||
|
||||
interface TreeViewProps {
|
||||
data: any;
|
||||
@@ -12,17 +12,17 @@ interface TreeViewProps {
|
||||
|
||||
const TreeView: Component<TreeViewProps> = (props) => {
|
||||
const [isOpen, setIsOpen] = createSignal(props.isRoot ?? false);
|
||||
const isObject = typeof props.data === 'object' && props.data !== null;
|
||||
const isObject = typeof props.data === "object" && props.data !== null;
|
||||
|
||||
const renderValue = (value: any) => {
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
case "string":
|
||||
return <span class="text-green-600">"{value}"</span>;
|
||||
case 'number':
|
||||
case "number":
|
||||
return <span class="text-blue-600">{value}</span>;
|
||||
case 'boolean':
|
||||
case "boolean":
|
||||
return <span class="text-purple-600">{String(value)}</span>;
|
||||
case 'object':
|
||||
case "object":
|
||||
if (value === null) return <span class="text-gray-500">null</span>;
|
||||
// This case is handled by recursive TreeView
|
||||
default:
|
||||
@@ -36,9 +36,7 @@ const TreeView: Component<TreeViewProps> = (props) => {
|
||||
class="flex items-center cursor-pointer hover:bg-gray-100 rounded px-1"
|
||||
onClick={() => setIsOpen(!isOpen())}
|
||||
>
|
||||
<span class="w-4 inline-block text-gray-500">
|
||||
{isObject ? (isOpen() ? '▼' : '►') : ''}
|
||||
</span>
|
||||
<span class="w-4 inline-block text-gray-500">{isObject ? (isOpen() ? "▼" : "►") : ""}</span>
|
||||
<span class="font-semibold text-gray-800">{props.name}:</span>
|
||||
<Show when={!isObject}>
|
||||
<span class="ml-2">{renderValue(props.data)}</span>
|
||||
@@ -55,7 +53,6 @@ const TreeView: Component<TreeViewProps> = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
interface RequestDetailsProps {
|
||||
log: RequestLog;
|
||||
onClose: () => void;
|
||||
@@ -67,7 +64,9 @@ const RequestDetails: Component<RequestDetailsProps> = (props) => {
|
||||
<ModalContent class="max-w-3xl h-auto max-h-[90vh]">
|
||||
<CardHeader>
|
||||
<h3 class="text-lg font-medium text-gray-900">Request Details</h3>
|
||||
<p class="text-sm text-gray-500">{props.log.method} at {new Date(props.log.created_at).toLocaleString()}</p>
|
||||
<p class="text-sm text-gray-500">
|
||||
{props.log.method} at {new Date(props.log.created_at).toLocaleString()}
|
||||
</p>
|
||||
</CardHeader>
|
||||
|
||||
<CardContent class="max-h-[70vh] overflow-y-auto">
|
||||
@@ -88,11 +87,7 @@ const RequestDetails: Component<RequestDetailsProps> = (props) => {
|
||||
</CardContent>
|
||||
|
||||
<CardFooter class="flex justify-end pt-4">
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
onClick={props.onClose}
|
||||
>
|
||||
<Button type="button" variant="secondary" onClick={props.onClose}>
|
||||
Close
|
||||
</Button>
|
||||
</CardFooter>
|
||||
|
||||
Reference in New Issue
Block a user