Skip to content

Commit 5874949

Browse files
committed
fix: payload example for webhook
1 parent 5c6e643 commit 5874949

File tree

1 file changed

+53
-59
lines changed

1 file changed

+53
-59
lines changed

dashboard/src/components/UpdateWebhookModal.tsx

Lines changed: 53 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import {
2121
Text,
2222
useDisclosure,
2323
useToast,
24+
Alert,
25+
AlertIcon,
26+
Divider,
2427
} from '@chakra-ui/react';
2528
import {
2629
FaAngleDown,
@@ -468,68 +471,12 @@ const UpdateWebhookModal = ({
468471
</Text>
469472
</Flex>
470473
</Flex>
471-
<Flex
472-
width="100%"
473-
justifyContent="center"
474-
alignItems="center"
475-
marginBottom="5%"
476-
flexDirection="column"
477-
>
478-
<Flex
479-
width="100%"
480-
justifyContent="space-between"
481-
alignItems="center"
482-
>
483-
<Flex>
484-
Payload
485-
<Text color="gray.500" ml={1}>
486-
(example)
487-
</Text>
488-
</Flex>
489-
<Button
490-
onClick={() => setIsShowingPayload(!isShowingPayload)}
491-
variant="ghost"
492-
>
493-
{isShowingPayload ? <FaAngleUp /> : <FaAngleDown />}
494-
</Button>
495-
</Flex>
496-
<Collapse
497-
style={{
498-
marginTop: 10,
499-
width: '100%',
500-
}}
501-
in={isShowingPayload}
502-
>
503-
<Code
504-
width="inherit"
505-
borderRadius={5}
506-
padding={2}
507-
position="relative"
508-
>
509-
<pre style={{ overflow: 'auto' }}>
510-
{webhookPayloadExample}
511-
</pre>
512-
{isShowingPayload && (
513-
<Flex
514-
position="absolute"
515-
top={4}
516-
right={4}
517-
cursor="pointer"
518-
onClick={() =>
519-
copyTextToClipboard(webhookPayloadExample)
520-
}
521-
>
522-
<FaRegClone color="#bfbfbf" />
523-
</Flex>
524-
)}
525-
</Code>
526-
</Collapse>
527-
</Flex>
474+
528475
<Flex
529476
width="100%"
530477
justifyContent="space-between"
531478
alignItems="center"
532-
marginBottom="2%"
479+
marginBottom="5%"
533480
>
534481
<Flex>Headers</Flex>
535482
<Flex>
@@ -546,7 +493,8 @@ const UpdateWebhookModal = ({
546493
</Button>
547494
</Flex>
548495
</Flex>
549-
<Flex flexDirection="column" maxH={220} overflowY="scroll">
496+
497+
<Flex flexDirection="column" maxH={220} overflowY="auto">
550498
{webhook[WebhookInputDataFields.HEADERS]?.map(
551499
(headerData, index) => (
552500
<Flex
@@ -615,6 +563,52 @@ const UpdateWebhookModal = ({
615563
)
616564
)}
617565
</Flex>
566+
<Divider marginY={5} />
567+
568+
<Alert
569+
status="info"
570+
onClick={() => setIsShowingPayload(!isShowingPayload)}
571+
borderRadius="5"
572+
>
573+
<AlertIcon />
574+
<Flex
575+
width="100%"
576+
justifyContent="space-between"
577+
alignItems="center"
578+
>
579+
Checkout the example payload
580+
{isShowingPayload ? <FaAngleUp /> : <FaAngleDown />}
581+
</Flex>
582+
</Alert>
583+
<Collapse
584+
style={{
585+
marginTop: 10,
586+
width: '100%',
587+
}}
588+
in={isShowingPayload}
589+
>
590+
<Code
591+
width="inherit"
592+
borderRadius={5}
593+
padding={2}
594+
position="relative"
595+
>
596+
<pre style={{ overflow: 'auto' }}>
597+
{webhookPayloadExample}
598+
</pre>
599+
{isShowingPayload && (
600+
<Flex
601+
position="absolute"
602+
top={4}
603+
right={4}
604+
cursor="pointer"
605+
onClick={() => copyTextToClipboard(webhookPayloadExample)}
606+
>
607+
<FaRegClone color="#bfbfbf" />
608+
</Flex>
609+
)}
610+
</Code>
611+
</Collapse>
618612
</Flex>
619613
</ModalBody>
620614
<ModalFooter>

0 commit comments

Comments
 (0)