'use client'; import clsx from 'clsx'; import ImageWithFallback from '@gitroom/react/helpers/image.with.fallback'; import { useT } from '@gitroom/react/translation/get.transation.service.client'; import { ThirdPartyListComponent } from '@gitroom/frontend/components/third-parties/third-party.list.component'; import React, { FC, useCallback, useState } from 'react'; import useSWR from 'swr'; import { useFetch } from '@gitroom/helpers/utils/custom.fetch'; import { useToaster } from '@gitroom/react/toaster/toaster'; import { deleteDialog } from '@gitroom/react/helpers/delete.dialog'; import useCookie from 'react-use-cookie'; import { SVGLine } from '@gitroom/frontend/components/launches/launches.component'; export const ThirdPartyMenuComponent: FC<{ reload: () => void; tParty: { id: string }; }> = (props) => { const { tParty, reload } = props; const fetch = useFetch(); const [show, setShow] = useState(false); const t = useT(); const toaster = useToaster(); const changeShow = () => { setShow((prev) => !prev); }; const deleteChannel = (id: string) => async () => { setShow(false); if ( !(await deleteDialog('Are you sure you want to delete this integration?')) ) { return; } const res = await fetch(`/third-party/${id}`, { method: 'DELETE', }); if (res.ok) { toaster.show('Integration deleted successfully', 'success'); reload(); } else { const error = await res.json(); console.error('Error deleting integration:', error); } }; return (