Skip to content

Commit

Permalink
add timestamp to requests modal (#332)
Browse files Browse the repository at this point in the history
Co-authored-by: Alyssa Wang <[email protected]>
  • Loading branch information
AlyssaWang and AlyssaWang authored Mar 2, 2023
1 parent 3e965b7 commit 6dcec4c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const RequestDetailModal: FC<RequestDetailModalProps> = ({
}) => {
const [copySuccess, setCopySuccess] = React.useState(false);
const styles = useStyles();
const timestamp = request?.timestamp ? new Date(request?.timestamp) : null;

const copyTextClick = async (text: string) => {
await navigator.clipboard.writeText(text).then(() => {
Expand Down Expand Up @@ -98,9 +99,10 @@ const RequestDetailModal: FC<RequestDetailModalProps> = ({
<Divider />
<DialogContent>
<Box pb={3}>
<Typography variant="h5" component="h3" pb={2}>
<Typography variant="h5" component="h3" pb={timestamp ? 0 : 2}>
Request
</Typography>
{timestamp && <Typography variant="overline">{timestamp.toLocaleString()}</Typography>}
<HeaderTable headers={request.request_headers || []} />
<CodeBlock body={request.request_body} headers={request.request_headers} />
</Box>
Expand Down

0 comments on commit 6dcec4c

Please sign in to comment.