File tree Expand file tree Collapse file tree 8 files changed +59
-6
lines changed
Expand file tree Collapse file tree 8 files changed +59
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export default function AuthLayout({
1212 children : React . ReactNode ;
1313} ) {
1414 return (
15- < main className = "flex min-h-screen w-full items-center justify-center" >
15+ < main className = "flex min-h-screen w-full items-center justify-center bg-auth-light bg-cover bg-center bg-no-repeat dark:bg-auth-dark " >
1616 { children }
1717 </ main >
1818 ) ;
Original file line number Diff line number Diff line change 1+ import { auth } from "@clerk/nextjs" ;
2+ import { redirect } from "next/navigation" ;
3+
4+ import Profile from "@/components/forms/Profile" ;
5+
6+ import { getUserById } from "@/lib/actions/user.action" ;
7+
8+ const Page = async ( ) => {
9+ const { userId } = auth ( ) ;
10+ if ( ! userId ) return null ;
11+
12+ const mongoUser = await getUserById ( { userId } ) ;
13+ if ( mongoUser ?. onboarded ) redirect ( "/" ) ;
14+
15+ return (
16+ < >
17+ < main className = "mx-auto flex max-w-3xl flex-col justify-start px-10 py-20" >
18+ < h1 className = "h1-bold text-dark100_light900" > Onboarding</ h1 >
19+ < p className = "base-medium text-dark100_light900 mt-3" >
20+ Complete your profile now to use DevOverflow
21+ </ p >
22+
23+ < div className = "background-light850_dark100 mt-9 p-10" >
24+ < Profile clerkId = { userId } user = { JSON . stringify ( mongoUser ) } />
25+ </ div >
26+ </ main >
27+ </ >
28+ ) ;
29+ } ;
30+
31+ export default Page ;
Original file line number Diff line number Diff line change 11import { auth } from "@clerk/nextjs" ;
2+ import { redirect } from "next/navigation" ;
23
34import Question from "@/components/forms/Question" ;
45
@@ -17,6 +18,7 @@ const Page = async (props: Props) => {
1718 if ( ! userId ) return null ;
1819
1920 const mongoUser = await getUserById ( { userId } ) ;
21+ if ( ! mongoUser ?. onboarded ) redirect ( "/onboarding" ) ;
2022
2123 return (
2224 < div >
Original file line number Diff line number Diff line change 11import { auth } from "@clerk/nextjs" ;
2+ import { redirect } from "next/navigation" ;
23
34import LocalSearchbar from "@/components/shared/search/LocalSearchbar" ;
45import Filter from "@/components/shared/Filter" ;
56import NoResult from "@/components/shared/NoResult" ;
67import Pagination from "@/components/shared/Pagination" ;
78import QuestionCard from "@/components/cards/QuestionCard" ;
89
9- import { getSavedQuestions } from "@/lib/actions/user.action" ;
10+ import { getSavedQuestions , getUserById } from "@/lib/actions/user.action" ;
1011
1112import { QuestionFilters } from "@/constants/filters" ;
1213
@@ -22,6 +23,9 @@ export default async function Collection({ searchParams }: SearchParamsProps) {
2223
2324 if ( ! clerkId ) return null ;
2425
26+ const mongoUser = await getUserById ( { userId : clerkId } ) ;
27+ if ( ! mongoUser ?. onboarded ) redirect ( "/onboarding" ) ;
28+
2529 const result = await getSavedQuestions ( {
2630 clerkId,
2731 searchQuery : searchParams . q ,
Original file line number Diff line number Diff line change 1- import { redirect } from "next/navigation" ;
2-
31import { auth } from "@clerk/nextjs" ;
2+ import { redirect } from "next/navigation" ;
43
54import Answer from "@/components/forms/Answer" ;
65
6+ import { getUserById } from "@/lib/actions/user.action" ;
77import { getAnswerById } from "@/lib/actions/answer.action" ;
88
99import type { ParamsProps } from "@/types" ;
@@ -18,6 +18,9 @@ const Page = async ({ params }: ParamsProps) => {
1818
1919 if ( ! userId ) return null ;
2020
21+ const mongoUser = await getUserById ( { userId } ) ;
22+ if ( ! mongoUser ?. onboarded ) redirect ( "/onboarding" ) ;
23+
2124 const result = await getAnswerById ( { answerId : params . id } ) ;
2225
2326 if ( userId !== result . author . clerkId ) redirect ( "/" ) ;
Original file line number Diff line number Diff line change 11import { auth } from "@clerk/nextjs" ;
2+ import { redirect } from "next/navigation" ;
23
34import Profile from "@/components/forms/Profile" ;
45
@@ -17,6 +18,7 @@ const Page = async ({ params }: ParamsProps) => {
1718 if ( ! userId ) return null ;
1819
1920 const mongoUser = await getUserById ( { userId } ) ;
21+ if ( ! mongoUser ?. onboarded ) redirect ( "/onboarding" ) ;
2022
2123 return (
2224 < >
Original file line number Diff line number Diff line change 11import { auth } from "@clerk/nextjs" ;
2+ import { redirect } from "next/navigation" ;
23
34import Question from "@/components/forms/Question" ;
45
@@ -18,6 +19,7 @@ const Page = async ({ params }: ParamsProps) => {
1819 if ( ! userId ) return null ;
1920
2021 const mongoUser = await getUserById ( { userId } ) ;
22+ if ( ! mongoUser ?. onboarded ) redirect ( "/onboarding" ) ;
2123
2224 const result = await getQuestionById ( { questionId : params . id } ) ;
2325
Original file line number Diff line number Diff line change @@ -4,8 +4,17 @@ import { authMiddleware } from "@clerk/nextjs";
44// Please edit this to allow other routes to be public as needed.
55// See https://clerk.com/docs/references/nextjs/auth-middleware for more information about configuring your Middleware
66export default authMiddleware ( {
7- publicRoutes : [ "/" , "/api/webhook/clerk" ] ,
8- ignoredRoutes : [ "/api/webhook/clerk" ] ,
7+ publicRoutes : [
8+ "/" ,
9+ "/api/webhook/clerk" ,
10+ "/question/:id" ,
11+ "/tags" ,
12+ "/tags/:id" ,
13+ "/profile/:id" ,
14+ "/community" ,
15+ "/jobs" ,
16+ ] ,
17+ ignoredRoutes : [ "/api/webhook/clerk" , "/api/openai" ] ,
918} ) ;
1019
1120export const config = {
You can’t perform that action at this time.
0 commit comments