feat: apply Frame component to webhooks settings page (#27291)

* feat: apply Frame component to webhooks settings page

Co-Authored-By: [email protected] <[email protected]>

* refactor: include header and description in Frame component

Co-Authored-By: [email protected] <[email protected]>

* refactor: wrap each webhook in individual FramePanel

Co-Authored-By: [email protected] <[email protected]>

* refactor: implement two-row badge limit with overflow tooltip for webhooks

Co-Authored-By: [email protected] <[email protected]>

* style: improve spacing between webhook items and header

Co-Authored-By: [email protected] <[email protected]>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-01-27 14:48:33 +00:00
1 parent cb7960f571
commit 85f3cd6228
2 files changed
+62 -46

No files matched your search

@@ -1,17 +1,15 @@
"use client";
import { useRouter } from "next/navigation";
import { useBookerUrl } from "@calcom/features/bookings/hooks/useBookerUrl";
import SettingsHeader from "@calcom/features/settings/appDir/SettingsHeader";
import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import type { RouterOutputs } from "@calcom/trpc/react";
import classNames from "@calcom/ui/classNames";
import { Avatar } from "@calcom/ui/components/avatar";
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
import { WebhookListItem, CreateNewWebhookButton } from "../components";
import { Frame, FrameDescription, FrameHeader, FramePanel, FrameTitle } from "@coss/ui/components/frame";
import { useRouter } from "next/navigation";
import React from "react";
import { CreateNewWebhookButton, WebhookListItem } from "../components";
type WebhooksByViewer = RouterOutputs["viewer"]["webhook"]["getByViewer"];
@@ -36,17 +34,20 @@ const WebhooksList = ({ webhooksByViewer }: { webhooksByViewer: WebhooksByViewer
const hasTeams = profiles && profiles.length > 1;
return (
<SettingsHeader
title={t("webhooks")}
description={t("add_webhook_description", { appName: APP_NAME })}
CTA={<CreateNewWebhookButton />}
borderInShellHeader={true}>
{webhookGroups.length ? (
<Frame>
<FrameHeader className="mb-2 flex-row items-center justify-between">
<div>
<FrameTitle className="text-lg">{t("webhooks")}</FrameTitle>
<FrameDescription>{t("add_webhook_description", { appName: APP_NAME })}</FrameDescription>
</div>
<CreateNewWebhookButton />
</FrameHeader>
{webhookGroups.length ? (
<>
{webhookGroups.map((group) => (
<div key={group.teamId}>
<React.Fragment key={group.teamId}>
{hasTeams && (
<div className="items-centers flex">
<div className="mb-2 mt-4 flex items-center px-1">
<Avatar
alt={group.profile.image || ""}
imageSrc={group.profile.image || `${bookerUrl}/${group.profile.name}/avatar.png`}
@@ -58,37 +59,35 @@ const WebhooksList = ({ webhooksByViewer }: { webhooksByViewer: WebhooksByViewer
</div>
</div>
)}
<div className="flex flex-col" key={group.profile.slug}>
<div className={classNames("border-subtle mb-8 rounded-b-lg border border-t-0", hasTeams && "mt-3")}>
{group.webhooks.map((webhook, index) => (
<WebhookListItem
key={webhook.id}
webhook={webhook}
lastItem={group.webhooks.length === index + 1}
permissions={{
canEditWebhook: group?.metadata?.canModify ?? false,
canDeleteWebhook: group?.metadata?.canDelete ?? false,
}}
onEditWebhook={() =>
router.push(`${WEBAPP_URL}/settings/developer/webhooks/${webhook.id}`)
}
/>
))}
</div>
</div>
</div>
{group.webhooks.map((webhook) => (
<FramePanel key={webhook.id} className="mt-2">
<WebhookListItem
webhook={webhook}
lastItem={true}
permissions={{
canEditWebhook: group?.metadata?.canModify ?? false,
canDeleteWebhook: group?.metadata?.canDelete ?? false,
}}
onEditWebhook={() =>
router.push(`${WEBAPP_URL}/settings/developer/webhooks/${webhook.id}`)
}
/>
</FramePanel>
))}
</React.Fragment>
))}
</div>
</>
) : (
<EmptyScreen
Icon="link"
headline={t("create_your_first_webhook")}
description={t("create_your_first_webhook_description", { appName: APP_NAME })}
className="rounded-b-lg rounded-t-none border-t-0"
buttonRaw={<CreateNewWebhookButton />}
/>
<FramePanel>
<EmptyScreen
Icon="link"
headline={t("create_your_first_webhook")}
description={t("create_your_first_webhook_description", { appName: APP_NAME })}
buttonRaw={<CreateNewWebhookButton />}
/>
</FramePanel>
)}
</SettingsHeader>
</Frame>
);
};