refactor: migrate webhooks page to coss/ui components (#27714)

* chore: pull coss ui

* refactor: migrate webhooks page to coss/ui components

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

* refactor: migrate CreateNewWebhookButton to coss/ui Menu components

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

* refactor: adjust CreateNewWebhookButton variant and align based on context

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

* feat(coss-ui): add list-item components and refactor WebhookListItem to use them

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

* refactor(webhooks): match prototype – remove docs link, flatten list, show user in item

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

* update css vars

* refactor(webhooks): migrate WebhookForm.tsx to coss-ui components

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

* fix(webhooks): add FormProvider for useFormContext in child components

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

* restore prev form

* swap form components

* mc

* use coss button everywhere

* fix ts errors

* refactor(webhooks): replace SettingsHeaderWithBackButton with coss-ui CardFrame in edit/new views

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

* refactor(webhooks): split into two CardFrames with Card/CardPanel

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

* refactor(webhooks): wrap WebhookTestDisclosure in Card/CardPanel

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

* refactor(webhooks): migrate WebhookTestDisclosure to coss-ui CardFrame

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

* mc

* mc

* refactor(webhooks): update skeletons to use coss-ui CardFrame pattern

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

* mc

* refactor(webhooks): improve new webhook skeleton to match actual UI layout

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

* imrpove form skeleton

* optimise card header

* refactor: improve base ui react-hook-form compatibility

* update string

* use coss ui alert dialog

* use coss toast

* feat(webhooks): add user filter to webhooks list

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

* fix(webhooks): resolve lint warnings in filter component

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

* refactor(webhooks): filter after new button, icon+badge only

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

* improve switch

* remove unneeded toast

* refactor(webhooks): enhance WebhooksFilter component with anchor reference

* mc

* fix(webhooks): update Switch component to use checked prop instead of defaultChecked

* fix(webhooks): prevent Suspense boundary error on webhook edit save

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

* fix(webhooks): add optimistic state for Switch toggle in WebhookListItem

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

* fix(webhooks): disable switch during pending mutation to prevent rapid-toggle race

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

* fix(webhooks): guard toggle with isPending check instead of disabled prop

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

* fix toggle

* mc

* mc

* fix(webhooks): navigate before revalidation to prevent Suspense re-suspension

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

* mc

* fix(webhooks): use render prop for Cancel button navigation

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

* fix(webhooks): simplify Cancel button with explicit conditional rendering

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

* fix(webhooks): sort list by id to prevent resorting on toggle

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

* mc

* mc

* show filter only if user is >1

* refactor(webhooks): move ListItem components to shared directory

* feat: reintroduce avatars

* remove unneeded translations

* remove unneeded useMemo

* add clickable +n badge

* mc

* mc

* add tooltips and docs link

* animated tooltips

* refactor(WebhookForm): replace hardcoded text with translation keys for better localization

* refactor(WebhookListItem): manage active state with useEffect and improve toggle error handling

* mc

* update toast position + re-pull coss ui components

* refactor: rename onEditWebhook to onEditWebhookAction to prevent warnings

* feat: enhance WebhookListItem with edit link and mobile support

* mc

* remove unneded component

* refactor: simplify webhook toggle logic in WebhookListItem component

* fix: update edit link logic in WebhookListItem and add editHref to webhooks-view

* wip

* feat: implement webhook version selection in WebhookForm

* update list item

* fix issue with delete button perrmission

* sort webhooks by ID in WebhooksList component

* mc

* refactor: enhance Webhook components with improved header and skeleton loading logic

* refactor: rename files for clarity

* display the edit button

* re-pull coss ui components

* fix ts error

* refactor: simplify permission checks in WebhookListItem component

* improve skeletons

* fix ts errors

* rename onEditWebhook

* fix: update SheetContent variant in ActiveUserBreakdown component

* fix e2e

* feat: add data-testid attribute to confirmation button in DeleteWebhookDialog

* remove unnecessary file

* refactor: allow passing the aria-label attribute to the button that removes a chip

* refactor: rename onEditWebhook to onEditWebhookAction to prevent warnings

* refactor: add webhook version select to event-type dialog and extract shared WebhookVersionCTA component

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

* fix: restore toast notification on webhook toggle in event-types tab

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

* implement the coss ui dialog

* refactor(webhooks): use shared WebhookListItem in event type tab and coss-ui Dialog

* remove unneeded lastItem prop

* re-pull coss ui components

* Merge remote-tracking branch 'origin/main' into style/improve-webhooks

Co-Authored-By: unknown <>

* refactor: extract AppHeader component and move page title outside CardFrame

Co-Authored-By: unknown <>

* refactor: show user header for every webhook group and remove CardFrame wrapper

Co-Authored-By: unknown <>

* fix: wrap each user webhook group in CardFrame with CardFrameHeader

Co-Authored-By: unknown <>

* fix: add dashed border to Empty state matching coss prototype

Co-Authored-By: unknown <>

* mc

* fix: only show New button in header when webhooks exist

Co-Authored-By: unknown <>

* refactor: move page title/description/back button out of CardFrame on new/edit webhook pages

Co-Authored-By: unknown <>

* refactor: render webhook form header outside flex-col gap wrapper

Co-Authored-By: unknown <>

* refactor: move header outside div wrapper in webhook form skeleton

Co-Authored-By: unknown <>

* mc

* skeleton improvements

* refactor: move AppHeader component to @coss/ui/shared/app-header

Co-Authored-By: unknown <>

* fix the webhook dialog on event-types settings

* make the webhook clickable for event types

* remove hardcoded string

---------

Co-authored-by: pasqualevitiello <[email protected]>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-03-04 12:56:15 +00:00
1 parent 3f2e122295
commit 9a08d2e46c
29 files changed
+1735 -1174

No files matched your search

+5 -1
View File
@@ -10,7 +10,8 @@
"./icons": "./src/icons.tsx",
"./lib/*": "./src/lib/*.ts",
"./components/*": "./src/components/*.tsx",
"./hooks/*": "./src/hooks/*.ts"
"./hooks/*": "./src/hooks/*.ts",
"./shared/*": "./src/shared/*.tsx"
},
"typesVersions": {
"*": {
@@ -25,6 +26,9 @@
],
"hooks/*": [
"./src/hooks/*.ts"
],
"shared/*": [
"./src/shared/*.tsx"
]
}
},
@@ -0,0 +1,29 @@
import { cn } from "@coss/ui/lib/utils";
function AppHeader({ className, ...props }: React.ComponentProps<"header">) {
return <header className={cn("mb-6 mt-2 flex items-center md:items-start justify-between gap-4", className)} {...props} />;
}
function AppHeaderContent({
children,
className,
title,
...props
}: React.ComponentProps<"div"> & { title: string }) {
return (
<div className={cn("flex flex-col gap-1", className)} {...props}>
<h1 className="font-heading font-semibold text-lg leading-none">{title}</h1>
{children}
</div>
);
}
function AppHeaderDescription({ className, ...props }: React.ComponentProps<"p">) {
return <p className={cn("text-muted-foreground text-sm max-md:hidden", className)} {...props} />;
}
function AppHeaderActions({ className, ...props }: React.ComponentProps<"div">) {
return <div className={cn("flex items-center gap-2", className)} {...props} />;
}
export { AppHeader, AppHeaderActions, AppHeaderContent, AppHeaderDescription };
+111
View File
@@ -0,0 +1,111 @@
import { cn } from "@coss/ui/lib/utils";
import type { ReactNode } from "react";
import Link from "next/link";
interface ListItemProps extends React.HTMLAttributes<HTMLDivElement> {
children: ReactNode;
className?: string;
}
function ListItem({ children, className, ...props }: ListItemProps) {
return (
<div
{...props}
className={cn(
"not-last:border-b bg-clip-padding transition-[background-color] first:rounded-t-[calc(var(--radius-xl)+1px)] last:rounded-b-[calc(var(--radius-xl)+1px)] has-[[data-slot=list-item-title]_a:hover]:z-1 has-[[data-slot=list-item-title]_a:hover]:bg-[color-mix(in_srgb,var(--card),var(--color-black)_2%)] dark:has-[[data-slot=list-item-title]_a:hover]:bg-[color-mix(in_srgb,var(--card),var(--color-white)_2%)]",
className
)}
data-slot="list-item">
<div className="relative flex items-center justify-between gap-4 px-6 py-4">{children}</div>
</div>
);
}
interface ListItemContentProps {
children: ReactNode;
className?: string;
}
function ListItemContent({ children, className }: ListItemContentProps) {
return <div className={cn("flex min-w-0 flex-1 flex-col gap-3", className)}>{children}</div>;
}
interface ListItemHeaderProps {
children: ReactNode;
className?: string;
}
function ListItemHeader({ children, className }: ListItemHeaderProps) {
return <div className={cn("flex flex-col gap-1", className)}>{children}</div>;
}
interface ListItemTitleProps {
children: ReactNode;
className?: string;
}
function ListItemTitle({ children, className }: ListItemTitleProps) {
return (
<h2 className={cn("font-semibold sm:text-sm", className)} data-slot="list-item-title">
{children}
</h2>
);
}
function ListItemTitleLink({ children, className, href }: ListItemTitleProps & { href: string }) {
return (
<Link className={cn("before:absolute before:inset-0", className)} data-slot="list-item-title-link" href={href}>
{children}
</Link>
);
}
interface ListItemDescriptionProps {
children: ReactNode;
className?: string;
}
function ListItemDescription({ children, className }: ListItemDescriptionProps) {
return (
<p className={cn("text-muted-foreground text-sm", className)} data-slot="list-item-description">
{children}
</p>
);
}
interface ListItemBadgesProps {
children: ReactNode;
className?: string;
}
function ListItemBadges({ children, className }: ListItemBadgesProps) {
return (
<div className={cn("flex flex-wrap items-center gap-2", className)} data-slot="list-item-badges">
{children}
</div>
);
}
interface ListItemActionsProps {
children: ReactNode;
className?: string;
}
function ListItemActions({ children, className }: ListItemActionsProps) {
return (
<div className={cn("relative flex items-center gap-4", className)} data-slot="list-item-actions">
{children}
</div>
);
}
export {
ListItem,
ListItemActions,
ListItemBadges,
ListItemContent,
ListItemDescription,
ListItemHeader,
ListItemTitle,
ListItemTitleLink,
};
+54 -46
View File
@@ -66,23 +66,23 @@
:root {
--radius: 0.625rem;
--background: var(--color-white);
--foreground: var(--color-zinc-800);
--foreground: var(--color-neutral-800);
--card: var(--color-white);
--card-foreground: var(--color-zinc-800);
--card-foreground: var(--color-neutral-800);
--popover: var(--color-white);
--popover-foreground: var(--color-zinc-800);
--primary: var(--color-zinc-800);
--primary-foreground: var(--color-zinc-50);
--popover-foreground: var(--color-neutral-800);
--primary: var(--color-neutral-800);
--primary-foreground: var(--color-neutral-50);
--secondary: --alpha(var(--color-black) / 4%);
--secondary-foreground: var(--color-zinc-800);
--secondary-foreground: var(--color-neutral-800);
--muted: --alpha(var(--color-black) / 4%);
--muted-foreground: color-mix(
in srgb,
var(--color-zinc-500) 90%,
var(--color-neutral-500) 90%,
var(--color-black)
);
--accent: --alpha(var(--color-black) / 4%);
--accent-foreground: var(--color-zinc-800);
--accent-foreground: var(--color-neutral-800);
--destructive: var(--color-red-500);
--destructive-foreground: var(--color-red-700);
--info: var(--color-blue-500);
@@ -91,26 +91,26 @@
--success-foreground: var(--color-emerald-700);
--warning: var(--color-amber-500);
--warning-foreground: var(--color-amber-700);
--border: --alpha(var(--color-black) / 12%);
--input: --alpha(var(--color-black) / 12%);
--ring: var(--color-zinc-400);
--border: --alpha(var(--color-black) / 8%);
--input: --alpha(var(--color-black) / 10%);
--ring: var(--color-neutral-400);
--chart-1: var(--color-orange-600);
--chart-2: var(--color-teal-600);
--chart-3: var(--color-cyan-900);
--chart-4: var(--color-amber-400);
--chart-5: var(--color-amber-500);
--sidebar: var(--color-zinc-50);
--sidebar: var(--color-neutral-50);
--sidebar-foreground: color-mix(
in srgb,
var(--color-zinc-800) 64%,
var(--color-neutral-800) 64%,
var(--sidebar)
);
--sidebar-primary: var(--color-zinc-800);
--sidebar-primary-foreground: var(--color-zinc-50);
--sidebar-primary: var(--color-neutral-800);
--sidebar-primary-foreground: var(--color-neutral-50);
--sidebar-accent: --alpha(var(--color-black) / 4%);
--sidebar-accent-foreground: var(--color-zinc-800);
--sidebar-border: --alpha(var(--color-black) / 12%);
--sidebar-ring: var(--color-zinc-400);
--sidebar-accent-foreground: var(--color-neutral-800);
--sidebar-border: --alpha(var(--color-black) / 6%);
--sidebar-ring: var(--color-neutral-400);
--code: var(--color-white);
--code-foreground: var(--foreground);
--code-highlight: --alpha(var(--color-black) / 4%);
@@ -119,27 +119,31 @@
.dark {
--background: color-mix(
in srgb,
var(--color-zinc-950) 98%,
var(--color-neutral-950) 96%,
var(--color-white)
);
--foreground: var(--color-zinc-200);
--foreground: var(--color-neutral-100);
--card: color-mix(in srgb, var(--background) 98%, var(--color-white));
--card-foreground: var(--color-zinc-200);
--card-foreground: var(--color-neutral-100);
--popover: color-mix(in srgb, var(--background) 96%, var(--color-white));
--popover-foreground: var(--color-zinc-200);
--primary: var(--color-zinc-200);
--primary-foreground: var(--color-zinc-800);
--secondary: --alpha(var(--color-white) / 6%);
--secondary-foreground: var(--color-zinc-200);
--muted: --alpha(var(--color-white) / 6%);
--popover-foreground: var(--color-neutral-100);
--primary: var(--color-neutral-100);
--primary-foreground: var(--color-neutral-800);
--secondary: --alpha(var(--color-white) / 4%);
--secondary-foreground: var(--color-neutral-100);
--muted: --alpha(var(--color-white) / 4%);
--muted-foreground: color-mix(
in srgb,
var(--color-zinc-500) 90%,
var(--color-neutral-500) 90%,
var(--color-white)
);
--accent: --alpha(var(--color-white) / 4%);
--accent-foreground: var(--color-neutral-100);
--destructive: color-mix(
in srgb,
var(--color-red-500) 90%,
var(--color-white)
);
--accent: --alpha(var(--color-white) / 6%);
--accent-foreground: var(--color-zinc-200);
--destructive: var(--color-red-500);
--destructive-foreground: var(--color-red-400);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-400);
@@ -147,29 +151,33 @@
--success-foreground: var(--color-emerald-400);
--warning: var(--color-amber-500);
--warning-foreground: var(--color-amber-400);
--border: --alpha(var(--color-white) / 12%);
--input: --alpha(var(--color-white) / 12%);
--ring: var(--color-zinc-500);
--border: --alpha(var(--color-white) / 6%);
--input: --alpha(var(--color-white) / 8%);
--ring: var(--color-neutral-500);
--chart-1: var(--color-blue-700);
--chart-2: var(--color-emerald-500);
--chart-3: var(--color-amber-500);
--chart-4: var(--color-purple-500);
--chart-5: var(--color-rose-500);
--sidebar: var(--color-zinc-950);
--sidebar: color-mix(
in srgb,
var(--color-neutral-950) 97%,
var(--color-white)
);
--sidebar-foreground: color-mix(
in srgb,
var(--color-zinc-200) 64%,
var(--color-neutral-100) 64%,
var(--sidebar)
);
--sidebar-primary: var(--color-zinc-200);
--sidebar-primary-foreground: var(--color-zinc-800);
--sidebar-accent: --alpha(var(--color-white) / 6%);
--sidebar-accent-foreground: var(--color-zinc-200);
--sidebar-border: --alpha(var(--color-white) / 12%);
--sidebar-ring: var(--color-zinc-400);
--code: color-mix(in srgb, var(--background) 96%, var(--color-white));
--sidebar-primary: var(--color-neutral-100);
--sidebar-primary-foreground: var(--color-neutral-800);
--sidebar-accent: --alpha(var(--color-white) / 4%);
--sidebar-accent-foreground: var(--color-neutral-100);
--sidebar-border: --alpha(var(--color-white) / 5%);
--sidebar-ring: var(--color-neutral-400);
--code: color-mix(in srgb, var(--background) 98%, var(--color-white));
--code-foreground: var(--foreground);
--code-highlight: --alpha(var(--color-white) / 6%);
--code-highlight: --alpha(var(--color-white) / 4%);
}
@layer base {
@@ -179,5 +187,5 @@
}
.backdrop-blur-sm {
@apply backdrop-blur-none bg-neutral-800/70;
}
@apply backdrop-blur-none bg-black/70;
}
+1
View File
@@ -2127,6 +2127,7 @@
"triggers_when": "Triggers when",
"test_webhook": "Please ping test before creating.",
"enable_webhook": "Enable webhook",
"disable_webhook": "Disable webhook",
"add_webhook": "Add webhook",
"webhook_edited_successfully": "Webhook saved",
"api_keys_description": "Generate API keys for accessing your own account",