1
1
import Link from "next/link" ;
2
2
import { useState } from "react" ;
3
- import { Segment , Grid , Dropdown } from "semantic-ui-react" ;
4
- import { Course , Queue } from "../../../types" ;
3
+ import {
4
+ Segment ,
5
+ Grid ,
6
+ Dropdown ,
7
+ Tab ,
8
+ Rating ,
9
+ Divider ,
10
+ } from "semantic-ui-react" ;
11
+ import { Course , Membership , Queue } from "../../../types" ;
5
12
import Averages from "./Heatmaps/Averages" ;
6
13
import SummaryCards from "./Cards/SummaryCards" ;
7
14
8
15
interface AnalyticsProps {
9
16
course : Course ;
10
17
queues : Queue [ ] ;
18
+ leadership : Membership [ ] ;
11
19
}
12
20
13
- const Analytics = ( { course, queues } : AnalyticsProps ) => {
21
+ const Analytics = ( { course, queues, leadership } : AnalyticsProps ) => {
14
22
const [ queueId , setQueueId ] = useState < number | undefined > (
15
23
queues . length !== 0 ? queues [ 0 ] . id : undefined
16
24
) ;
@@ -23,30 +31,107 @@ const Analytics = ({ course, queues }: AnalyticsProps) => {
23
31
} ;
24
32
} ) ;
25
33
34
+ const taOptions = [
35
+ { key : - 1 , value : - 1 , text : "Filter by TA" } ,
36
+ ...leadership . map ( ( leader ) => {
37
+ return {
38
+ key : leader . id ,
39
+ value : leader . id ,
40
+ text : `${ leader . user . firstName } ${ leader . user . lastName } ` ,
41
+ } ;
42
+ } ) ,
43
+ ] ;
44
+
45
+ const [ tab , setTab ] = useState ( 0 ) ;
46
+
47
+ const panes = [
48
+ { menuItem : "Analytics" , render : ( ) => < br /> } ,
49
+ { menuItem : "Student Feedback" , render : ( ) => < br /> } ,
50
+ ] ;
26
51
return (
27
- < Grid . Row >
28
- { queueId ? (
29
- < >
30
- < Dropdown
31
- as = "h3"
32
- inline
33
- options = { queueOptions }
34
- defaultValue = { queueId }
35
- onChange = { ( e , { value } ) => {
36
- setQueueId ( value as number ) ;
37
- } }
38
- />
39
- < SummaryCards courseId = { course . id } queueId = { queueId } />
40
- < Averages courseId = { course . id } queueId = { queueId } />
41
- </ >
42
- ) : (
43
- < Segment basic >
44
- You have no queues. Create a queue on the{ " " }
45
- < Link href = { `/courses/${ course . id } ` } > queue page</ Link > to
46
- see analytics.
47
- </ Segment >
48
- ) }
49
- </ Grid . Row >
52
+ < >
53
+ < Grid . Row >
54
+ < Tab
55
+ defaultActiveIndex = { 0 }
56
+ onTabChange = { ( _ , { activeIndex } ) =>
57
+ setTab ( activeIndex as number )
58
+ }
59
+ panes = { panes }
60
+ />
61
+ </ Grid . Row >
62
+ < Grid . Row >
63
+ { tab === 0 &&
64
+ ( queueId ? (
65
+ < >
66
+ < Dropdown
67
+ as = "h3"
68
+ inline
69
+ options = { queueOptions }
70
+ defaultValue = { queueId }
71
+ onChange = { ( e , { value } ) => {
72
+ setQueueId ( value as number ) ;
73
+ } }
74
+ />
75
+ < SummaryCards
76
+ courseId = { course . id }
77
+ queueId = { queueId }
78
+ />
79
+ < Averages courseId = { course . id } queueId = { queueId } />
80
+ </ >
81
+ ) : (
82
+ < Segment basic >
83
+ You have no queues. Create a queue on the{ " " }
84
+ < Link href = { `/courses/${ course . id } ` } >
85
+ queue page
86
+ </ Link > { " " }
87
+ to see analytics.
88
+ </ Segment >
89
+ ) ) }
90
+ { tab === 1 && (
91
+ < div >
92
+ < Dropdown
93
+ as = "h3"
94
+ inline
95
+ options = { taOptions }
96
+ defaultValue = { - 1 }
97
+ />
98
+ < Segment color = "olive" >
99
+ < div >
100
+ Student < b > Ryan Tanenholz </ b > asked "What
101
+ is the difference between a stack and a
102
+ queue?"
103
+ </ div >
104
+ < div >
105
+ and provided the following feedback to TA{ " " }
106
+ < b > Ben Franklin</ b > .
107
+ </ div >
108
+ < Divider />
109
+ < div >
110
+ < b > Rating</ b > { " " }
111
+ < Rating
112
+ icon = "star"
113
+ defaultRating = { 5 }
114
+ maxRating = { 5 }
115
+ disabled
116
+ />
117
+ </ div >
118
+ < div >
119
+ < b > Comment </ b >
120
+ { /* Default Text */ }
121
+ Ben Franklin was very helpful and explained the
122
+ concepts clearly. I was struggling with
123
+ understanding the problem, but Ben Franklin
124
+ broke it down into manageable parts and guided
125
+ me through each step. His patience and ability
126
+ to simplify complex topics made a significant
127
+ difference in my learning experience. Highly
128
+ recommend!
129
+ </ div >
130
+ </ Segment >
131
+ </ div >
132
+ ) }
133
+ </ Grid . Row >
134
+ </ >
50
135
) ;
51
136
} ;
52
137
0 commit comments