mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
3d09a69d58
* fix: eslint fixes --------- Co-authored-by: gurusainath <gurusainath007@gmail.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { FC } from "react";
|
|
import Link from "next/link";
|
|
import { useRouter } from "next/router";
|
|
// hooks
|
|
import { ToggleSwitch } from "@plane/ui";
|
|
import { useWebhook } from "hooks/store";
|
|
// ui
|
|
// types
|
|
import { IWebhook } from "@plane/types";
|
|
|
|
interface IWebhookListItem {
|
|
webhook: IWebhook;
|
|
}
|
|
|
|
export const WebhooksListItem: FC<IWebhookListItem> = (props) => {
|
|
const { webhook } = props;
|
|
// router
|
|
const router = useRouter();
|
|
const { workspaceSlug } = router.query;
|
|
// store hooks
|
|
const { updateWebhook } = useWebhook();
|
|
|
|
const handleToggle = () => {
|
|
if (!workspaceSlug || !webhook.id) return;
|
|
|
|
updateWebhook(workspaceSlug.toString(), webhook.id, { is_active: !webhook.is_active });
|
|
};
|
|
|
|
return (
|
|
<div className="border-b border-custom-border-200">
|
|
<Link href={`/${workspaceSlug}/settings/webhooks/${webhook?.id}`}>
|
|
<span className="flex items-center justify-between gap-4 px-3.5 py-[18px]">
|
|
<h5 className="truncate text-base font-medium">{webhook.url}</h5>
|
|
<ToggleSwitch value={webhook.is_active} onChange={handleToggle} />
|
|
</span>
|
|
</Link>
|
|
</div>
|
|
);
|
|
};
|