1
- import React , { useCallback , useEffect , useMemo , useState } from "react" ;
1
+ import React , { useCallback , useState , useMemo , useEffect } from "react" ;
2
2
import { useSelector } from "react-redux" ;
3
3
import styled from "styled-components" ;
4
4
import {
@@ -19,8 +19,47 @@ import Session from "../../../interfaces/session";
19
19
import SessionMenuItems from "./session-details-menu-items" ;
20
20
import { Tooltip } from "@mui/material" ;
21
21
import SessionScriptExecutor from "./session-script-executor" ;
22
+ import Icon , { Sizes } from "../atoms/icon" ;
22
23
23
- const Container = styled . div `` ;
24
+ const Container = styled . div `
25
+ @-webkit-keyframes progress {
26
+ 0% {
27
+ background-position: 0 0;
28
+ }
29
+
30
+ to {
31
+ background-position: 200px 0;
32
+ }
33
+ }
34
+
35
+ @keyframes progress {
36
+ 0% {
37
+ background-position: 0 0;
38
+ }
39
+
40
+ to {
41
+ background-position: 200px 0;
42
+ }
43
+ }
44
+
45
+ @keyframes session-summary-expand {
46
+ 0% {
47
+ bottom: -5px;
48
+ }
49
+ 50% {
50
+ bottom: 0px;
51
+ }
52
+ 100% {
53
+ bottom: -5px;
54
+ }
55
+ }
56
+
57
+ & > * {
58
+ .collapsible-row {
59
+ transition: height 0.75s ease-out;
60
+ }
61
+ }
62
+ ` ;
24
63
25
64
const HEADER = styled . div `
26
65
${ ( props ) => getHeaderStyle ( props . theme ) } ;
@@ -66,8 +105,29 @@ const PausedProgressIndicator = styled(ProgressIndicator)`
66
105
#fff2cc 20px
67
106
);
68
107
` ;
108
+ const SummaryContainer = styled . div `
109
+ position: relative;
110
+ display: flex;
111
+ justify-contents: center;
112
+ align-items: center;
113
+ flex-direction: column;
114
+ transition: all 1s;
115
+ height: auto;
116
+ ` ;
117
+
118
+ const SummaryCollapseIcon = styled . div `
119
+ position: absolute;
120
+ animation: session-summary-expand 1s linear infinite;
121
+ cursor: pointer;
69
122
70
- export const SUMMARY_HEIGHT = 120 ;
123
+ & > {
124
+ .icon {
125
+ color: #12bbef;
126
+ }
127
+ }
128
+ ` ;
129
+
130
+ export const SUMMARY_HEIGHT = 110 ;
71
131
export const FAIL_MESSAGE_CONTAINER_HEIGHT = 80 ;
72
132
export const PADDING = 10 ;
73
133
export const VIDEO_PLAYER_HEIGHT = 400 ;
@@ -82,9 +142,12 @@ function hasSessionFailureMessage(session: Session | null) {
82
142
) ;
83
143
}
84
144
85
- function getSessiobDetailsMainContainerHeight ( session : Session | null ) {
145
+ function getSessiobDetailsMainContainerHeight (
146
+ session : Session | null ,
147
+ hideSummary : boolean ,
148
+ ) {
86
149
return (
87
- SUMMARY_HEIGHT +
150
+ ( hideSummary ? 0 : SUMMARY_HEIGHT ) +
88
151
APP_HEADER_HEIGHT +
89
152
SUB_APP_HEADER_HEIGHT +
90
153
PADDING +
@@ -115,9 +178,16 @@ export default function SessionDetails() {
115
178
const [ paused , setPaused ] = useState ( session ?. is_paused ) ;
116
179
const [ isDebugging , setIsDebugging ] = useState ( false ) ;
117
180
const [ isVideoFullscreen , setIsVideFullScreen ] = useState ( false ) ;
181
+ const [ hideSummary , setHideSummary ] = useState ( false ) ;
182
+
183
+ const onToggleSummary = useCallback ( ( state ) => {
184
+ setHideSummary ( state ) ;
185
+ } , [ ] ) ;
118
186
119
- const MAIN_CONTENT_CONTAINER_HEIGHT =
120
- getSessiobDetailsMainContainerHeight ( session ) ;
187
+ const MAIN_CONTENT_CONTAINER_HEIGHT = getSessiobDetailsMainContainerHeight (
188
+ session ,
189
+ hideSummary ,
190
+ ) ;
121
191
122
192
const videoHeight = useMemo ( ( ) => {
123
193
return isVideoFullscreen && ! session ?. is_completed
@@ -168,8 +238,22 @@ export default function SessionDetails() {
168
238
</ ParallelLayout >
169
239
</ HEADER >
170
240
</ Row >
171
- < Row height = { `${ SUMMARY_HEIGHT } px` } >
172
- < SessionSummary session = { session } />
241
+ < Row
242
+ height = { `${ hideSummary ? 0 : SUMMARY_HEIGHT } px` }
243
+ className = "collapsible-row"
244
+ >
245
+ < SummaryContainer >
246
+ { ! hideSummary && < SessionSummary session = { session } /> }
247
+ < SummaryCollapseIcon className = { hideSummary ? "down" : "up" } >
248
+ < Icon
249
+ name = { hideSummary ? "chevron-down" : "chevron-up" }
250
+ size = { Sizes . XL }
251
+ color = "#ff4433"
252
+ tooltip = { hideSummary ? "View Summary" : "Hide Summary" }
253
+ onClick = { ( ) => onToggleSummary ( ! hideSummary ) }
254
+ />
255
+ </ SummaryCollapseIcon >
256
+ </ SummaryContainer >
173
257
</ Row >
174
258
{ /* Animated indicator of the session status */ }
175
259
{ ( ! session . is_completed || session . is_paused ) && (
0 commit comments