···11-import { Alert, AlertDescription, AlertTitle } from "@openstatus/ui";
22-import { Megaphone } from "lucide-react";
33-import Link from "next/link";
44-55-export function ReportInfoBanner() {
66- return (
77- <Alert className="max-w-4xl">
88- <Megaphone className="h-4 w-4" />
99- <AlertTitle>Looking for Status Reports?</AlertTitle>
1010- <AlertDescription>
1111- The incidents will be created automatically if an endpoint fails. If you
1212- want to inform your users about a planned maintenance, or a current
1313- issue you can create a status report. Go to{" "}
1414- <Link
1515- className="underline underline-offset-4 hover:text-primary hover:no-underline"
1616- href="./status-pages"
1717- >
1818- Status Pages
1919- </Link>{" "}
2020- and select a page you want to report on.
2121- </AlertDescription>
2222- </Alert>
2323- );
2424-}
···11-"use client";
22-33-import { useEffect } from "react";
44-55-/**
66- * ISSUE: using the `middleware` to add a server httpOnly cookie doesn't work
77- * req.nextUrl.pathname.startsWith("/app") is not true on the server as we are using the /api/trpc endpoint
88- * to mutate our database. For some reasons, querying the database works fine.
99- */
1010-1111-export function WorkspaceClientCookie({
1212- workspaceSlug,
1313-}: {
1414- workspaceSlug: string;
1515-}) {
1616- useEffect(() => {
1717- if (document) {
1818- document.cookie = `workspace-slug=${workspaceSlug}; path=/`;
1919- }
2020- }, [workspaceSlug]);
2121- return null;
2222-}
···11-import { SessionProvider } from "next-auth/react";
22-33-import { Bubble } from "@/components/support/bubble";
44-import { auth } from "@/lib/auth";
55-import { IdentifyComponent } from "@openpanel/nextjs";
66-77-export default async function AuthLayout({
88- children, // will be a page or nested layout
99-}: {
1010- children: React.ReactNode;
1111-}) {
1212- const session = await auth();
1313- return (
1414- <SessionProvider session={session}>
1515- {children}
1616- <Bubble />
1717- {session?.user?.id && (
1818- <IdentifyComponent profileId={`usr_${session?.user?.id}`} />
1919- )}
2020- </SessionProvider>
2121- );
2222-}
-15
apps/web/src/app/(pages)/app/onboarding/page.tsx
···11-import { auth } from "@/lib/auth";
22-import { api } from "@/trpc/server";
33-import { redirect } from "next/navigation";
44-55-export default async function OnboardingPage() {
66- const session = await auth();
77-88- if (!session) redirect("/app/login");
99-1010- const workspace = await api.workspace.getWorkspace.query();
1111-1212- if (!workspace) redirect("/app/login");
1313-1414- return redirect(`/app/${workspace.slug}/onboarding`);
1515-}
-55
apps/web/src/app/(pages)/app/page.tsx
···11-"use client";
22-33-import { useRouter } from "next/navigation";
44-55-import { Shell } from "@/components/dashboard/shell";
66-import { AppHeader } from "@/components/layout/header/app-header";
77-import { LoadingAnimation } from "@/components/loading-animation";
88-99-// TODO: discuss how to make that page a bit more enjoyable
1010-export default function Page() {
1111- const router = useRouter();
1212-1313- // waiting for the workspace to be created
1414- setTimeout(() => router.refresh(), 1000);
1515-1616- return (
1717- <div className="container relative mx-auto flex min-h-screen w-full flex-col items-center justify-center gap-6 p-4 lg:p-8">
1818- <AppHeader />
1919- <div className="flex w-full flex-1 gap-6 lg:gap-8">
2020- <main className="z-10 flex w-full flex-1 flex-col items-start justify-center">
2121- <Shell className="relative flex flex-1 flex-col items-center justify-center">
2222- <div className="grid gap-4">
2323- <div className="text-center">
2424- <p className="mb-1 font-cal text-3xl">Creating Workspace</p>
2525- <p className="mb-5 text-muted-foreground text-xl">
2626- Should be done in a second.
2727- </p>
2828- <p className="text-muted-foreground">
2929- If you are stuck for longer, please contact us via{" "}
3030- <a
3131- href="https://openstatus.dev/discord"
3232- target="_blank"
3333- className="text-foreground underline underline-offset-4 hover:no-underline"
3434- rel="noreferrer"
3535- >
3636- Discord
3737- </a>{" "}
3838- or{" "}
3939- <a
4040- href="mailto:thibault@openstatus.dev"
4141- className="text-foreground underline underline-offset-4 hover:no-underline"
4242- >
4343- Mail
4444- </a>
4545- .
4646- </p>
4747- </div>
4848- <LoadingAnimation variant="inverse" size="lg" />
4949- </div>
5050- </Shell>
5151- </main>
5252- </div>
5353- </div>
5454- );
5555-}
-14
apps/web/src/app/api/ping/cold/route.ts
···11-import { NextResponse } from "next/server";
22-33-export const dynamic = "force-dynamic";
44-55-export const maxDuration = 30; // to trick and not using the same function as the other ping route
66-77-export async function GET() {
88- return NextResponse.json({ ping: "pong" }, { status: 200 });
99-}
1010-1111-export async function POST(req: Request) {
1212- const body = await req.json();
1313- return NextResponse.json({ ping: body }, { status: 200 });
1414-}
···11-import { NextResponse } from "next/server";
22-33-export const dynamic = "force-dynamic";
44-55-export const maxDuration = 25; // to trick and not using the same function as the other ping route
66-77-export async function GET() {
88- return NextResponse.json({ ping: "pong" }, { status: 200 });
99-}
1010-1111-export async function POST(req: Request) {
1212- const body = await req.json();
1313- return NextResponse.json({ ping: body }, { status: 200 });
1414-}
-14
apps/web/src/app/api/ping/test/route.ts
···11-import { NextResponse } from "next/server";
22-33-export const dynamic = "force-dynamic";
44-55-export const maxDuration = 31; // to trick and not using the same function as the other ping route
66-77-export async function GET() {
88- return NextResponse.json({ ping: "pong" }, { status: 200 });
99-}
1010-1111-export async function POST(req: Request) {
1212- const body = await req.json();
1313- return NextResponse.json({ ping: body }, { status: 200 });
1414-}
-14
apps/web/src/app/api/ping/vercel/route.ts
···11-import { NextResponse } from "next/server";
22-33-export const dynamic = "force-dynamic";
44-55-export const maxDuration = 42; // to trick and not using the same function as the other ping route
66-77-export async function GET() {
88- return NextResponse.json({ ping: "pong" }, { status: 200 });
99-}
1010-1111-export async function POST(req: Request) {
1212- const body = await req.json();
1313- return NextResponse.json({ ping: body }, { status: 200 });
1414-}
-13
apps/web/src/app/api/ping/warn/route.ts
···11-import { NextResponse } from "next/server";
22-33-export const dynamic = "force-dynamic";
44-export const maxDuration = 20; // to trick and not using the same function as the other ping route
55-66-export async function GET() {
77- return NextResponse.json({ ping: "pong" }, { status: 200 });
88-}
99-1010-export async function POST(req: Request) {
1111- const body = await req.json();
1212- return NextResponse.json({ ping: body }, { status: 200 });
1313-}