Skip to content

Commit

Permalink
Merge pull request #11 from cs3216-a3-group-4/seeleng/fix-suspense
Browse files Browse the repository at this point in the history
fix: suspense again
  • Loading branch information
chloeelim authored Sep 20, 2024
2 parents aafeabd + 2ff3a88 commit 2f22b62
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
run: npm install
- name: ESLint
run: npm run lint
- name: Build
run: npm run build
backend:
name: backend (format, lint)
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions frontend/app/auth/google/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Suspense } from "react";

export default function Layout({
children,
}: Readonly<{ children: React.ReactNode }>) {
return <Suspense>{children}</Suspense>;
}
50 changes: 24 additions & 26 deletions frontend/app/auth/google/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { Suspense, useEffect, useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import { CheckCircleIcon } from "lucide-react";

Expand Down Expand Up @@ -37,31 +37,29 @@ export default function GoogleOAuth() {
}, [code, router]);

return (
<Suspense>
<Box className="flex flex-col m-auto w-full justify-center items-center gap-y-10">
<Card className="flex flex-col border-0 md:border px-6 sm:px-12 sm:py-6 shadow-none md:shadow-sm md:max-w-md text-center">
<CardHeader className="space-y-3">
<CardTitle>Sign in with Google</CardTitle>
</CardHeader>
<Box className="flex flex-col m-auto w-full justify-center items-center gap-y-10">
<Card className="flex flex-col border-0 md:border px-6 sm:px-12 sm:py-6 shadow-none md:shadow-sm md:max-w-md text-center">
<CardHeader className="space-y-3">
<CardTitle>Sign in with Google</CardTitle>
</CardHeader>

<CardContent className="flex flex-col space-y-8">
<Box className="flex justify-center">
{isLoading ? (
<LoadingSpinner size={64} />
) : (
<CheckCircleIcon size={64} />
)}
</Box>
<CardDescription>
<span className="max-w-sm">
{isLoading
? "Hang tight! We're logging you in. This shouldn't take too long."
: "All done! You should be redirected soon."}
</span>
</CardDescription>
</CardContent>
</Card>
</Box>
</Suspense>
<CardContent className="flex flex-col space-y-8">
<Box className="flex justify-center">
{isLoading ? (
<LoadingSpinner size={64} />
) : (
<CheckCircleIcon size={64} />
)}
</Box>
<CardDescription>
<span className="max-w-sm">
{isLoading
? "Hang tight! We're logging you in. This shouldn't take too long."
: "All done! You should be redirected soon."}
</span>
</CardDescription>
</CardContent>
</Card>
</Box>
);
}

0 comments on commit 2f22b62

Please sign in to comment.