From 8769cd0dd09c5c03ccec1fe482c489c9c6fa61f5 Mon Sep 17 00:00:00 2001 From: Noah Litvin <335975+noahlitvin@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:25:05 -0500 Subject: [PATCH] ready --- .../website/src/components/CommandPreview.tsx | 6 +- .../src/features/Docs/DocsCannonfilesPage.tsx | 19 ++--- .../website/src/features/Docs/DocsCliPage.tsx | 14 ++-- .../IntegrateWithPackage.tsx | 80 +++++++++---------- .../Packages/PackageAccordionHelper/index.tsx | 26 +++--- 5 files changed, 64 insertions(+), 81 deletions(-) diff --git a/packages/website/src/components/CommandPreview.tsx b/packages/website/src/components/CommandPreview.tsx index e74aa4f61..10b6d15f2 100644 --- a/packages/website/src/components/CommandPreview.tsx +++ b/packages/website/src/components/CommandPreview.tsx @@ -11,7 +11,7 @@ interface CodeBlockProps extends React.HTMLAttributes { expandButtonTitle?: string; } -export const CommandPreview2 = React.forwardRef( +export const CommandPreview = React.forwardRef( ({ command = '', className, ...props }, ref) => { const [hasCopied, setHasCopied] = React.useState(false); const [html, setHtml] = React.useState(''); @@ -50,7 +50,7 @@ export const CommandPreview2 = React.forwardRef(
( } ); -CommandPreview2.displayName = 'CommandPreview2'; +CommandPreview.displayName = 'CommandPreview'; diff --git a/packages/website/src/features/Docs/DocsCannonfilesPage.tsx b/packages/website/src/features/Docs/DocsCannonfilesPage.tsx index 93ceac1a3..f838ce20c 100644 --- a/packages/website/src/features/Docs/DocsCannonfilesPage.tsx +++ b/packages/website/src/features/Docs/DocsCannonfilesPage.tsx @@ -304,18 +304,15 @@ const DocsCannonfilesPage: FC = () => { href="https://lodash.com/docs/4.17.15#template" target="_blank" rel="noopener noreferrer" - className="text-blue-400 hover:text-blue-300" > templates - - like - name=<%= settings.name %>). The templates - can also use{' '} + {' '} + like name=<%= settings.name %>). The + templates can also use{' '} utilities @@ -350,14 +347,8 @@ const DocsCannonfilesPage: FC = () => {

Packages that result from builds consist of three JSON files, which are compressed and uploaded using - IPFS:{' '} - - deployment data - - , code, and{' '} + IPFS: deployment data,{' '} + code, and{' '} metadata.

diff --git a/packages/website/src/features/Docs/DocsCliPage.tsx b/packages/website/src/features/Docs/DocsCliPage.tsx index a79fabeb4..a34b09540 100644 --- a/packages/website/src/features/Docs/DocsCliPage.tsx +++ b/packages/website/src/features/Docs/DocsCliPage.tsx @@ -1,6 +1,6 @@ 'use client'; -import { CommandPreview2 } from '@/components/CommandPreview'; +import { CommandPreview } from '@/components/CommandPreview'; import { CustomSpinner } from '@/components/CustomSpinner'; import { useCommandsConfig } from '@/hooks/useCommandsConfig'; import { @@ -100,7 +100,7 @@ const DocumentationSection: React.FC<{

{description}

- cannon {command} + cannon {command}
{argumentsData && } {optionsData && } @@ -355,17 +355,17 @@ const DocsCliPage: FC = () => { - npm i -g @usecannon/cli + npm i -g @usecannon/cli - + yarn global add @usecannon/cli - + - + pnpm add -g @usecannon/cli - + diff --git a/packages/website/src/features/Packages/PackageAccordionHelper/IntegrateWithPackage.tsx b/packages/website/src/features/Packages/PackageAccordionHelper/IntegrateWithPackage.tsx index 96ea48586..d7e9c8798 100644 --- a/packages/website/src/features/Packages/PackageAccordionHelper/IntegrateWithPackage.tsx +++ b/packages/website/src/features/Packages/PackageAccordionHelper/IntegrateWithPackage.tsx @@ -1,14 +1,9 @@ import CodePreview from '@/components/CodePreview'; -import { InfoCircledIcon } from '@radix-ui/react-icons'; import camelCase from 'lodash/camelCase'; import { ChainDefinition, getArtifacts } from '@usecannon/builder'; import { DeploymentState } from '@usecannon/builder'; -import { - Tooltip, - TooltipContent, - TooltipTrigger, - TooltipProvider, -} from '@/components/ui/tooltip'; +import Link from 'next/link'; +import { badgeVariants } from '@/components/ui/badge'; function generateSettingsText(settings?: Record) { let text = ''; @@ -53,26 +48,38 @@ target = "PACKAGE_NAME@${camelCase( ${generateSettingsText(contextDataCode.settings)} `.trim(); - const interactCode = chainId == 13370 ? cloneCode : pullCode; + const displayCode = chainId == 13370 ? cloneCode : pullCode; return ( - +
-
-

Add to Cannonfile

- - - - - - Options listed below show their default values. You can override - them or omit them from your cannonfiles. - - -
+

+ Add the following to your Cannonfile to{' '} + {chainId == 13370 ? ( + <> + deploy your own instance of this package.{' '} + + Learn more + + + ) : ( + <> + import data from this package.{' '} + + Learn more + + + )} +

- -
-

- Cannonfile Context Data -

- - - - - - {`After adding the ${ - chainId == 13370 ? 'clone' : 'pull' - } operation to your cannonfile, you can reference the following data in other operations using EJS syntax.`} - - -
- +

+ The options listed above show the default values. You can override or + omit them. +

+
+
+

+ Then reference the following data in other Cannonfile operations using + EJS syntax, like {'<%= settings.example %>'} +

- +
); } diff --git a/packages/website/src/features/Packages/PackageAccordionHelper/index.tsx b/packages/website/src/features/Packages/PackageAccordionHelper/index.tsx index def019611..0056444b9 100644 --- a/packages/website/src/features/Packages/PackageAccordionHelper/index.tsx +++ b/packages/website/src/features/Packages/PackageAccordionHelper/index.tsx @@ -14,8 +14,9 @@ import { usePackageByRef } from '@/hooks/api/usePackage'; import { IpfsSpinner } from '@/components/IpfsSpinner'; import { useState, useEffect } from 'react'; import { getChainDefinitionFromWorker } from '@/helpers/chain-definition'; -import { CommandPreview2 } from '@/components/CommandPreview'; -import { CodeIcon, DownloadIcon } from '@radix-ui/react-icons'; +import { CommandPreview } from '@/components/CommandPreview'; +import { DownloadIcon } from '@radix-ui/react-icons'; +import { Braces } from 'lucide-react'; import Link from 'next/link'; type Props = { @@ -117,11 +118,7 @@ export default function PackageAccordionHelper({ - +
@@ -145,11 +142,9 @@ export default function PackageAccordionHelper({ - - cannon inspect {packageRef}{' '} - {chainId != 13370 ? `--chain-id ${chainId}` : ''}{' '} - --write-deployments ./deployment - +
@@ -157,7 +152,7 @@ export default function PackageAccordionHelper({ onClick={() => handleDownload(addressesAbis)} className="inline-flex items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground" > - + Download JSON
@@ -176,9 +171,7 @@ export default function PackageAccordionHelper({ - - cannon interact {packageRef} --chain-id {chainId} - + )} @@ -193,7 +186,6 @@ export default function PackageAccordionHelper({ - t.c. improve description here {state && deploymentInfo && chainDefinition ? (