diff --git a/src/apps/console/components/commons.tsx b/src/apps/console/components/commons.tsx
index f243b659a..75ecf66bf 100644
--- a/src/apps/console/components/commons.tsx
+++ b/src/apps/console/components/commons.tsx
@@ -1,4 +1,4 @@
-import { CopySimple, Question } from '@jengaicons/react';
+import { CopySimple, Question, Check } from '@jengaicons/react';
import { ReactNode, useState } from 'react';
import { ProdLogo } from '~/components/branding/prod-logo';
import { WorkspacesLogo } from '~/components/branding/workspace-logo';
@@ -82,11 +82,12 @@ export const CopyButton = ({
title: ReactNode;
value: string;
}) => {
- const [_, setCopyIcon] = useState();
+ // const [_, setCopyIcon] = useState();
+ const [copied, setCopied] = useState(false);
const { copy } = useClipboard({
onSuccess: () => {
setTimeout(() => {
- setCopyIcon();
+ setCopied(false);
}, 1000);
},
});
@@ -94,13 +95,14 @@ export const CopyButton = ({
return (
{
+ setCopied(true);
copy(value);
}}
className="flex flex-row gap-md items-center select-none group cursor-pointer"
>
{title}
-
+ {copied ? : }
);
diff --git a/src/apps/console/routes/_main+/$account+/packages+/repos/repo-resources.tsx b/src/apps/console/routes/_main+/$account+/packages+/repos/repo-resources.tsx
index 9f6dd1c9c..235cdad01 100644
--- a/src/apps/console/routes/_main+/$account+/packages+/repos/repo-resources.tsx
+++ b/src/apps/console/routes/_main+/$account+/packages+/repos/repo-resources.tsx
@@ -1,4 +1,4 @@
-import { Copy, Trash } from '@jengaicons/react';
+import { Copy, Trash, Check } from '@jengaicons/react';
import { Link, useParams } from '@remix-run/react';
import { useState } from 'react';
import { toast } from '~/components/molecule/toast';
@@ -58,12 +58,20 @@ const ExtraButton = ({ onDelete }: { onDelete: () => void }) => {
const RepoUrlView = ({ name }: { name: string }) => {
const { account } = useParams();
- const { copy } = useClipboard({
- onSuccess() {
- toast.success('Registry url copied successfully.');
- },
- });
+ const { copy } = useClipboard({});
const url = `${registryHost}/${account}/${name}`;
+ const [copied, setCopied] = useState(false);
+
+ const handleCopy = () => {
+ copy(url);
+ setCopied(true);
+ toast.success('Registry url copied successfully.');
+
+ setTimeout(() => {
+ setCopied(false);
+ }, 3000);
+ };
+
return (
{
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
- copy(url);
+ if (!copied) {
+ handleCopy();
+ }
}}
title={url}
>
{url}
-
-
-
+ {copied ? (
+
+
+
+ ) : (
+
+
+
+ )}
}
/>