From ec3211e8105849dd2e41193a5c61e77a0eb2c4fc Mon Sep 17 00:00:00 2001 From: Strek Date: Mon, 28 Oct 2024 17:57:34 +0530 Subject: [PATCH] chore: move accordion to one level --- src/components/scope/scope-item.tsx | 63 ++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/src/components/scope/scope-item.tsx b/src/components/scope/scope-item.tsx index 83f519a..5a97c9d 100644 --- a/src/components/scope/scope-item.tsx +++ b/src/components/scope/scope-item.tsx @@ -1,11 +1,11 @@ import { Scope, Variable, Reference } from "eslint-scope"; +import { TreeEntry } from "../tree-entry"; +import type { FC } from "react"; import { AccordionContent, AccordionItem, AccordionTrigger, -} from "@/components/ui/accordion"; -import { TreeEntry } from "../tree-entry"; -import type { FC } from "react"; +} from "../ui/accordion"; type ScopeItemProperties = { isArray: boolean; @@ -41,25 +41,48 @@ export const ScopeItem: FC = ({ ([name]) => !name.startsWith("__"), ); + if (path.length === 1) { + return ( + + + {isArray && `${Math.max(index, 0)}.`} {key} + + +
+ {properties.map((item, index) => ( + + ))} +
+
+
+ ); + } + return ( - - +
+ +
+
+
+ {properties.map((item, index) => ( + + ))} +
- - +
+
); };