From 9023d94d8d76de3587eeb819047f49aea62a4279 Mon Sep 17 00:00:00 2001 From: Aamir Azad Date: Sun, 30 Jun 2024 20:56:13 +0530 Subject: [PATCH] fix: standardize link formatting --- src/app/page.tsx | 8 +++--- src/app/paperless/page.tsx | 11 ++++---- src/app/sign-in/page.tsx | 10 +++---- src/components/document-viewer.tsx | 5 +++- ...link-in-new-page.tsx => external-link.tsx} | 8 ++++-- src/components/internal-link.tsx | 26 +++++++++++++++++++ 6 files changed, 50 insertions(+), 18 deletions(-) rename src/components/{open-link-in-new-page.tsx => external-link.tsx} (69%) create mode 100644 src/components/internal-link.tsx diff --git a/src/app/page.tsx b/src/app/page.tsx index 5039f3a..d524e8c 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,4 +1,4 @@ -import OpenLinkInNewPage from "@/components/open-link-in-new-page"; +import OpenExternalLInk from "@/components/external-link"; export default function HomePage() { return ( @@ -6,10 +6,10 @@ export default function HomePage() {
Welcome to Homelab Connector
- Check out the - + Check out the{" "} + README - + {" "} to get started.
Or sign in to access the dashboard.
diff --git a/src/app/paperless/page.tsx b/src/app/paperless/page.tsx index d81d96e..fa68ac5 100644 --- a/src/app/paperless/page.tsx +++ b/src/app/paperless/page.tsx @@ -24,6 +24,7 @@ import { import LoadingSpinner from "@/components/loading-spinner"; import { getPaperlessDocuments, getUserData } from "@/app/actions"; import Link from "next/link"; +import OpenInternalLink from "@/components/internal-link"; const queryClient = new QueryClient(); @@ -115,15 +116,15 @@ function DocumentsPage() { } else if (!userData.data?.paperlessURL) { return (

- You need to set your paperless url in{" "} - settings + You need to set your paperless url in + settings

); } else if (!PaperlessDocuments.data || PaperlessDocuments.error) { return (

Connection failed! Check that the paperless url/token is set correctly - in settings + in settings

); } @@ -158,8 +159,8 @@ export default function PaperlessPage() {
-
- Please sign in +
+ Please sign in
diff --git a/src/app/sign-in/page.tsx b/src/app/sign-in/page.tsx index 97752f3..8acb668 100644 --- a/src/app/sign-in/page.tsx +++ b/src/app/sign-in/page.tsx @@ -1,5 +1,6 @@ "use client"; +import OpenInternalLink from "@/components/internal-link"; import LoadingSpinner from "@/components/loading-spinner"; import { RedirectToSignIn, SignedIn, SignedOut } from "@clerk/nextjs"; import Link from "next/link"; @@ -18,13 +19,10 @@ export default function SignIn() { You are already signed in
- Go - + Go{" "} + Home - +
diff --git a/src/components/document-viewer.tsx b/src/components/document-viewer.tsx index a8200bf..49a9356 100644 --- a/src/components/document-viewer.tsx +++ b/src/components/document-viewer.tsx @@ -5,6 +5,7 @@ import { Button } from "./ui/button"; import { useRouter } from "next/navigation"; import { getUserData } from "@/app/actions"; import type { AdviceAPIType } from "@/types"; +import OpenInternalLink from "./internal-link"; export async function getPaperlessDocument( documentId: number, @@ -149,7 +150,9 @@ export default function DocumentViewer(props: { id: number }) { >

Your web browser doesn't have a PDF plugin. Instead you can - click here to download the PDF file. + + click here to download the PDF file. +

diff --git a/src/components/open-link-in-new-page.tsx b/src/components/external-link.tsx similarity index 69% rename from src/components/open-link-in-new-page.tsx rename to src/components/external-link.tsx index b5d7b4d..0a9664c 100644 --- a/src/components/open-link-in-new-page.tsx +++ b/src/components/external-link.tsx @@ -1,20 +1,24 @@ import { ExternalLink } from "lucide-react"; import React from "react"; +import { cn } from "@/lib/utils"; + interface OpenLinkInNewPageProps { children: React.ReactNode; href: string; + className?: string; } -export default function OpenLinkInNewPage({ +export default function OpenExternalLInk({ children, href, + className, }: OpenLinkInNewPageProps) { return ( {children} diff --git a/src/components/internal-link.tsx b/src/components/internal-link.tsx new file mode 100644 index 0000000..19cc0e9 --- /dev/null +++ b/src/components/internal-link.tsx @@ -0,0 +1,26 @@ +import React from "react"; + +import { cn } from "@/lib/utils"; + +interface OpenLinkInNewPageProps { + children: React.ReactNode; + href: string; + className?: string; +} + +export default function OpenInternalLink({ + children, + href, + className, +}: OpenLinkInNewPageProps) { + return ( + + {children} + + ); +}