-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add confirmation on webhook save
- Loading branch information
1 parent
0cbad1b
commit 5a8fa84
Showing
8 changed files
with
110 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { $path } from "remix-routes"; | ||
|
||
import { Webhook } from "~/lib/model/webhooks"; | ||
|
||
import { TypographyP } from "~/components/Typography"; | ||
import { CopyText } from "~/components/composed/CopyText"; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogDescription, | ||
DialogFooter, | ||
DialogHeader, | ||
DialogTitle, | ||
} from "~/components/ui/dialog"; | ||
import { Link } from "~/components/ui/link"; | ||
|
||
export type WebhookConfirmationProps = { | ||
webhook: Webhook; | ||
token?: string; | ||
secret: string; | ||
type?: "github"; | ||
}; | ||
|
||
export const WebhookConfirmation = ({ | ||
webhook, | ||
token: _token, | ||
secret, | ||
type: _ = "github", | ||
}: WebhookConfirmationProps) => { | ||
return ( | ||
<Dialog open> | ||
<DialogContent className="max-w-[700px]"> | ||
<DialogHeader> | ||
<DialogTitle>Webhook Saved</DialogTitle> | ||
</DialogHeader> | ||
|
||
<DialogDescription> | ||
Your webhook has been saved in Otto. Make sure to copy | ||
payload url and secret to your webhook provider. | ||
</DialogDescription> | ||
|
||
<DialogDescription> | ||
This information will not be shown again. | ||
</DialogDescription> | ||
|
||
<div className="flex items-center justify-between"> | ||
<TypographyP>Payload URL: </TypographyP> | ||
<CopyText | ||
text={webhook.links?.invoke ?? ""} | ||
className="min-w-fit" | ||
/> | ||
</div> | ||
|
||
<div className="flex items-center justify-between"> | ||
<TypographyP>Secret: </TypographyP> | ||
<CopyText | ||
className="min-w-fit" | ||
displayText={secret} | ||
text={secret ?? ""} | ||
/> | ||
</div> | ||
|
||
<DialogFooter> | ||
<Link | ||
as="button" | ||
className="w-full" | ||
to={$path("/webhooks")} | ||
> | ||
Continue | ||
</Link> | ||
</DialogFooter> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
export type Metadata = Record<string, string>; | ||
export type MetaLinks = Record<string, string>; | ||
|
||
export type EntityMeta< | ||
TMetadata extends Record<string, string> = Record<string, string>, | ||
TMetadata extends Metadata = Metadata, | ||
TLinks extends MetaLinks = MetaLinks, | ||
> = { | ||
created: string; | ||
deleted?: string; // date | ||
id: string; | ||
links: Record<string, string>; | ||
links?: TLinks; | ||
metadata?: TMetadata; | ||
type?: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
import { useNavigate } from "@remix-run/react"; | ||
import { $path } from "remix-routes"; | ||
|
||
import { WebhookForm } from "~/components/webhooks/WebhookForm"; | ||
|
||
export default function CreateWebhookPage() { | ||
const navigate = useNavigate(); | ||
|
||
return <WebhookForm onSuccess={() => navigate($path("/webhooks"))} />; | ||
return <WebhookForm />; | ||
} |