Skip to content

Commit 07c1717

Browse files
committed
refactor: replace EditSecretDialog with UpdateWebhookSecretDialog for enhanced secret management
- Replaced the EditSecretDialog component with the new UpdateWebhookSecretDialog to improve the user experience when updating webhook secrets. - Updated the WebhookRowActions to reflect this change, ensuring consistent functionality across the application. - Introduced a new dialog that provides better feedback and validation for secret updates, enhancing usability. These changes aim to streamline the process of managing webhook secrets and improve user interaction with the dialogs.
1 parent d6af1ae commit 07c1717

3 files changed

Lines changed: 8 additions & 15 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ import { useDashboard } from '../../context'
3434
import { UserAvatar } from '../../shared'
3535
import { WEBHOOK_EVENT_LABELS } from './constants'
3636
import { DeleteWebhookDialog } from './delete-webhook-dialog'
37-
import { EditSecretDialog } from './edit-secret-dialog'
3837
import type { Webhook } from './types'
38+
import { UpdateWebhookSecretDialog } from './update-webhook-secret-dialog'
3939
import { UpsertWebhookDialog } from './upsert-webhook-dialog'
4040

4141
type WebhookRowProps = {
@@ -174,11 +174,11 @@ const WebhookRowActions = ({ webhook }: WebhookRowActionsProps) => {
174174
Delete
175175
</DropdownMenuItem>
176176
</DeleteWebhookDialog>
177-
<EditSecretDialog webhook={webhook}>
177+
<UpdateWebhookSecretDialog webhook={webhook}>
178178
<DropdownMenuItem inset onSelect={(e) => e.preventDefault()}>
179179
<PrivateIcon className={actionIconClassName} /> Edit secret
180180
</DropdownMenuItem>
181-
</EditSecretDialog>
181+
</UpdateWebhookSecretDialog>
182182
</DropdownMenuGroup>
183183
</DropdownMenuContent>
184184
</DropdownMenu>

src/features/dashboard/settings/webhooks/edit-secret-dialog.tsx renamed to src/features/dashboard/settings/webhooks/update-webhook-secret-dialog.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ import { Input } from '@/ui/primitives/input'
3737
import { Loader } from '@/ui/primitives/loader'
3838
import type { Webhook } from './types'
3939

40-
interface EditSecretDialogProps {
40+
interface UpdateWebhookSecretDialogProps {
4141
children: React.ReactNode
4242
webhook: Webhook
4343
}
4444

45-
export const EditSecretDialog = ({
45+
export const UpdateWebhookSecretDialog = ({
4646
children: trigger,
4747
webhook,
48-
}: EditSecretDialogProps) => {
48+
}: UpdateWebhookSecretDialogProps) => {
4949
'use no memo'
5050

5151
const { team } = useDashboard()
@@ -74,9 +74,7 @@ export const EditSecretDialog = ({
7474
handleDialogChange(false)
7575
},
7676
onError: (err) => {
77-
toast(
78-
defaultErrorToast(err.message || 'Failed to edit webhook secret')
79-
)
77+
toast(defaultErrorToast(err.message || 'Failed to edit webhook secret'))
8078
},
8179
})
8280
)

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

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

134134
const handleDialogChange = (value: boolean) => {
135-
if (
136-
!value &&
137-
isUpdateMode &&
138-
hasChanges &&
139-
!upsertMutation.isPending
140-
) {
135+
if (!value && isUpdateMode && hasChanges && !upsertMutation.isPending) {
141136
setDiscardConfirmOpen(true)
142137
return
143138
}

0 commit comments

Comments
 (0)