diff --git a/package.json b/package.json index af35b0c1..608b63c1 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "eslint-config-next": "14.2.3", "postcss": "^8.4.38", "tailwindcss": "^3.4.1", - "typescript": "^5" + "typescript": "^5", + "@playwright/test": "^1.49.1" } } diff --git a/src/components/CopyLinkButton.tsx b/src/components/CopyLinkButton.tsx new file mode 100644 index 00000000..7941b36b --- /dev/null +++ b/src/components/CopyLinkButton.tsx @@ -0,0 +1,25 @@ +"use client"; + +import { useState } from "react"; +import { useSession } from "next-auth/react" + +export default function CopyLinkButton() { + const { data: session } = useSession(); + const [ isCopied, setCopied ] = useState(false); + + const dataCopy = async () => { + await navigator.clipboard.writeText(`${window.location.origin}/u/${session?.githubLogin}`); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + }; + + return ( + + ); +} \ No newline at end of file diff --git a/src/components/DashboardHeader.tsx b/src/components/DashboardHeader.tsx index effb33e5..556e1a80 100644 --- a/src/components/DashboardHeader.tsx +++ b/src/components/DashboardHeader.tsx @@ -7,6 +7,7 @@ import SignOutButton from "@/components/SignOutButton"; import ThemeToggle from "@/components/ThemeToggle"; import UserAvatar from "@/components/UserAvatar"; import KeyboardShortcuts from "@/components/KeyboardShortcuts"; +import CopyLinkButton from "./CopyLinkButton"; export default function DashboardHeader() { const { data: session } = useSession(); @@ -62,6 +63,7 @@ export default function DashboardHeader() { )} + diff --git a/tsconfig.json b/tsconfig.json index d0fd9315..9b708bb6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,7 @@ "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "react-jsx", + "jsx": "preserve", "incremental": true, "plugins": [ {