File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
app/(app)/challenges/[id] Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 1+ "use server" ;
2+
3+ import { getAuthorizedUserInfo } from "@/lib/auth.rsc" ;
4+ import { AIAssistant , type AIAssistantProps } from "./ai-assistant" ;
5+
6+ export async function GatedAIAssistant ( { questionId } : AIAssistantProps ) {
7+ const userInfo = await getAuthorizedUserInfo ( [ "*" , "ai" ] ) ;
8+ if ( ! userInfo ) {
9+ return null ;
10+ }
11+
12+ return < AIAssistant questionId = { questionId } /> ;
13+ }
Original file line number Diff line number Diff line change 11import type { Metadata } from "next" ;
22import { Suspense } from "react" ;
3- import { AIAssistant } from "./_components/ai-assistant" ;
3+ import { GatedAIAssistant } from "./_components/gated- ai-assistant" ;
44import Header from "./_components/header" ;
55import HeaderSkeleton from "./_components/header/skeleton" ;
66import PracticeIDE from "./_components/ide" ;
@@ -26,7 +26,9 @@ export default async function ChallengePage({
2626 < PracticeIDE id = { id } />
2727 </ Suspense >
2828
29- < AIAssistant questionId = { id } />
29+ < Suspense >
30+ < GatedAIAssistant questionId = { id } />
31+ </ Suspense >
3032 </ div >
3133 ) ;
3234}
You can’t perform that action at this time.
0 commit comments