From 00638833b741367abd4796c9f553cb106c9a2c26 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Mon, 20 May 2024 14:05:46 -0700 Subject: [PATCH 1/3] Remove unused page. --- components/nodes/NodeDetails.tsx | 7 +++++++ pages/nodes/publisher-detail/[id].tsx | 12 ------------ 2 files changed, 7 insertions(+), 12 deletions(-) delete mode 100644 pages/nodes/publisher-detail/[id].tsx diff --git a/components/nodes/NodeDetails.tsx b/components/nodes/NodeDetails.tsx index 9912de0..b5adbe5 100644 --- a/components/nodes/NodeDetails.tsx +++ b/components/nodes/NodeDetails.tsx @@ -264,6 +264,13 @@ const NodeDetails = () => { Edit details )} + {data.latest_version?.downloadUrl && ( + + )} { - return ( - <> - - - ) -} - -export default NodeView From cada01d5df29d1aa70b5083e2ff1d2288fd51218 Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Mon, 20 May 2024 14:05:56 -0700 Subject: [PATCH 2/3] Remove unused page. --- components/nodes/NodesPublisherDetail.tsx | 138 ---------------------- 1 file changed, 138 deletions(-) delete mode 100644 components/nodes/NodesPublisherDetail.tsx diff --git a/components/nodes/NodesPublisherDetail.tsx b/components/nodes/NodesPublisherDetail.tsx deleted file mode 100644 index 8701bbf..0000000 --- a/components/nodes/NodesPublisherDetail.tsx +++ /dev/null @@ -1,138 +0,0 @@ -import { Button } from 'flowbite-react' -import NodesCard from './NodesCard' -import { useRouter } from 'next/router' -import React from 'react' - -export const NodesData = [ - { - id: '1', - name: 'TalkingFace', - version: 'v4.0', - description: - 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque dictum, odio lobortis ultricies interdum, urna lorem fermentum libero, vel accumsan magna purus a lacus. ', - node: 'Node Publishing, Inc.', - image: '/images/nodesLogo.svg', - rating: '4.8 ', - downloads: '977k ', - }, -] -const NodesPublisherDetail: React.FC = () => { - 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 From 7eb3451b7b87c2113c16085d9734b9732ed2600a Mon Sep 17 00:00:00 2001 From: Robin Huang Date: Mon, 20 May 2024 14:39:53 -0700 Subject: [PATCH 3/3] Add copyable code block. --- components/CodeBlock/CodeBlock.tsx | 44 ++++++++++++++++++++++++++++++ components/nodes/NodeDetails.tsx | 12 ++++++-- 2 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 components/CodeBlock/CodeBlock.tsx 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 b5adbe5..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