1- import { BookOpenIcon } from "@heroicons/react/24/solid" ;
21import { Form } from "@remix-run/react" ;
3- import { ActionFunctionArgs , type LoaderFunctionArgs } from "@remix-run/server-runtime" ;
2+ import { type ActionFunctionArgs , type LoaderFunctionArgs } from "@remix-run/server-runtime" ;
43import { tryCatch } from "@trigger.dev/core" ;
4+ import { useState } from "react" ;
55import { typedjson , useTypedLoaderData } from "remix-typedjson" ;
66import { z } from "zod" ;
77import { CloudProviderIcon } from "~/assets/icons/CloudProviderIcon" ;
88import { FlagIcon } from "~/assets/icons/RegionIcons" ;
99import { cloudProviderTitle } from "~/components/CloudProvider" ;
1010import { V4Title } from "~/components/V4Badge" ;
1111import { AdminDebugTooltip } from "~/components/admin/debugTooltip" ;
12- import { InlineCode } from "~/components/code/InlineCode" ;
1312import { MainCenteredContainer , PageBody , PageContainer } from "~/components/layout/AppLayout" ;
1413import { Badge } from "~/components/primitives/Badge" ;
15- import { Button , LinkButton } from "~/components/primitives/Buttons" ;
14+ import { Button } from "~/components/primitives/Buttons" ;
1615import { ClipboardField } from "~/components/primitives/ClipboardField" ;
1716import { CopyableText } from "~/components/primitives/CopyableText" ;
17+ import {
18+ Dialog ,
19+ DialogContent ,
20+ DialogDescription ,
21+ DialogFooter ,
22+ DialogHeader ,
23+ DialogTitle ,
24+ DialogTrigger ,
25+ } from "~/components/primitives/Dialog" ;
1826import { NavBar , PageAccessories , PageTitle } from "~/components/primitives/PageHeader" ;
1927import { Paragraph } from "~/components/primitives/Paragraph" ;
20- import { PopoverMenuItem } from "~/components/primitives/Popover" ;
2128import * as Property from "~/components/primitives/PropertyTable" ;
2229import {
2330 Table ,
@@ -30,12 +37,9 @@ import {
3037 TableRow ,
3138} from "~/components/primitives/Table" ;
3239import { TextLink } from "~/components/primitives/TextLink" ;
33- import { useOrganization } from "~/hooks/useOrganizations" ;
34- import { useProject } from "~/hooks/useProject" ;
3540import { redirectWithErrorMessage , redirectWithSuccessMessage } from "~/models/message.server" ;
3641import { findProjectBySlug } from "~/models/project.server" ;
37- import { RegionsPresenter } from "~/presenters/v3/RegionsPresenter.server" ;
38- import { logger } from "~/services/logger.server" ;
42+ import { type Region , RegionsPresenter } from "~/presenters/v3/RegionsPresenter.server" ;
3943import { requireUserId } from "~/services/session.server" ;
4044import {
4145 docsPath ,
@@ -132,14 +136,6 @@ export default function Page() {
132136 ) ) }
133137 </ Property . Table >
134138 </ AdminDebugTooltip >
135-
136- < LinkButton
137- variant = { "docs/small" }
138- LeadingIcon = { BookOpenIcon }
139- to = { docsPath ( "deployment/preview-branches" ) }
140- >
141- Regions docs
142- </ LinkButton >
143139 </ PageAccessories >
144140 </ NavBar >
145141 < PageBody scrollable = { false } >
@@ -232,16 +228,7 @@ export default function Page() {
232228 Default
233229 </ Badge >
234230 ) : (
235- < Form method = "post" >
236- < Button
237- variant = "secondary/small"
238- type = "submit"
239- name = "regionId"
240- value = { region . id }
241- >
242- Set as default...
243- </ Button >
244- </ Form >
231+ < SetDefaultDialog region = { region } />
245232 )
246233 }
247234 />
@@ -259,3 +246,37 @@ export default function Page() {
259246 </ PageContainer >
260247 ) ;
261248}
249+
250+ function SetDefaultDialog ( { region } : { region : Region } ) {
251+ const [ isOpen , setIsOpen ] = useState ( false ) ;
252+
253+ return (
254+ < Dialog open = { isOpen } onOpenChange = { setIsOpen } >
255+ < DialogTrigger asChild >
256+ < Button variant = "secondary/small" > Set as default...</ Button >
257+ </ DialogTrigger >
258+ < DialogContent >
259+ < DialogHeader >
260+ < DialogTitle > Set as default</ DialogTitle >
261+ </ DialogHeader >
262+ < DialogDescription >
263+ < Paragraph >
264+ When you trigger a run it will execute in your default region, unless you{ " " }
265+ < TextLink to = { docsPath ( "triggering#region" ) } > specify a region when triggering</ TextLink >
266+ .
267+ </ Paragraph >
268+ </ DialogDescription >
269+ < DialogFooter >
270+ < Button variant = "secondary/small" onClick = { ( ) => setIsOpen ( false ) } >
271+ Cancel
272+ </ Button >
273+ < Form method = "post" >
274+ < Button variant = "secondary/small" type = "submit" name = "regionId" value = { region . id } >
275+ Set as default
276+ </ Button >
277+ </ Form >
278+ </ DialogFooter >
279+ </ DialogContent >
280+ </ Dialog >
281+ ) ;
282+ }
0 commit comments