Skip to content

Commit 9494a15

Browse files
committed
refactor: enhance webhook dialogs and table layout for improved usability
- Updated the DiscardWebhookChangesDialog to include a size property for the Stay button, enhancing its appearance. - Refined the rowCellClassName in WebhookTableRow to improve styling consistency. - Adjusted headerCellClassName in WebhooksTable to ensure proper padding and alignment. - Modified UpsertWebhookDialog to handle dialog state changes more accurately, preventing accidental discards when in update mode. These changes aim to enhance the user experience and maintainability of the webhook management interface.
1 parent 3fdf280 commit 9494a15

4 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/features/dashboard/settings/webhooks/discard-webhook-changes-dialog.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ export const DiscardWebhookChangesDialog = ({
3434
</DialogDescription>
3535
</DialogHeader>
3636
<DialogFooter className="shrink-0 gap-5 sm:gap-5">
37-
<Button variant="quaternary" onClick={() => onOpenChange(false)}>
37+
<Button
38+
variant="quaternary"
39+
size="none"
40+
onClick={() => onOpenChange(false)}
41+
>
3842
Stay
3943
</Button>
4044
<Button variant="primary" onClick={onDiscard}>

src/features/dashboard/settings/webhooks/table-row.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const WebhookNameAndUrl = ({ name, url }: WebhookNameAndUrlProps) => {
102102
)
103103
}
104104

105-
const rowCellClassName = 'p-0 py-1.5 align-middle'
105+
const rowCellClassName = 'p-0 py-1.5 align-middle [tr:first-child>&]:pt-0'
106106
const rowContentClassName = 'flex items-center'
107107
const actionIconClassName = 'size-4 text-fg-tertiary'
108108

src/features/dashboard/settings/webhooks/table.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ interface WebhooksTableProps {
1818
}
1919

2020
const headerCellClassName =
21-
'h-[17px] p-0 align-top font-sans! text-[12px] leading-[17px] text-left font-normal text-fg-tertiary uppercase'
21+
'h-[17px] p-0 pb-2 align-top font-sans! text-[12px] leading-[17px] text-left font-normal text-fg-tertiary uppercase'
2222

2323
export const WebhooksTable = ({
2424
webhooks,
@@ -41,8 +41,8 @@ export const WebhooksTable = ({
4141
<TableHeader className="border-b-0">
4242
<TableRow className="border-0">
4343
<TableHead className={headerCellClassName}>NAME & URL</TableHead>
44-
<TableHead className={cn(headerCellClassName)}>EVENTS</TableHead>
45-
<TableHead className={cn(headerCellClassName)}>ADDED</TableHead>
44+
<TableHead className={headerCellClassName}>EVENTS</TableHead>
45+
<TableHead className={headerCellClassName}>ADDED</TableHead>
4646
<TableHead className={headerCellClassName}>
4747
<span className="sr-only">Actions</span>
4848
</TableHead>

src/features/dashboard/settings/webhooks/upsert-webhook-dialog.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ export function UpsertWebhookDialog({
132132
}
133133

134134
const handleDialogChange = (value: boolean) => {
135-
if (!value && hasChanges && !upsertMutation.isPending) {
135+
if (
136+
!value &&
137+
isUpdateMode &&
138+
hasChanges &&
139+
!upsertMutation.isPending
140+
) {
136141
setDiscardConfirmOpen(true)
137142
return
138143
}
@@ -171,7 +176,7 @@ export function UpsertWebhookDialog({
171176
selectedEvents.length !== webhook.events.length ||
172177
[...selectedEvents].sort().join('|') !==
173178
[...webhook.events].sort().join('|')
174-
: true
179+
: false
175180

176181
const { errors } = form.formState
177182

0 commit comments

Comments
 (0)