Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Copy Button to /add-dock Command #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/pages/add-dock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ const AddDock = () => {
const { data: sessionData } = useSession();
const user = api.users.getOne.useQuery({ id: sessionData?.user?.id ?? "" });

const copyCommandToClipboard = () => {
navigator.clipboard.writeText('npx dockhunt').then(() => {
alert('Command copied to clipboard!');
}, (err) => {
console.error('Could not copy command: ', err);
});
};

return (
<>
<Head>
Expand Down Expand Up @@ -62,9 +70,17 @@ const AddDock = () => {
To add your own dock, run the following command in your{" "}
<Link href="/apps/Terminal">terminal</Link>:
</p>
<code className="mb-8 w-full rounded border bg-black p-4">
npx dockhunt
</code>
<div className="flex items-center mb-8">
<code className="rounded border bg-black p-4 mr-4">
npx dockhunt
</code>
<button
className="rounded-full bg-blue-700 px-4 py-2 hover:bg-blue-600 text-white"
onClick={copyCommandToClipboard}
>
Copy
</button>
</div>
<p className="mb-2 text-xl">The command will:</p>
<ol className="mb-8 list-decimal pl-8 text-xl">
<li>Find the apps in your dock</li>
Expand Down