File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- // import {Image} from "next/image"
21import Link from "next/link" ;
32import Image from "next/image" ;
43
54import React from 'react'
65import { Button } from '@/components/ui/button'
6+ import InterviewCard from "@/components/interviewCard" ;
7+ import { Interview } from "@/types" ;
78// import { Link } from 'lucide-react'
89
910
1011
1112const page = ( ) => {
13+ const userInterviews : Interview [ ] = [ ] ;
14+ const allInterview : Interview [ ] = [ ] ;
15+ const user = { id : "1" } ;
16+ const hasPastInterviews = userInterviews . length > 0 ;
17+ const hasUpcomingInterviews = allInterview . length > 0 ;
1218 return (
1319 < >
1420 < section className = "card-cta" >
@@ -37,7 +43,7 @@ const page = () => {
3743
3844 < div className = "interviews-section" >
3945 { hasPastInterviews ? (
40- userInterviews ?. map ( ( interview ) => (
46+ userInterviews ?. map ( ( interview : Interview ) => (
4147 < InterviewCard
4248 key = { interview . id }
4349 userId = { user ?. id }
@@ -59,7 +65,7 @@ const page = () => {
5965
6066 < div className = "interviews-section" >
6167 { hasUpcomingInterviews ? (
62- allInterview ?. map ( ( interview ) => (
68+ allInterview ?. map ( ( interview : Interview ) => (
6369 < InterviewCard
6470 key = { interview . id }
6571 userId = { user ?. id }
Original file line number Diff line number Diff line change @@ -82,11 +82,16 @@ const AuthForm = ({ type }: { type: FormType }) => {
8282 return ;
8383 }
8484
85- await signIn ( {
85+ const result = await signIn ( {
8686 email,
8787 idToken,
8888 } ) ;
8989
90+ if ( ! result . success ) {
91+ toast . error ( result . message ) ;
92+ return ;
93+ }
94+
9095 toast . success ( "Signed in successfully." ) ;
9196 router . push ( "/" ) ;
9297 }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import { Button } from "./ui/button";
66import DisplayTechIcons from "./DisplayTechIcons" ;
77
88import { cn , getRandomInterviewCover } from "@/lib/utils" ;
9- import { getFeedbackByInterviewId } from "@lib/actions/general.action" ;
9+ import { getFeedbackByInterviewId } from "@/ lib/actions/general.action" ;
1010import { InterviewCardProps } from "@/types" ;
1111// @/lib/actions/general.action
1212
Original file line number Diff line number Diff line change @@ -83,9 +83,13 @@ export async function signIn(params: SignInParams) {
8383 } ;
8484
8585 await setSessionCookie ( idToken ) ;
86+
87+ return {
88+ success : true ,
89+ } ;
8690 // eslint-disable-next-line @typescript-eslint/no-explicit-any
8791 } catch ( error : any ) {
88- console . log ( "" ) ;
92+ console . log ( error ) ;
8993
9094 return {
9195 success : false ,
Original file line number Diff line number Diff line change 1+ "use server" ;
2+
3+ import { db } from "@/firebase/admin" ;
4+ import { Feedback , GetFeedbackByInterviewIdParams } from "@/types" ;
5+
6+ export async function getFeedbackByInterviewId (
7+ params : GetFeedbackByInterviewIdParams
8+ ) : Promise < Feedback | null > {
9+ try {
10+ const { userId, interviewId } = params ;
11+
12+ const feedbackRef = await db
13+ . collection ( "users" )
14+ . doc ( userId )
15+ . collection ( "interviews" )
16+ . doc ( interviewId )
17+ . collection ( "feedbacks" )
18+ . get ( ) ;
19+
20+ if ( feedbackRef . empty ) return null ;
21+
22+ const feedback = feedbackRef . docs [ 0 ] . data ( ) ;
23+
24+ return {
25+ id : feedbackRef . docs [ 0 ] . id ,
26+ interviewId : feedback . interviewId ,
27+ totalScore : feedback . totalScore ,
28+ categoryScores : feedback . categoryScores ,
29+ strengths : feedback . strengths ,
30+ areasForImprovement : feedback . areasForImprovement ,
31+ finalAssessment : feedback . finalAssessment ,
32+ createdAt : feedback . createdAt . toDate ( ) ,
33+ } ;
34+ } catch ( error ) {
35+ console . log ( error ) ;
36+ return null ;
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments