1- import { Modal , ModalBody , ModalContent , Spinner , useDisclosure } from "@heroui/react" ;
2- import { TriangleDownIcon , TriangleRightIcon , DotsHorizontalIcon , CodeIcon } from "@radix-ui/react-icons" ;
1+ import { Spinner } from "@heroui/react" ;
2+ import { TriangleDownIcon , TriangleRightIcon , DotsHorizontalIcon } from "@radix-ui/react-icons" ;
33import { useState , useRef , useMemo , useEffect } from "react" ;
44
55import { useChunk } from "@/hooks/useChunk" ;
66import { useContextMenu } from "@/hooks/useContextMenu" ;
77import { usePrevious } from "@/hooks/usePrevious" ;
88import { getText } from "@/utils/treeValue" ;
99
10- import { CodePreviewPlain } from "./CodePreview" ;
11-
1210import type { HOOKTree , NodeValue as NodeValueType } from "@my-react-devtool/core" ;
1311import type { ReactNode } from "react" ;
1412
@@ -19,14 +17,6 @@ export const NodeValue = ({ name, item, prefix }: { name: string; item?: NodeVal
1917
2018 const hasOpenRef = useRef ( false ) ;
2119
22- const [ code , setCode ] = useState ( "" ) ;
23-
24- const isWebDev = process . env . NEXT_PUBLIC_MODE === "web" ;
25-
26- const isLocalDev = process . env . NEXT_PUBLIC_MODE === "local" ;
27-
28- const { isOpen, onOpen, onClose, onOpenChange } = useDisclosure ( ) ;
29-
3020 const chunkData = useChunk . useShallowSelector ( ( s ) => s . data ?. [ item ?. i || "" ] ?. loaded ) ;
3121
3222 const cData = item ?. v ?? chunkData ?. v ;
@@ -105,7 +95,7 @@ export const NodeValue = ({ name, item, prefix }: { name: string; item?: NodeVal
10595
10696 const isReadError = item . t === "ReadError" ;
10797
108- const isFunction = item . t === "Function" && ( isWebDev || isLocalDev ) ;
98+ // const isFunction = item.t === "Function" && (isWebDev || isLocalDev);
10999
110100 const element = < span className = { `hook-${ item . t } ${ isReadError ? "text-red-300" : "" } ` } > { textContent } </ span > ;
111101
@@ -114,31 +104,13 @@ export const NodeValue = ({ name, item, prefix }: { name: string; item?: NodeVal
114104 < div className = "flex w-full my-0.5 items-center" >
115105 < span className = "text-transparent" > { StateIcon } </ span >
116106 { prefix }
117- < div className = { `w-full relative line-clamp-1 break-all ${ isFunction ? " pr-8" : "pr-2" } ` } >
107+ < div className = { `w-full relative line-clamp-1 break-all pr-2 ` } >
118108 < span className = "cursor-pointer select-none" onContextMenu = { onContextClick } >
119109 { name }
120110 </ span >
121111 : < span className = "hook-value-placeholder" > { element } </ span >
122- { isFunction && (
123- < span >
124- < CodeIcon
125- className = "absolute right-2 top-0 cursor-pointer"
126- onClick = { ( ) => {
127- setCode ( item . v ) ;
128- onOpen ( ) ;
129- } }
130- />
131- </ span >
132- ) }
133112 </ div >
134113 </ div >
135- < Modal isOpen = { isOpen } size = "2xl" onClose = { onClose } onOpenChange = { onOpenChange } >
136- < ModalContent >
137- < ModalBody className = "p-4" >
138- < CodePreviewPlain code = { code } />
139- </ ModalBody >
140- </ ModalContent >
141- </ Modal >
142114 </ div >
143115 ) ;
144116 } else {
0 commit comments