Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
feat: add changelog (#359)
Maximilian Kaske530900c9aca6
diff --git a/apps/web/contentlayer.config.ts b/apps/web/contentlayer.config.tsindex e34c9ee2d..f1f468797 100644--- a/apps/web/contentlayer.config.ts+++ b/apps/web/contentlayer.config.ts@@ -2,6 +2,7 @@ import { makeSource } from "contentlayer/source-files";import rehypeSlug from "rehype-slug";import remarkGfm from "remark-gfm";+import { Changelog } from "./src/contentlayer/documents/changelog";import { LegalPost } from "./src/contentlayer/documents/legal";import { Post } from "./src/contentlayer/documents/post";import autolinkHeadings from "./src/contentlayer/plugins/autolink-headings";@@ -9,7 +10,7 @@ import prettyCode from "./src/contentlayer/plugins/pretty-code";export default makeSource({contentDirPath: "src/content/",- documentTypes: [Post, LegalPost],+ documentTypes: [Post, LegalPost, Changelog],mdx: {remarkPlugins: [remarkGfm],rehypePlugins: [rehypeSlug, prettyCode, autolinkHeadings],diff --git a/apps/web/public/assets/changelog/status-widget.png b/apps/web/public/assets/changelog/status-widget.pngnew file mode 100644index 000000000..d0f37f2c2Binary files /dev/null and b/apps/web/public/assets/changelog/status-widget.png differdiff --git a/apps/web/src/app/(content)/blog/[slug]/page.tsx b/apps/web/src/app/(content)/blog/[slug]/page.tsxnew file mode 100644index 000000000..7a40b42ef--- /dev/null+++ b/apps/web/src/app/(content)/blog/[slug]/page.tsx@@ -0,0 +1,76 @@+import type { Metadata } from "next";+import { notFound } from "next/navigation";+import { allPosts } from "contentlayer/generated";++import {+ defaultMetadata,+ ogMetadata,+ twitterMetadata,+} from "@/app/shared-metadata";+import { Article } from "@/components/content/article";+import { Shell } from "@/components/dashboard/shell";+import { BackButton } from "@/components/layout/back-button";++export const dynamic = "force-static";++export async function generateStaticParams() {+ return allPosts.map((post) => ({+ slug: post.slug,+ }));+}++export async function generateMetadata({+ params,+}: {+ params: { slug: string };+}): Promise<Metadata | void> {+ const post = allPosts.find((post) => post.slug === params.slug);+ if (!post) {+ return;+ }+ const { title, publishedAt: publishedTime, description, slug, image } = post;++ return {+ ...defaultMetadata,+ title,+ description,+ openGraph: {+ ...ogMetadata,+ title,+ description,+ type: "article",+ publishedTime,+ url: `https://www.openstatus.dev/blog/${slug}`,+ images: [+ {+ url: `https://openstatus.dev/api/og/post?title=${title}&description=${description}&image=${image}`,+ },+ ],+ },+ twitter: {+ ...twitterMetadata,+ title,+ description,+ images: [+ `https://openstatus.dev/api/og/post?title=${title}&description=${description}&image=${image}`,+ ],+ },+ };+}++export default function PostPage({ params }: { params: { slug: string } }) {+ const post = allPosts.find((post) => post.slug === params.slug);++ if (!post) {+ notFound();+ }++ return (+ <>+ <BackButton href="/blog" />+ <Shell className="sm:py-8 md:py-12">+ <Article post={post} />+ </Shell>+ </>+ );+}diff --git a/apps/web/src/app/(content)/blog/page.tsx b/apps/web/src/app/(content)/blog/page.tsxnew file mode 100644index 000000000..325c4cf7a--- /dev/null+++ b/apps/web/src/app/(content)/blog/page.tsx@@ -0,0 +1,24 @@+import { allPosts } from "contentlayer/generated";++import { Thumbnail } from "@/components/content/thumbnail";+import { Shell } from "@/components/dashboard/shell";++export default async function Post() {+ const posts = allPosts.sort(+ (a, b) =>+ new Date(b.publishedAt).getTime() - new Date(a.publishedAt).getTime(),+ );++ return (+ <Shell>+ <div className="grid gap-8">+ <h1 className="text-foreground font-cal text-4xl">Blog</h1>+ <div className="space-y-4">+ {posts.map((post) => (+ <Thumbnail key={post._id} post={post} />+ ))}+ </div>+ </div>+ </Shell>+ );+}diff --git a/apps/web/src/app/(content)/changelog/page.tsx b/apps/web/src/app/(content)/changelog/page.tsxnew file mode 100644index 000000000..af1edf230--- /dev/null+++ b/apps/web/src/app/(content)/changelog/page.tsx@@ -0,0 +1,53 @@+import Image from "next/image";+import { allChangelogs } from "contentlayer/generated";++import { Mdx } from "@/components/content/mdx";+import { Shell } from "@/components/dashboard/shell";+import { formatDate } from "@/lib/utils";++export default async function Post() {+ const posts = allChangelogs.sort(+ (a, b) =>+ new Date(b.publishedAt).getTime() - new Date(a.publishedAt).getTime(),+ );++ return (+ <Shell>+ <div className="grid gap-8">+ <div className="grid gap-4 md:grid-cols-5 md:gap-8">+ <div className="md:col-span-1" />+ <div className="grid gap-4 md:col-span-4">+ <h1 className="text-foreground font-cal text-4xl">Changelog</h1>+ <p className="text-muted-foreground">+ All the latest features, fixes and work to OpenStatus.+ </p>+ </div>+ </div>+ {posts.map((post) => (+ <article+ key={post.slug}+ className="grid gap-4 md:grid-cols-5 md:gap-6"+ >+ <time className="text-muted-foreground order-2 font-mono text-sm md:order-1 md:col-span-1">+ {formatDate(new Date(post.publishedAt))}+ </time>+ <div className="relative order-1 h-64 w-full md:order-2 md:col-span-4">+ <Image+ src={post.image}+ fill={true}+ alt={post.title}+ className="border-border rounded-md border object-cover"+ />+ </div>+ <h3 className="text-foreground font-cal order-3 text-2xl md:col-span-4 md:col-start-2">+ {post.title}+ </h3>+ <div className="order-4 md:col-span-4 md:col-start-2">+ <Mdx code={post.body.code} />+ </div>+ </article>+ ))}+ </div>+ </Shell>+ );+}diff --git a/apps/web/src/app/blog/layout.tsx b/apps/web/src/app/(content)/layout.tsxsimilarity index 100%rename from apps/web/src/app/blog/layout.tsxrename to apps/web/src/app/(content)/layout.tsxdiff --git a/apps/web/src/app/blog/[slug]/page.tsx b/apps/web/src/app/blog/[slug]/page.tsxdeleted file mode 100644index e508f0edf..000000000--- a/apps/web/src/app/blog/[slug]/page.tsx+++ /dev/null@@ -1,130 +0,0 @@-import type { Metadata } from "next";-import Link from "next/link";-import { notFound } from "next/navigation";-import { allPosts } from "contentlayer/generated";--import { Avatar, AvatarFallback, AvatarImage } from "@openstatus/ui";--import {- defaultMetadata,- ogMetadata,- twitterMetadata,-} from "@/app/shared-metadata";-import { Mdx } from "@/components/content/mdx";-import { Shell } from "@/components/dashboard/shell";-import { BackButton } from "@/components/layout/back-button";-import { formatDate } from "@/lib/utils";--export const dynamic = "force-static";--export async function generateStaticParams() {- return allPosts.map((post) => ({- slug: post.slug,- }));-}--export async function generateMetadata({- params,-}: {- params: { slug: string };-}): Promise<Metadata | void> {- const post = allPosts.find((post) => post.slug === params.slug);- if (!post) {- return;- }- const { title, publishedAt: publishedTime, description, slug, image } = post;-- return {- ...defaultMetadata,- title,- description,- openGraph: {- ...ogMetadata,- title,- description,- type: "article",- publishedTime,- url: `https://www.openstatus.dev/blog/${slug}`,- images: [- {- url: `https://openstatus.dev/api/og/post?title=${title}&description=${description}&image=${image}`,- },- ],- },- twitter: {- ...twitterMetadata,- title,- description,- images: [- `https://openstatus.dev/api/og/post?title=${title}&description=${description}&image=${image}`,- ],- },- };-}--export default function PostPage({ params }: { params: { slug: string } }) {- const post = allPosts.find((post) => post.slug === params.slug);-- if (!post) {- notFound();- }-- const getNameInitials = (name: string) => {- const individualNames = name.split(" ");- return (- individualNames[0][0] + individualNames[individualNames.length - 1][0]- );- };-- return (- <>- <BackButton href="/blog" />- <Shell className="sm:py-8 md:py-12">- <article className="grid gap-8">- <div className="mx-auto grid w-full max-w-prose gap-3">- <h1 className="font-cal mb-5 text-3xl">{post.title}</h1>- <div className="border-border relative h-64 w-full overflow-hidden rounded-lg border">- {/* <Image- src={post.image}- fill={true}- alt={post.title}- className="object-cover"- /> */}- {/* HOTFIX: plain `img` */}- <img- src={post.image}- alt={post.title}- className="h-full w-full object-cover"- />- </div>- <div className="flex items-center gap-3">- <Avatar>- <AvatarImage src={post.author.avatar} />- <AvatarFallback>- {getNameInitials(post.author.name)}- </AvatarFallback>- </Avatar>- <div className="text-muted-foreground text-sm font-light">- <Link- href={post.author.url ?? "#"}- target="_blank"- className="cursor-pointer font-medium text-black hover:underline"- >- {post.author.name}- </Link>- <p>- {formatDate(new Date(post.publishedAt))}- <span className="text-muted-foreground/70 mx-1">•</span>- {post.readingTime}- </p>- </div>- </div>- </div>- <div className="prose-pre:overflow-y-auto prose-pre:max-w-xs md:prose-pre:max-w-none mx-auto max-w-prose ">- <Mdx code={post.body.code} />- </div>- </article>- </Shell>- </>- );-}diff --git a/apps/web/src/app/blog/page.tsx b/apps/web/src/app/blog/page.tsxdeleted file mode 100644index e9e29b7f3..000000000--- a/apps/web/src/app/blog/page.tsx+++ /dev/null@@ -1,45 +0,0 @@-import Link from "next/link";-import { allPosts } from "contentlayer/generated";--import { Shell } from "@/components/dashboard/shell";-import { formatDate } from "@/lib/utils";--export default async function Post() {- const posts = allPosts.sort(- (a, b) =>- new Date(b.publishedAt).getTime() - new Date(a.publishedAt).getTime(),- );-- return (- <Shell>- <div className="grid gap-8">- <h1 className="text-foreground font-cal text-4xl">Blog</h1>- <div className="space-y-4">- {posts.map((post) => (- <div key={post.slug}>- <Link href={`/blog/${post.slug}`}>- <section>- <p className="text-foreground font-cal text-2xl">- {post.title}- </p>- <p className="text-muted-foreground">{post.description}</p>- <p className="text-muted-foreground mt-1 text-xs">- {post.author.name}- <span className="text-muted-foreground/70 mx-1">- •- </span>- {formatDate(new Date(post.publishedAt))}- <span className="text-muted-foreground/70 mx-1">- •- </span>- {post.readingTime}- </p>- </section>- </Link>- </div>- ))}- </div>- </div>- </Shell>- );-}diff --git a/apps/web/src/components/content/article.tsx b/apps/web/src/components/content/article.tsxnew file mode 100644index 000000000..b1cb68a0b--- /dev/null+++ b/apps/web/src/components/content/article.tsx@@ -0,0 +1,62 @@+import Image from "next/image";+import Link from "next/link";+import type { Post } from "contentlayer/generated";++import { Avatar, AvatarFallback, AvatarImage } from "@openstatus/ui";++import { Mdx } from "@/components/content/mdx";+import { formatDate } from "@/lib/utils";++export function Article({ post }: { post: Post }) {+ const getNameInitials = (name: string) => {+ const individualNames = name.split(" ");+ return (+ individualNames[0][0] + individualNames[individualNames.length - 1][0]+ );+ };++ return (+ <article className="grid gap-8">+ <div className="mx-auto grid w-full max-w-prose gap-3">+ <h1 className="font-cal mb-5 text-3xl">{post.title}</h1>+ <div className="border-border relative h-64 w-full overflow-hidden rounded-lg border">+ <Image+ src={post.image}+ fill={true}+ alt={post.title}+ className="object-cover"+ />+ {/* HOTFIX: plain `img` */}+ {/* <img+ src={post.image}+ alt={post.title}+ className="h-full w-full object-cover"+ /> */}+ </div>+ <div className="flex items-center gap-3">+ <Avatar>+ <AvatarImage src={post.author.avatar} />+ <AvatarFallback>{getNameInitials(post.author.name)}</AvatarFallback>+ </Avatar>+ <div className="text-muted-foreground text-sm font-light">+ <Link+ href={post.author.url ?? "#"}+ target="_blank"+ className="cursor-pointer font-medium text-black hover:underline"+ >+ {post.author.name}+ </Link>+ <p>+ {formatDate(new Date(post.publishedAt))}+ <span className="text-muted-foreground/70 mx-1">•</span>+ {post.readingTime}+ </p>+ </div>+ </div>+ </div>+ <div className="prose-pre:overflow-y-auto prose-pre:max-w-xs md:prose-pre:max-w-none mx-auto max-w-prose ">+ <Mdx code={post.body.code} />+ </div>+ </article>+ );+}diff --git a/apps/web/src/components/content/thumbnail.tsx b/apps/web/src/components/content/thumbnail.tsxnew file mode 100644index 000000000..ab275abac--- /dev/null+++ b/apps/web/src/components/content/thumbnail.tsx@@ -0,0 +1,24 @@+import Link from "next/link";+import type { Post } from "contentlayer/generated";++import { formatDate } from "@/lib/utils";++export function Thumbnail({ post }: { post: Post }) {+ return (+ <div key={post.slug}>+ <Link href={`/blog/${post.slug}`}>+ <section>+ <p className="text-foreground font-cal text-2xl">{post.title}</p>+ <p className="text-muted-foreground">{post.description}</p>+ <p className="text-muted-foreground mt-1 text-xs">+ {post.author.name}+ <span className="text-muted-foreground/70 mx-1">•</span>+ {formatDate(new Date(post.publishedAt))}+ <span className="text-muted-foreground/70 mx-1">•</span>+ {post.readingTime}+ </p>+ </section>+ </Link>+ </div>+ );+}diff --git a/apps/web/src/components/layout/marketing-footer.tsx b/apps/web/src/components/layout/marketing-footer.tsxindex 8bc6f3688..ebe4d29d6 100644--- a/apps/web/src/components/layout/marketing-footer.tsx+++ b/apps/web/src/components/layout/marketing-footer.tsx@@ -14,23 +14,23 @@ export function MarketingFooter({ className }: Props) {<footer className={cn("w-full", className)}><Shell className="grid gap-6"><div className="grid grid-cols-2 gap-6 md:grid-cols-4">- <div>+ <div className="order-4 md:order-1"><StatusWidget slug="status" /></div>- <div className="flex flex-col gap-3 text-sm">+ <div className="order-1 flex flex-col gap-3 text-sm md:order-2"><p className="text-foreground font-semibold">Community</p><FooterLink href="/github" label="GitHub" external /><FooterLink href="/discord" label="Discord" external /><FooterLink href="https://twitter.com/openstatusHQ" label="X" /></div>- <div className="flex flex-col gap-3 text-sm">+ <div className="order-2 flex flex-col gap-3 text-sm md:order-3"><p className="text-foreground font-semibold">Resources</p>- <FooterLink href="https://status.openstatus.dev" label="Status" /><FooterLink href="/blog" label="Blog" />+ <FooterLink href="/changelog" label="Changelog" /><FooterLink href="https://docs.openstatus.dev" label="Docs" /><FooterLink href="/oss-friends" label="OSS Friends" /></div>- <div className="flex flex-col gap-3 text-sm">+ <div className="order-3 flex flex-col gap-3 text-sm md:order-4"><p className="text-foreground font-semibold">Legal</p><FooterLink href="/legal/terms" label="Terms" /><FooterLink href="/legal/privacy" label="Privacy" />diff --git a/apps/web/src/components/layout/marketing-header.tsx b/apps/web/src/components/layout/marketing-header.tsxindex 99aff17ea..3b15000b3 100644--- a/apps/web/src/components/layout/marketing-header.tsx+++ b/apps/web/src/components/layout/marketing-header.tsx@@ -8,6 +8,7 @@ import { Button } from "@openstatus/ui";import { cn } from "@/lib/utils";import { BrandName } from "./brand-name";+import { MarketingMenu } from "./marketing-menu";interface Props {className?: string;@@ -18,22 +19,29 @@ export function MarketingHeader({ className }: Props) {return (<header- className={cn(- "flex w-full items-center justify-between gap-2",- className,- )}+ className={cn("grid w-full grid-cols-2 gap-2 md:grid-cols-5", className)}>- <BrandName />- <div className="flex items-center md:gap-3">+ <div className="flex items-center md:col-span-1">+ <BrandName />+ </div>+ <div className="hidden items-center justify-center md:col-span-3 md:flex md:gap-3">+ <Button variant="link" asChild className="md:mr-3">+ <Link href="/blog">Blog</Link>+ </Button>+ <Button variant="link" asChild className="md:mr-3">+ <Link href="/changelog">Changelog</Link>+ </Button><Button variant="link" asChild className="md:mr-3"><Link href="https://docs.openstatus.dev" target="_blank">Docs<ArrowUpRight className="ml-1 h-4 w-4 flex-shrink-0" /></Link></Button>- <Button variant="link" asChild className="md:mr-3">- <Link href="/blog">Blog</Link>- </Button>+ </div>+ <div className="flex items-center justify-end gap-3 md:col-span-1">+ <div className="block md:hidden">+ <MarketingMenu />+ </div><Button asChild className="rounded-full">{isSignedIn ? (<Link href="/app">Dashboard</Link>diff --git a/apps/web/src/components/layout/marketing-menu.tsx b/apps/web/src/components/layout/marketing-menu.tsxnew file mode 100644index 000000000..7f50b0bf5--- /dev/null+++ b/apps/web/src/components/layout/marketing-menu.tsx@@ -0,0 +1,66 @@+"use client";++import * as React from "react";+import Link from "next/link";+import { usePathname, useSearchParams } from "next/navigation";+import { Menu } from "lucide-react";++import {+ Button,+ Sheet,+ SheetContent,+ SheetHeader,+ SheetTitle,+ SheetTrigger,+} from "@openstatus/ui";++import { cn } from "@/lib/utils";++const pages = [+ { href: "/changelog", title: "Changelog" },+ { href: "/blog", title: "Blog" },+ { href: "https://docs.openstatus.dev", title: "Docs" },+];++export function MarketingMenu() {+ const [open, setOpen] = React.useState(false);+ const pathname = usePathname();+ const searchParams = useSearchParams();++ React.useEffect(() => {+ setOpen(false);+ }, [pathname, searchParams]); // remove searchParams if not needed++ return (+ <Sheet open={open} onOpenChange={(value) => setOpen(value)}>+ <SheetTrigger asChild>+ <Button size="icon" variant="outline" className="rounded-full">+ <Menu className="h-6 w-6" />+ </Button>+ </SheetTrigger>+ <SheetContent>+ <SheetHeader>+ <SheetTitle className="text-left">Navigation</SheetTitle>+ </SheetHeader>+ <ul className="mt-4 grid gap-1">+ {pages.map(({ href, title }) => {+ const isActive = pathname?.startsWith(href);+ return (+ <li key="title" className="w-full">+ <Link+ href={href}+ className={cn(+ "hover:bg-muted/50 hover:text-foreground text-muted-foreground group flex w-full min-w-[200px] items-center rounded-md border border-transparent px-3 py-1",+ isActive && "bg-muted/50 border-border text-foreground",+ )}+ >+ {title}+ </Link>+ </li>+ );+ })}+ </ul>+ </SheetContent>+ </Sheet>+ );+}diff --git a/apps/web/src/content/changelog/status-widget.mdx b/apps/web/src/content/changelog/status-widget.mdxnew file mode 100644index 000000000..ff5e7ca04--- /dev/null+++ b/apps/web/src/content/changelog/status-widget.mdx@@ -0,0 +1,15 @@+---+title: Status Widget+publishedAt: 2023-10-05+image: /assets/changelog/status-widget.png+---++You can now access the status of your status page via a public api endpoint.+This allows you to build your own custom status widget with your unique `:slug`.++```+$ curl https://api.openstatus.dev/public/status/:slug+```++You can find the documentation+[here](https://docs.openstatus.dev/api-server/status-widget).diff --git a/apps/web/src/contentlayer/documents/changelog.ts b/apps/web/src/contentlayer/documents/changelog.tsnew file mode 100644index 000000000..4e7ab28e9--- /dev/null+++ b/apps/web/src/contentlayer/documents/changelog.ts@@ -0,0 +1,29 @@+import { defineDocumentType } from "contentlayer/source-files";+import readingTime from "reading-time";++export const Changelog = defineDocumentType(() => ({+ name: "Changelog",+ contentType: "mdx",+ filePathPattern: "changelog/*.mdx",+ fields: {+ title: {+ type: "string",+ required: true,+ },+ image: {+ type: "string",+ required: true,+ },+ publishedAt: { type: "date", required: true },+ },+ computedFields: {+ slug: {+ type: "string",+ resolve: (post) => post._raw.sourceFileName.replace(/\.mdx$/, ""),+ },+ readingTime: {+ type: "string",+ resolve: (post) => readingTime(post.body.raw).text,+ },+ },+}));diff --git a/apps/web/src/middleware.ts b/apps/web/src/middleware.tsindex af1496493..c5871fc46 100644--- a/apps/web/src/middleware.ts+++ b/apps/web/src/middleware.ts@@ -72,6 +72,7 @@ export default authMiddleware({"/api/checker/cron/10m","/blog","/blog/(.*)",+ "/changelog","/legal/(.*)","/discord","/github",