diff --git a/components/CodeBlock/CodeBlock.tsx b/components/CodeBlock/CodeBlock.tsx new file mode 100644 index 0000000..f28f2e7 --- /dev/null +++ b/components/CodeBlock/CodeBlock.tsx @@ -0,0 +1,44 @@ +import React, { useState } from 'react' +import { IoIosInformationCircle } from 'react-icons/io' + +const CopyableCodeBlock = ({ code }) => { + const [isCopied, setIsCopied] = useState(false) + + const handleCopy = async () => { + try { + await navigator.clipboard.writeText(code) + setIsCopied(true) + setTimeout(() => setIsCopied(false), 2000) // Reset copied state after 2 seconds + } catch (err) { + console.error('Failed to copy!', err) + } + } + + return ( +
+
+ + + +
{code}
+ +
+
+ ) +} + +export default CopyableCodeBlock diff --git a/components/nodes/NodeDetails.tsx b/components/nodes/NodeDetails.tsx index 9912de0..e3681a5 100644 --- a/components/nodes/NodeDetails.tsx +++ b/components/nodes/NodeDetails.tsx @@ -7,6 +7,7 @@ import NodeVDrawer from './NodeVDrawer' import Link from 'next/link' import { NodeEditModal } from './NodeEditModal' import { NodeVersion, useGetNode, useListNodeVersions } from 'src/api/generated' +import CopyableCodeBlock from '../CodeBlock/CodeBlock' export function formatRelativeDate(dateString: string) { const date = new Date(dateString) @@ -118,8 +119,8 @@ const NodeDetails = () => { )} -
- {data.license && ( +
+ {/* {data.license && (

{ {data.rating} rating

- )} + )} */} {data.downloads && (

{

)}
+
+ +

Description @@ -264,6 +270,13 @@ const NodeDetails = () => { Edit details )} + {data.latest_version?.downloadUrl && ( + + )}

{ - const router = useRouter() - - const repeatedNodes = Array(3).fill(NodesData[0]) - return ( -
-
- - router.push('/')} - > - Back to Registry - -
- -
-
-

- Nodes Makers -

-
-

@nodesmakers

-
-

- - 8 nodes -

-

- - - Robin Huang, Yoland Yan - -

-

- - - Created 5/20/24 - -

-
- -
-

- Your nodes -

-
-
- {repeatedNodes.map((member, index) => ( - - ))} -
-
-
- ) -} - -export default NodesPublisherDetail diff --git a/pages/nodes/publisher-detail/[id].tsx b/pages/nodes/publisher-detail/[id].tsx deleted file mode 100644 index 6d5a7bc..0000000 --- a/pages/nodes/publisher-detail/[id].tsx +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react' -import NodesPublisherDetail from '@/components/nodes/NodesPublisherDetail' - -const NodeView = () => { - return ( - <> - - - ) -} - -export default NodeView