@@ -14,10 +14,17 @@ import {
14
14
TableRow ,
15
15
TableCell ,
16
16
TableBody ,
17
- Divider ,
18
17
TextField ,
18
+ Collapse ,
19
+ IconButton ,
20
+ Tooltip ,
19
21
} from '@material-ui/core' ;
20
22
import { createStyles , makeStyles , Theme } from '@material-ui/core/styles' ;
23
+ import {
24
+ KeyboardArrowDown as KeyboardArrowDownIcon ,
25
+ KeyboardArrowUp as KeyboardArrowUpIcon ,
26
+ Code as CodeIcon ,
27
+ } from '@material-ui/icons' ;
21
28
import { without } from 'lodash' ;
22
29
import moment from 'moment' ;
23
30
import { useInjectReducer , useInjectSaga } from 'utils/redux-injectors' ;
@@ -114,6 +121,7 @@ const Mails = () => {
114
121
< TableCell component = "th" scope = "row" >
115
122
< Typography variant = "button" > Subject</ Typography >
116
123
</ TableCell >
124
+ < TableCell style = { { width : 56 } } />
117
125
</ TableRow >
118
126
</ TableHead >
119
127
< TableBody >
@@ -134,43 +142,85 @@ const Mails = () => {
134
142
< TableCell > { mail . from } </ TableCell >
135
143
< TableCell > { mail . to } </ TableCell >
136
144
< TableCell > { mail . subject } </ TableCell >
145
+ < TableCell >
146
+ { mailsOpened . includes ( mail . id ) ? (
147
+ < KeyboardArrowUpIcon />
148
+ ) : (
149
+ < KeyboardArrowDownIcon />
150
+ ) }
151
+ </ TableCell >
137
152
</ TableRow >
138
- { mailsOpened . includes ( mail . id ) && (
139
- < TableRow >
140
- < TableCell colSpan = { 5 } >
141
- < Typography variant = "body1" > { mail . body } </ Typography >
142
- < Box mt = { 2 } mb = { 2 } >
143
- < Divider />
144
- </ Box >
145
- < Button
146
- onClick = { ( ) => {
147
- setRawSourcesOpened (
148
- rawSourcesOpened . includes ( mail . id )
149
- ? without ( rawSourcesOpened , mail . id )
150
- : [ ...rawSourcesOpened , mail . id ] ,
151
- ) ;
152
- } }
153
- variant = "outlined"
154
- >
155
- Raw source
156
- </ Button >
153
+ < TableRow >
154
+ < TableCell colSpan = { 6 } style = { { padding : 0 } } >
155
+ < Collapse
156
+ in = { mailsOpened . includes ( mail . id ) }
157
+ timeout = "auto"
158
+ unmountOnExit
159
+ >
160
+ < Table >
161
+ < TableBody >
162
+ < TableRow >
163
+ < TableCell
164
+ style = { {
165
+ paddingBottom : 0 ,
166
+ paddingTop : 0 ,
167
+ width : '100%' ,
168
+ } }
169
+ >
170
+ < Box pt = { 2 } pb = { 2 } >
171
+ < Typography variant = "body1" >
172
+ { mail . body }
173
+ </ Typography >
174
+ </ Box >
175
+ </ TableCell >
157
176
158
- { rawSourcesOpened . includes ( mail . id ) && (
159
- < Box mt = { 2 } >
160
- < TextField
161
- multiline
162
- value = { mail . raw }
163
- InputProps = { {
164
- readOnly : true ,
165
- } }
166
- fullWidth
167
- variant = "filled"
168
- />
169
- </ Box >
170
- ) }
171
- </ TableCell >
172
- </ TableRow >
173
- ) }
177
+ < TableCell
178
+ style = { {
179
+ paddingBottom : 0 ,
180
+ paddingTop : 0 ,
181
+ paddingRight : 4 ,
182
+ } }
183
+ >
184
+ < Tooltip title = "Raw source" >
185
+ < IconButton
186
+ onClick = { ( ) => {
187
+ setRawSourcesOpened (
188
+ rawSourcesOpened . includes ( mail . id )
189
+ ? without ( rawSourcesOpened , mail . id )
190
+ : [ ...rawSourcesOpened , mail . id ] ,
191
+ ) ;
192
+ } }
193
+ >
194
+ < CodeIcon />
195
+ </ IconButton >
196
+ </ Tooltip >
197
+ </ TableCell >
198
+ </ TableRow >
199
+ { rawSourcesOpened . includes ( mail . id ) && (
200
+ < TableRow >
201
+ < TableCell
202
+ colSpan = { 2 }
203
+ style = { { paddingTop : 0 } }
204
+ >
205
+ < Box mt = { 2 } >
206
+ < TextField
207
+ multiline
208
+ value = { mail . raw }
209
+ InputProps = { {
210
+ readOnly : true ,
211
+ } }
212
+ fullWidth
213
+ variant = "filled"
214
+ />
215
+ </ Box >
216
+ </ TableCell >
217
+ </ TableRow >
218
+ ) }
219
+ </ TableBody >
220
+ </ Table >
221
+ </ Collapse >
222
+ </ TableCell >
223
+ </ TableRow >
174
224
</ Fragment >
175
225
) ) }
176
226
</ TableBody >
0 commit comments