diff --git a/apps/web/src/app/status/page.tsx b/apps/web/src/app/status/page.tsx new file mode 100644 index 00000000..bdfcfcee --- /dev/null +++ b/apps/web/src/app/status/page.tsx @@ -0,0 +1,74 @@ +import Link from "next/link"; +import { z } from "zod"; + +import { + Card, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "@openstatus/ui"; + +import { Icons } from "@/components/icons"; +import { MarketingLayout } from "@/components/layout/marketing-layout"; +import { env } from "@/env"; + +const ExternalStatus = z.object({ + id: z.number(), + name: z.string(), + url: z.string(), + external_id: z.string(), + last_updated_at: z.string().datetime({ offset: true }), + time_zone: z.string(), + status_indicator: z.string(), + status_description: z.string(), + created_at: z.string(), + updated_at: z.string().datetime(), +}); + +const ExternalStatusPage = async () => { + console.log(env.EXTERNAL_API_URL); + const res = await fetch(env.EXTERNAL_API_URL); + const data = await res.json(); + const openSourceFriends = z.array(ExternalStatus).parse(data); + + return ( + +

+ Is my external service down? +

+
+ Easily check if your external providers is working properly +
+
+ {openSourceFriends.map((status) => ( + + +
+ + + {status.name} + + +
+ {status.status_description} +
+ +
+ + + +
+
+
+ ))} +
+
+ ); +}; + +export default ExternalStatusPage; diff --git a/apps/web/src/components/layout/marketing-footer.tsx b/apps/web/src/components/layout/marketing-footer.tsx index fb622b2b..9da8f0db 100644 --- a/apps/web/src/components/layout/marketing-footer.tsx +++ b/apps/web/src/components/layout/marketing-footer.tsx @@ -29,6 +29,7 @@ export function MarketingFooter({ className }: Props) { +

Legal

diff --git a/apps/web/src/env.ts b/apps/web/src/env.ts index 28d639db..390931f7 100644 --- a/apps/web/src/env.ts +++ b/apps/web/src/env.ts @@ -22,6 +22,7 @@ export const env = createEnv({ GCP_CLIENT_EMAIL: z.string(), GCP_PRIVATE_KEY: z.string(), CRON_SECRET: z.string(), + EXTERNAL_API_URL: z.string().url(), }, client: { NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().min(1), @@ -61,5 +62,6 @@ export const env = createEnv({ GCP_CLIENT_EMAIL: process.env.GCP_CLIENT_EMAIL, GCP_PRIVATE_KEY: process.env.GCP_PRIVATE_KEY, CRON_SECRET: process.env.CRON_SECRET, + EXTERNAL_API_URL: process.env.EXTERNAL_API_URL, }, }); diff --git a/apps/web/src/middleware.ts b/apps/web/src/middleware.ts index 4eaa5941..b169067c 100644 --- a/apps/web/src/middleware.ts +++ b/apps/web/src/middleware.ts @@ -72,6 +72,8 @@ export default authMiddleware({ "/api/checker/cron/10m", "/blog", "/blog/(.*)", + "/status", + "/status/(.*)", "/changelog", "/changelog/(.*)", "/legal/(.*)",