' \\
+
+ ' \\
${props.cdnUrl}/supergraph`}
-
+ />
+
For more information please refer to our{' '}
);
}
-
-function CodeBlock(props: { children: string; className?: string }) {
- const copy = useClipboard();
- const toast = useToast();
-
- return (
-
-
-
-
-
-
-
-
- Copy command to clipboard
-
-
-
-
- {props.children}
-
-
-
- );
-}
diff --git a/packages/web/app/src/components/target/laboratory/connect-lab-modal.tsx b/packages/web/app/src/components/target/laboratory/connect-lab-modal.tsx
index 200d17e0f..a4ec94f19 100644
--- a/packages/web/app/src/components/target/laboratory/connect-lab-modal.tsx
+++ b/packages/web/app/src/components/target/laboratory/connect-lab-modal.tsx
@@ -9,8 +9,9 @@ import {
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog';
+import { InputCopy } from '@/components/ui/input-copy';
import { Link } from '@/components/ui/link';
-import { CopyValue, Tag } from '@/components/v2';
+import { Tag } from '@/components/v2';
import { FragmentType, graphql, useFragment } from '@/gql';
import { getDocsUrl } from '@/lib/docs-url';
@@ -70,7 +71,7 @@ export const ConnectLabModalContent = (props: {
) : null}
You can use the following endpoint:
-
+
To authenticate, use the following HTTP headers, with a token that has `target:read`
scope:
diff --git a/packages/web/app/src/components/target/settings/registry-access-token.tsx b/packages/web/app/src/components/target/settings/registry-access-token.tsx
index 1df51344c..d58d0df1d 100644
--- a/packages/web/app/src/components/target/settings/registry-access-token.tsx
+++ b/packages/web/app/src/components/target/settings/registry-access-token.tsx
@@ -15,9 +15,9 @@ import {
} from '@/components/ui/dialog';
import { Form, FormControl, FormField, FormItem, FormMessage } from '@/components/ui/form';
import { Input } from '@/components/ui/input';
+import { InputCopy } from '@/components/ui/input-copy';
import { useToast } from '@/components/ui/use-toast';
import { Accordion } from '@/components/v2/accordion';
-import { CopyValue } from '@/components/v2/copy-value';
import { FragmentType, graphql, useFragment } from '@/gql';
import { TargetAccessScope } from '@/gql/graphql';
import { RegistryAccessScope } from '@/lib/access/common';
@@ -228,7 +228,7 @@ export function CreatedTokenContent(props: {
Token successfully created!
-
+
This is your unique API key and it is non-recoverable. If you lose this key, you will
need to create a new one.
diff --git a/packages/web/app/src/components/ui/input-copy.tsx b/packages/web/app/src/components/ui/input-copy.tsx
new file mode 100644
index 000000000..b1defa7b5
--- /dev/null
+++ b/packages/web/app/src/components/ui/input-copy.tsx
@@ -0,0 +1,53 @@
+import { useCallback, useEffect, useState } from 'react';
+import { CheckIcon, CopyIcon } from 'lucide-react';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { useClipboard } from '@/lib/hooks';
+
+export function InputCopy(props: { value: string }) {
+ const [isCopied, setIsCopied] = useState(false);
+ const copyToClipboard = useClipboard();
+
+ useEffect(() => {
+ if (!isCopied) return;
+ const timerId = setTimeout(() => {
+ setIsCopied(false);
+ }, 2000);
+
+ return () => {
+ clearTimeout(timerId);
+ };
+ }, [isCopied]);
+
+ const handleClick = useCallback(async () => {
+ await copyToClipboard(props.value);
+ setIsCopied(true);
+ }, [copyToClipboard]);
+
+ return (
+
+
+
+
+
+
+ );
+}
diff --git a/packages/web/app/src/components/v2/copy-value.tsx b/packages/web/app/src/components/v2/copy-value.tsx
deleted file mode 100644
index c1bb98095..000000000
--- a/packages/web/app/src/components/v2/copy-value.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import { ReactElement, useCallback, useEffect, useState } from 'react';
-import { CheckIcon, CopyIcon } from '@/components/ui/icon';
-import { Input } from '@/components/v2';
-import { useClipboard } from '@/lib/hooks';
-import { Button } from '../ui/button';
-
-export const CopyValue = ({
- value,
- className,
-}: {
- value: string;
- className?: string;
-}): ReactElement => {
- const [isCopied, setIsCopied] = useState(false);
- const copyToClipboard = useClipboard();
-
- useEffect(() => {
- if (!isCopied) return;
- const timerId = setTimeout(() => {
- setIsCopied(false);
- }, 2000);
-
- return () => {
- clearTimeout(timerId);
- };
- }, [isCopied]);
-
- const handleClick = useCallback(async () => {
- await copyToClipboard(value);
- setIsCopied(true);
- }, [value, copyToClipboard]);
-
- return (
-
- {isCopied ? : }
-
- }
- />
- );
-};
diff --git a/packages/web/app/src/components/v2/index.ts b/packages/web/app/src/components/v2/index.ts
index 11b3de0e4..388565f77 100644
--- a/packages/web/app/src/components/v2/index.ts
+++ b/packages/web/app/src/components/v2/index.ts
@@ -3,7 +3,6 @@ export { Autocomplete } from '@/components/v2/autocomplete';
export { Avatar } from '@/components/v2/avatar';
export { Card } from '@/components/v2/card';
export { Checkbox } from '@/components/v2/checkbox';
-export { CopyValue } from '@/components/v2/copy-value';
export { DataWrapper } from '@/components/v2/data-wrapper';
export { DiffEditor } from '@/components/v2/diff-editor';
export { Input } from '@/components/v2/input';