Skip to content

Commit 7727178

Browse files
committed
improved upon visuals and ui in mails table
Signed-off-by: Tobias Winkler <[email protected]>
1 parent 9967291 commit 7727178

File tree

1 file changed

+86
-36
lines changed

1 file changed

+86
-36
lines changed

src/app/pages/Mails/index.tsx

Lines changed: 86 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@ import {
1414
TableRow,
1515
TableCell,
1616
TableBody,
17-
Divider,
1817
TextField,
18+
Collapse,
19+
IconButton,
20+
Tooltip,
1921
} from '@material-ui/core';
2022
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';
2128
import { without } from 'lodash';
2229
import moment from 'moment';
2330
import { useInjectReducer, useInjectSaga } from 'utils/redux-injectors';
@@ -114,6 +121,7 @@ const Mails = () => {
114121
<TableCell component="th" scope="row">
115122
<Typography variant="button">Subject</Typography>
116123
</TableCell>
124+
<TableCell style={{ width: 56 }} />
117125
</TableRow>
118126
</TableHead>
119127
<TableBody>
@@ -134,43 +142,85 @@ const Mails = () => {
134142
<TableCell>{mail.from}</TableCell>
135143
<TableCell>{mail.to}</TableCell>
136144
<TableCell>{mail.subject}</TableCell>
145+
<TableCell>
146+
{mailsOpened.includes(mail.id) ? (
147+
<KeyboardArrowUpIcon />
148+
) : (
149+
<KeyboardArrowDownIcon />
150+
)}
151+
</TableCell>
137152
</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>
157176

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>
174224
</Fragment>
175225
))}
176226
</TableBody>

0 commit comments

Comments
 (0)