Skip to content

Commit d2e4920

Browse files
committed
merge-master
2 parents 9766643 + 4aa0b33 commit d2e4920

File tree

9 files changed

+92
-28
lines changed

9 files changed

+92
-28
lines changed
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Page from "./page";
2-
export const metadata = {
3-
title: "Reset Password - Open PRO",
4-
description: "Page description",
5-
};
2+
import { constructMetadata } from "@/lib/utils"
3+
import { Metadata } from "next/types"
4+
5+
export const metadata: Metadata = constructMetadata({
6+
title: 'Reset Password',
7+
description: 'Reset your password',
8+
canonical: '/reset-password',
9+
})
610

711
export default Page;

app/(auth)/signin/layout.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Page from "./page";
2-
export const metadata = {
3-
title: "Sign In - Open PRO",
4-
description: "Page description",
5-
};
2+
import { constructMetadata } from "@/lib/utils"
3+
import { Metadata } from "next/types"
4+
5+
export const metadata: Metadata = constructMetadata({
6+
title: 'Sign In',
7+
description: 'Sign in to your account',
8+
canonical: '/signin',
9+
})
610

711
export default Page;

app/(auth)/signin/page.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ export default async function SignIn() {
66
const supabase = createClient();
77
const { data } = await supabase.auth.getUser();
88

9-
if (process.env.NODE_ENV === "production") {
10-
// Temporarily redirect to home page in production until we have a proper backend auth flow
11-
redirect("/");
12-
}
13-
149
if (data?.user) {
1510
redirect("/");
1611
}

app/(auth)/signup/layout.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import Page from "./page";
2-
export const metadata = {
3-
title: "Sign Up - Open PRO",
4-
description: "Page description",
5-
};
2+
import { constructMetadata } from "@/lib/utils"
3+
import { Metadata } from "next/types"
4+
5+
export const metadata: Metadata = constructMetadata({
6+
title: 'Sign Up',
7+
description: 'Sign up for an account',
8+
canonical: '/signup',
9+
})
610

711
export default Page;

app/(auth)/signup/page.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@ import { createClient } from "@/utils/supabase/server";
33
import SignUpComponent from "@/components/auth/signup";
44

55
export default async function SignUp() {
6-
const supabase = createClient();
7-
const { data } = await supabase.auth.getUser();
8-
9-
if (process.env.NODE_ENV === "production") {
10-
// Temporarily redirect to home page in production until we have a proper backend auth flow
11-
redirect("/");
12-
}
13-
6+
const supabase = createClient()
7+
const { data } = await supabase.auth.getUser()
8+
149
if (data?.user) {
1510
redirect("/");
1611
}

app/(profile)/settings/layout.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Page from "./page";
2+
import { constructMetadata } from "@/lib/utils"
3+
import { Metadata } from "next/types"
4+
5+
export const metadata: Metadata = constructMetadata({
6+
title: 'Settings',
7+
description: 'Settings for your account.',
8+
canonical: '/settings',
9+
})
10+
11+
export default Page;

app/(profile)/settings/page.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { redirect } from 'next/navigation'
2+
import { createClient } from '@/utils/supabase/server'
3+
4+
export default async function Settings() {
5+
const supabase = createClient()
6+
7+
const { data, error } = await supabase.auth.getUser()
8+
if (error || !data?.user) {
9+
redirect('/signin')
10+
}
11+
12+
return (
13+
<section className="relative">
14+
<div className="max-w-6xl mx-auto px-4 sm:px-6">
15+
<div className="pt-32 pb-12 md:pt-40 md:pb-20">
16+
17+
{/* Page header */}
18+
<div className="max-w-3xl mx-auto text-center pb-12 md:pb-20">
19+
<h1 className="h1">Settings</h1>
20+
</div>
21+
22+
{/* Settings */}
23+
<div className="max-w-sm mx-auto">
24+
<div className="flex flex-wrap -mx-3 mb-4">
25+
<div className="w-full px-3">
26+
<p className="text-gray-300 text-sm font-medium mb-1">
27+
Full Name: {data.user.user_metadata.full_name}
28+
</p>
29+
<p className="text-gray-300 text-sm font-medium mb-1">
30+
Email: {data.user.email}
31+
</p>
32+
</div>
33+
</div>
34+
</div>
35+
</div>
36+
</div>
37+
</section>
38+
)
39+
}

components/ui/authbutton.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,21 @@ export default async function AuthButton() {
3131
</Link>
3232
</>
3333
) : (
34+
<>
35+
<Link
36+
href="/settings"
37+
className="font-medium inline-flex items-center justify-center border border-transparent px-4 py-2 my-2 mx-4 rounded-sm text-white bg-purple-600 hover:bg-purple-700 transition duration-150 ease-in-out"
38+
>
39+
Settings
40+
</Link>
3441
<form action={handleSignOut}>
35-
<button className="my-2 ml-4 inline-flex items-center justify-center rounded-sm border border-transparent bg-purple-600 px-4 py-2 font-medium text-white transition duration-150 ease-in-out hover:bg-purple-700">
42+
<button
43+
className="font-medium inline-flex items-center justify-center border border-transparent px-4 py-2 my-2 rounded-sm text-white bg-gray-700 hover:bg-gray-800 transition duration-150 ease-in-out"
44+
>
3645
Sign out
3746
</button>
3847
</form>
48+
</>
3949
)}
4050
</div>
4151
);

middleware.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { updateSession } from "./utils/supabase/middleware";
33

44
export async function middleware(request: NextRequest) {
55
if (
6-
request.nextUrl.pathname.startsWith("/signin") ||
7-
request.nextUrl.pathname.startsWith("/signup")
6+
(request.nextUrl.pathname.startsWith("/signin") ||
7+
request.nextUrl.pathname.startsWith("/signup"))
8+
// FEATURE FLAG
9+
&& process.env.NODE_ENV === "production"
810
) {
911
return NextResponse.redirect(new URL("/", request.url));
1012
}

0 commit comments

Comments
 (0)