From 3d1c60ffe71ae1eeab389bfec07b4e7206fbc5bb Mon Sep 17 00:00:00 2001 From: Rupin Khandelwal Date: Mon, 31 Oct 2022 17:34:12 -0400 Subject: [PATCH] Wrapping up the remaining task for integration feature --- .../templates/integrations/Webhooks.tsx | 80 +++++++++++++------ 1 file changed, 55 insertions(+), 25 deletions(-) diff --git a/packages/web/components/templates/integrations/Webhooks.tsx b/packages/web/components/templates/integrations/Webhooks.tsx index 0a9acd18d..d36ab8a64 100644 --- a/packages/web/components/templates/integrations/Webhooks.tsx +++ b/packages/web/components/templates/integrations/Webhooks.tsx @@ -4,7 +4,7 @@ import Image from 'next/image' import { Box, HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives' import { Button } from '../../elements/Button' -import { Plus } from 'phosphor-react' +import { Link, Plus } from 'phosphor-react' import { useGetWebhooksQuery } from '../../../lib/networking/queries/useGetWebhooksQuery' import { useMemo } from 'react' @@ -16,29 +16,29 @@ const Header = styled(Box, { }) interface Webhook { - id?: string - url: string - eventTypes: string - contentType?: string - method?: string - enabled?: string - createdAt?: Date - updatedAt?: Date - } + id?: string + url: string + eventTypes: string + contentType?: string + method?: string + enabled?: string + createdAt?: Date + updatedAt?: Date +} export function Webhooks(): JSX.Element { - const { webhooks } = useGetWebhooksQuery() const webhooksList = useMemo(() => { - const webhooksList = new Map() - webhooks.forEach((webhook) => - webhooksList.set(webhook.id, { - url: webhook.url, - eventTypes: webhook.eventTypes.join(', '), - method: webhook.method, - contentType: webhook.contentType, - createdAt: webhook.createdAt, + const webhooksList: Array = [] + webhooks.forEach((webhookItem) => + webhooksList.push({ + id: webhookItem.id, + url: webhookItem.url, + eventTypes: webhookItem.eventTypes.join(', '), + method: webhookItem.method, + contentType: webhookItem.contentType, + createdAt: webhookItem.createdAt, }) ) return webhooksList @@ -109,12 +109,42 @@ export function Webhooks(): JSX.Element { - - + border: '1px solid white', + height: '100%', + width: '100%', + }} + > + {webhooksList.map((item) => { + return ( + + + +

{item.method}

+

{item.createdAt}

+
+
+ ) + })}
)