enzostvs HF Staff commited on
Commit
533a7c7
·
1 Parent(s): 1406bcb
Files changed (1) hide show
  1. app/auth/callback/page.tsx +21 -9
app/auth/callback/page.tsx CHANGED
@@ -1,7 +1,7 @@
1
  "use client";
2
  import { useUser } from "@/hooks/useUser";
3
- import { use } from "react";
4
- import { useMount } from "react-use";
5
 
6
  import { Button } from "@/components/ui/button";
7
  import Link from "next/link";
@@ -10,6 +10,7 @@ export default function AuthCallback({
10
  }: {
11
  searchParams: Promise<{ code: string }>;
12
  }) {
 
13
  const { code } = use(searchParams);
14
  const { loginFromCode } = useUser();
15
 
@@ -19,6 +20,11 @@ export default function AuthCallback({
19
  }
20
  });
21
 
 
 
 
 
 
22
  return (
23
  <div className="h-screen flex flex-col justify-center items-center">
24
  <div className="!rounded-2xl !p-0 !bg-white !border-neutral-100 min-w-xs text-center overflow-hidden ring-[8px] ring-white/20">
@@ -44,14 +50,20 @@ export default function AuthCallback({
44
  <main className="space-y-4 p-6">
45
  <div>
46
  <p className="text-sm text-neutral-700 mb-4 max-w-xs">
47
- If you are not redirected automatically, please click the button
48
- below:
49
  </p>
50
- <Link href="/">
51
- <Button variant="black" className="relative">
52
- Go to Home
53
- </Button>
54
- </Link>
 
 
 
 
 
 
55
  </div>
56
  </main>
57
  </div>
 
1
  "use client";
2
  import { useUser } from "@/hooks/useUser";
3
+ import { use, useState } from "react";
4
+ import { useMount, useTimeoutFn } from "react-use";
5
 
6
  import { Button } from "@/components/ui/button";
7
  import Link from "next/link";
 
10
  }: {
11
  searchParams: Promise<{ code: string }>;
12
  }) {
13
+ const [showButton, setShowButton] = useState(false);
14
  const { code } = use(searchParams);
15
  const { loginFromCode } = useUser();
16
 
 
20
  }
21
  });
22
 
23
+ useTimeoutFn(
24
+ () => setShowButton(true),
25
+ 7000 // Show button after 5 seconds
26
+ );
27
+
28
  return (
29
  <div className="h-screen flex flex-col justify-center items-center">
30
  <div className="!rounded-2xl !p-0 !bg-white !border-neutral-100 min-w-xs text-center overflow-hidden ring-[8px] ring-white/20">
 
50
  <main className="space-y-4 p-6">
51
  <div>
52
  <p className="text-sm text-neutral-700 mb-4 max-w-xs">
53
+ If you are not redirected automatically in the next 5 seconds,
54
+ please click the button below
55
  </p>
56
+ {showButton ? (
57
+ <Link href="/">
58
+ <Button variant="black" className="relative">
59
+ Go to Home
60
+ </Button>
61
+ </Link>
62
+ ) : (
63
+ <p className="text-xs text-neutral-500">
64
+ Please wait, we are logging you in...
65
+ </p>
66
+ )}
67
  </div>
68
  </main>
69
  </div>