From c5f2dce36eed6aa32727abad0d3f33702aea309d Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Sat, 21 Dec 2024 23:55:32 +0100 Subject: [PATCH] feat: add close notice on github integration --- .../(public)/auth/github/callback/route.ts | 2 +- src/app/(public)/page.tsx | 4 ++- .../app/CloseTabNotice/CloseTabNotice.tsx | 31 +++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 src/components/app/CloseTabNotice/CloseTabNotice.tsx diff --git a/src/app/(public)/auth/github/callback/route.ts b/src/app/(public)/auth/github/callback/route.ts index fcd7e4f..662a627 100644 --- a/src/app/(public)/auth/github/callback/route.ts +++ b/src/app/(public)/auth/github/callback/route.ts @@ -14,7 +14,7 @@ export async function GET(request: Request): Promise { return new Response(null, { status: 302, headers: { - Location: '/', + Location: '/?close', }, }); } diff --git a/src/app/(public)/page.tsx b/src/app/(public)/page.tsx index 7142616..27cbe7f 100644 --- a/src/app/(public)/page.tsx +++ b/src/app/(public)/page.tsx @@ -1,12 +1,14 @@ -// https://v0.dev/r/DxCSk58T8pM +import CloseTabNotice from '@/components/app/CloseTabNotice/CloseTabNotice'; import LandingStepper from '@/components/app/LandingStepper/LandingStepper'; import Video from '@/components/app/Video/Video'; import { Button } from '@/components/ui/button'; import Link from 'next/link'; +import React from 'react'; export default function Home() { return ( <> +
diff --git a/src/components/app/CloseTabNotice/CloseTabNotice.tsx b/src/components/app/CloseTabNotice/CloseTabNotice.tsx new file mode 100644 index 0000000..5e96fe5 --- /dev/null +++ b/src/components/app/CloseTabNotice/CloseTabNotice.tsx @@ -0,0 +1,31 @@ +'use client'; + +import { useSearchParams } from 'next/navigation'; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; + +export default function CloseTabNotice() { + const searchParams = useSearchParams(); + const close = searchParams.has('close'); + if (!close) return null; + + return ( + + + + You are back! + + Now that the github integration is installed, you can close this tab and refresh the + other tab to see the repos! (or maybe not, in case of an organization it may need + approval) + + + + + ); +}