diff --git a/app/components/code-block.tsx b/app/components/code-block.tsx new file mode 100644 index 0000000..80c4541 --- /dev/null +++ b/app/components/code-block.tsx @@ -0,0 +1,34 @@ +import { Copy } from "lucide-react"; + +import cn from "~/utils/cn"; +import toast from "~/utils/toast"; + +export interface CodeBlockProps { + children: string; + className?: string; +} + +export default function CodeBlock({ children, className }: CodeBlockProps) { + const text = children.trim(); + + return ( + + ); +} diff --git a/app/components/code.tsx b/app/components/code.tsx index 623b8a6..9fc8751 100644 --- a/app/components/code.tsx +++ b/app/components/code.tsx @@ -1,51 +1,19 @@ -import { Check, Copy } from "lucide-react"; -import { HTMLProps } from "react"; - import cn from "~/utils/cn"; -import toast from "~/utils/toast"; -export interface CodeProps extends HTMLProps { - isCopyable?: boolean; +export interface CodeProps { children: string | string[] | number; + className?: string; } -export default function Code({ isCopyable, children, className }: CodeProps) { +export default function Code({ children, className }: CodeProps) { return ( {children} - {isCopyable && ( - - )} ); } diff --git a/app/routes/home.tsx b/app/routes/home.tsx index 0cdb589..2d2a0ad 100644 --- a/app/routes/home.tsx +++ b/app/routes/home.tsx @@ -1,4 +1,4 @@ -import { Check, Copy } from "lucide-react"; +import { Check } from "lucide-react"; import { redirect } from "react-router"; import androidSvg from "~/assets/android.svg"; @@ -6,14 +6,13 @@ import iosSvg from "~/assets/ios.svg"; import linuxSvg from "~/assets/linux.svg"; import macosSvg from "~/assets/macos.svg"; import windowsSvg from "~/assets/windows.svg"; -import Button from "~/components/button"; import Card from "~/components/card"; +import CodeBlock from "~/components/code-block"; import Link from "~/components/link"; import LinkAccount from "~/layout/link-account"; import { usersResource } from "~/server/headscale/live-store"; import { Capabilities } from "~/server/web/roles"; import cn from "~/utils/cn"; -import toast from "~/utils/toast"; import { getUserDisplayName } from "~/utils/user"; import type { Route } from "./+types/home"; @@ -152,28 +151,7 @@ export default function Home({ loaderData }: Route.ComponentProps) { Linux Linux -
- - curl -fsSL https://tailscale.com/install.sh | sh - - -
+ curl -fsSL https://tailscale.com/install.sh | sh

Register Machine Key - - The machine key is given when you run{" "} - tailscale up --login-server={data.server} on your device. - + The machine key is given when you run the following command on your device: + {`tailscale up --login-server=${data.server}`} Pre-auth key created Copy this key now. You will not be able to see the full key again. -

- {createdKey} - -
+ {createdKey} To register a device with this key: - + {`tailscale up --login-server=${url} --authkey ${createdKey}`} - + ) : (