1
- import React from 'react'
1
+ import React , { useState , useEffect } from "react" ;
2
+ import { motion } from "framer-motion" ;
3
+
4
+ import Navbar from "./Navbar" ;
5
+
6
+ const data = {
7
+ coursesCompleted : 5 ,
8
+ coursesInProgress : 3 ,
9
+ coursesEnrolled : 8 ,
10
+ performance : [
11
+ { subject : "LD" , score : 80 } ,
12
+ { subject : "DSA" , score : 75 } ,
13
+ { subject : "OOPS" , score : 90 } ,
14
+ { subject : "CAO" , score : 85 } ,
15
+ { subject : "ALU" , score : 70 } ,
16
+ ] ,
17
+ attentionRate : 85 ,
18
+ } ;
19
+
20
+ const COLORS = [ "#0088FE" , "#FFBB28" ] ;
21
+
22
+ const Dashboard = ( ) => {
23
+ const [ impTopicContent , setImpTopicContent ] = useState ( "" ) ;
24
+ const [ topicListContent , setTopicListContent ] = useState ( "" ) ;
25
+ const [ clusterQuestionsContent , setClusterQuestionsContent ] = useState ( "" ) ;
26
+ const [ module1Content , setModule1Content ] = useState ( "" ) ;
27
+ const [ showModule1Content , setShowModule1Content ] = useState ( false ) ;
28
+
29
+ useEffect ( ( ) => {
30
+ fetch ( "Files/generated_files/imp_topic_list.txt" )
31
+ . then ( ( response ) => response . text ( ) )
32
+ . then ( ( text ) => setImpTopicContent ( text ) )
33
+ . catch ( ( error ) => console . log ( error ) ) ;
34
+
35
+ fetch ( "Files/generated_files/topic_list.txt" )
36
+ . then ( ( response ) => response . text ( ) )
37
+ . then ( ( text ) => setTopicListContent ( text ) )
38
+ . catch ( ( error ) => console . log ( error ) ) ;
39
+
40
+ fetch ( "Files/generated_files/cluster_questions.txt" )
41
+ . then ( ( response ) => response . text ( ) )
42
+ . then ( ( text ) => setClusterQuestionsContent ( text ) )
43
+ . catch ( ( error ) => console . log ( error ) ) ;
44
+ } , [ ] ) ;
45
+
46
+ const fetchModule1Content = ( ) => {
47
+ fetch ( "Files/generated_files/summarised_notes/module1_summarized.txt" )
48
+ . then ( ( response ) => response . text ( ) )
49
+ . then ( ( text ) => {
50
+ setModule1Content ( text ) ;
51
+ setShowModule1Content ( true ) ;
52
+ } )
53
+ . catch ( ( error ) => console . log ( error ) ) ;
54
+ } ;
55
+
56
+ const containerVariants = {
57
+ hidden : { opacity : 0 } ,
58
+ visible : { opacity : 1 , transition : { duration : 0.5 } } ,
59
+ } ;
2
60
3
- function Dashboard ( ) {
4
61
return (
5
- < div > Dashboard</ div >
6
- )
7
- }
62
+ < div className = "w-screen" >
63
+ < Navbar />
64
+ < div className = "flex flex-col items-center justify-center h-screen w-screen text-center bg-gradient-to-tr from-violet-700 via-green-600 to-green-400 mt-3" >
65
+ < div className = "flex flex-wrap justify-center gap-8 p-6" >
66
+ < motion . div
67
+ className = "w-full sm:w-1/2 bg-slate-50 rounded-lg shadow-lg p-6"
68
+ variants = { containerVariants }
69
+ initial = "hidden"
70
+ animate = "visible"
71
+ >
72
+ < h3 className = "text-lg font-medium mb-4" > Important Topics</ h3 >
73
+ < pre > { impTopicContent } </ pre >
74
+ </ motion . div >
75
+
76
+ < motion . div
77
+ className = "w-full sm:w-1/2 bg-slate-50 rounded-lg shadow-lg p-6"
78
+ variants = { containerVariants }
79
+ initial = "hidden"
80
+ animate = "visible"
81
+ transition = { { delay : 0.2 } }
82
+ >
83
+ < h3 className = "text-lg font-medium mb-4" > Topic List</ h3 >
84
+ < pre > { topicListContent } </ pre >
85
+ </ motion . div >
86
+
87
+ < motion . div
88
+ className = "w-full sm:w-1/2 bg-slate-50 rounded-lg shadow-lg p-6"
89
+ variants = { containerVariants }
90
+ initial = "hidden"
91
+ animate = "visible"
92
+ transition = { { delay : 0.4 } }
93
+ >
94
+ < h3 className = "text-lg font-medium mb-4" > Cluster Questions</ h3 >
95
+ < pre > { clusterQuestionsContent } </ pre >
96
+ </ motion . div >
97
+ </ div >
98
+ </ div >
99
+ </ div >
100
+ ) ;
101
+ } ;
8
102
9
- export default Dashboard
103
+ export { Dashboard as default } ;
0 commit comments