@@ -12,7 +12,7 @@ import {
1212} from "@/components/forms/form-card" ;
1313import { useTRPC } from "@/lib/trpc/client" ;
1414import { zodResolver } from "@hookform/resolvers/zod" ;
15- import { StatuspageIcon } from "@openstatus/icons" ;
15+ import { InstatusIcon , StatuspageIcon } from "@openstatus/icons" ;
1616import type { ImportSummary } from "@openstatus/importers/types" ;
1717import { Badge } from "@openstatus/ui/components/ui/badge" ;
1818import { Button } from "@openstatus/ui/components/ui/button" ;
@@ -40,9 +40,10 @@ import { toast } from "sonner";
4040import { z } from "zod" ;
4141
4242const schema = z . object ( {
43- provider : z . enum ( [ "statuspage" ] ) ,
43+ provider : z . enum ( [ "statuspage" , "instatus" ] ) ,
4444 apiKey : z . string ( ) . min ( 1 , "API key is required" ) ,
4545 statuspagePageId : z . string ( ) . optional ( ) ,
46+ instatusPageId : z . string ( ) . optional ( ) ,
4647 includeStatusReports : z . boolean ( ) ,
4748 includeSubscribers : z . boolean ( ) ,
4849 includeComponents : z . boolean ( ) ,
@@ -75,6 +76,7 @@ export function FormImport({
7576 provider : undefined ,
7677 apiKey : "" ,
7778 statuspagePageId : "" ,
79+ instatusPageId : "" ,
7880 includeStatusReports : true ,
7981 includeSubscribers : false ,
8082 includeComponents : true ,
@@ -85,6 +87,7 @@ export function FormImport({
8587 const watchProvider = form . watch ( "provider" ) ;
8688 const watchApiKey = form . watch ( "apiKey" ) ;
8789 const watchStatuspagePageId = form . watch ( "statuspagePageId" ) ;
90+ const watchInstatusPageId = form . watch ( "instatusPageId" ) ;
8891
8992 const previewMutation = useMutation (
9093 trpc . import . preview . mutationOptions ( {
@@ -105,9 +108,16 @@ export function FormImport({
105108 return ;
106109 }
107110 previewMutation . mutate ( {
108- provider : "statuspage" ,
111+ provider : watchProvider ,
109112 apiKey : watchApiKey ,
110- statuspagePageId : watchStatuspagePageId || undefined ,
113+ statuspagePageId :
114+ watchProvider === "statuspage"
115+ ? watchStatuspagePageId || undefined
116+ : undefined ,
117+ instatusPageId :
118+ watchProvider === "instatus"
119+ ? watchInstatusPageId || undefined
120+ : undefined ,
111121 pageId,
112122 } ) ;
113123 }
@@ -178,6 +188,21 @@ export function FormImport({
178188 Atlassian Statuspage
179189 </ FormLabel >
180190 </ FormItem >
191+ < FormItem className = "relative flex cursor-pointer flex-row items-center gap-3 rounded-md border border-input px-2 py-3 text-center shadow-xs outline-none transition-[color,box-shadow] has-data-[state=checked]:border-primary/50 has-focus-visible:border-ring has-focus-visible:ring-[3px] has-focus-visible:ring-ring/50" >
192+ < FormControl >
193+ < RadioGroupItem
194+ value = "instatus"
195+ className = "sr-only"
196+ />
197+ </ FormControl >
198+ < InstatusIcon
199+ className = "size-4 shrink-0 text-foreground"
200+ aria-hidden = "true"
201+ />
202+ < FormLabel className = "cursor-pointer font-medium text-foreground text-xs leading-none after:absolute after:inset-0" >
203+ Instatus
204+ </ FormLabel >
205+ </ FormItem >
181206 < div className = "col-span-1 self-end text-muted-foreground text-xs sm:place-self-end" >
182207 Missing a provider?{ " " }
183208 < a href = "mailto:ping@openstatus.dev" > Contact us</ a >
@@ -202,34 +227,59 @@ export function FormImport({
202227 < FormControl >
203228 < Input
204229 type = "password"
205- placeholder = "OAuth API key"
230+ placeholder = {
231+ watchProvider === "instatus"
232+ ? "Bearer API key"
233+ : "OAuth API key"
234+ }
206235 { ...field }
207236 />
208237 </ FormControl >
209238 < FormMessage />
210239 < FormDescription >
211- Your Statuspage API key. Found in your Statuspage
212- account under Manage Account > API.
213- </ FormDescription >
214- </ FormItem >
215- ) }
216- />
217- < FormField
218- control = { form . control }
219- name = "statuspagePageId"
220- render = { ( { field } ) => (
221- < FormItem >
222- < FormLabel > Page ID (optional)</ FormLabel >
223- < FormControl >
224- < Input placeholder = "e.g. abc123def456" { ...field } />
225- </ FormControl >
226- < FormDescription >
227- Import a specific page. Leave empty to import across
228- pages.
240+ { watchProvider === "instatus"
241+ ? "Your Instatus API key. Found in your Instatus account under Settings > API."
242+ : "Your Statuspage API key. Found in your Statuspage account under Manage Account > API." }
229243 </ FormDescription >
230244 </ FormItem >
231245 ) }
232246 />
247+ { watchProvider === "statuspage" ? (
248+ < FormField
249+ control = { form . control }
250+ name = "statuspagePageId"
251+ render = { ( { field } ) => (
252+ < FormItem >
253+ < FormLabel > Page ID (optional)</ FormLabel >
254+ < FormControl >
255+ < Input placeholder = "e.g. abc123def456" { ...field } />
256+ </ FormControl >
257+ < FormDescription >
258+ Import a specific page. Leave empty to import across
259+ pages.
260+ </ FormDescription >
261+ </ FormItem >
262+ ) }
263+ />
264+ ) : null }
265+ { watchProvider === "instatus" ? (
266+ < FormField
267+ control = { form . control }
268+ name = "instatusPageId"
269+ render = { ( { field } ) => (
270+ < FormItem >
271+ < FormLabel > Page ID (optional)</ FormLabel >
272+ < FormControl >
273+ < Input placeholder = "e.g. clx1abc2def3" { ...field } />
274+ </ FormControl >
275+ < FormDescription >
276+ Import a specific page. Leave empty to import the
277+ first page.
278+ </ FormDescription >
279+ </ FormItem >
280+ ) }
281+ />
282+ ) : null }
233283 < Button
234284 type = "button"
235285 variant = "secondary"
0 commit comments