Skip to content

Open-source status page, incident response and uptime monitoring

refactor: status-page ui blocks (#2130)

Maximilian Kaskeae63fa85af86
diff --git a/apps/dashboard/next-env.d.ts b/apps/dashboard/next-env.d.ts
index 9edff1c7c..c4b7818fb 100644
--- a/apps/dashboard/next-env.d.ts
+++ b/apps/dashboard/next-env.d.ts
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
-import "./.next/types/routes.d.ts";
+import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/apps/status-page/messages/de.json b/apps/status-page/messages/de.json
index eb93e0b56..99c10ac9d 100644
--- a/apps/status-page/messages/de.json
+++ b/apps/status-page/messages/de.json
@@ -1,8 +1,8 @@
{
"Y9HHck": "Authentifizieren",
"1QcGkA": "Geben Sie Ihre E-Mail-Adresse ein, um einen Magic Link für den Zugriff auf die Statusseite zu erhalten. Hinweis: Es werden nur E-Mails von genehmigten Domains akzeptiert.",
- "wSZR47": "Absenden",
"txkW56": "Wird gesendet...",
+ "wSZR47": "Absenden",
"OrFVks": "Überprüfen Sie Ihren Posteingang!",
"n36zhX": "Greifen Sie auf die Statusseite zu, indem Sie auf den Link in der E-Mail klicken.",
"qIAQSi": "Geschützte Seite",
@@ -78,56 +78,60 @@
"Pgb3Xj": "Abonniert",
"WOH7Yj": "Abonnement fehlgeschlagen",
"L7z2/k": "Diese Seite hat keine Komponenten zum Abonnieren.",
- "NOyDVq": "betrieben von",
- "tzMNF3": "Status",
- "ZvKSfJ": "Ereignisse",
- "xJrRMG": "Monitore",
- "tKMlOc": "Menü",
- "krEziQ": "Kontakt aufnehmen",
- "8kyEWd": "Ein Quantil stellt ein bestimmtes Perzentil in Ihrem Datensatz dar.",
- "kd0Igx": "Zum Beispiel ist p50 das 50. Perzentil — der Punkt, unter dem 50 % der Daten liegen. Höhere Perzentile umfassen mehr Daten und heben den oberen Bereich hervor.",
"BQBZU+": "Alle Systeme betriebsbereit",
+ "Dnob31": "Betriebsbereit",
"b9fOA1": "Eingeschränkte Leistung",
+ "VQDmmK": "Eingeschränkt",
"80EXUh": "Ausfall",
+ "JOZGPR": "Ausfall",
"dudqv/": "Wartung",
- "u++vY3": "Keine Berichte gefunden",
- "2HGztY": "Keine Berichte für diese Statusseite gefunden.",
- "50SA6J": "Keine öffentlichen Monitore",
- "FHrzf5": "Es wurden keine öffentlichen Monitore zu dieser Seite hinzugefügt.",
- "2syGZB": "Bericht gelöst",
- "heezSZ": "(in {duration})",
- "lKJjwW": "({timeFromLast} früher)",
+ "D3rOMr": "Keine Daten",
"W6nSYE": "Gelöst",
"1P6GMj": "Überwachung",
"7cv4Uf": "Identifiziert",
"/GKH/w": "Wird untersucht",
- "VaZnIX": "(für {duration})",
+ "myq2ZL": "Normal",
+ "KN7zKn": "Fehler",
+ "kkpP2k": "heute",
+ "2wsjxR": "laufend",
+ "2syGZB": "Bericht gelöst",
"FDReLp": "Keine aktuellen Benachrichtigungen",
"qDj0JR": "In den letzten 7 Tagen gab es keine Berichte.",
- "CYs0LF": "Ereignisverlauf anzeigen",
- "kkpP2k": "heute",
- "Dnob31": "Betriebsbereit",
- "VQDmmK": "Eingeschränkt",
- "JOZGPR": "Ausfall",
+ "u++vY3": "Keine Berichte gefunden",
+ "2HGztY": "Keine Berichte für diese Statusseite gefunden.",
+ "50SA6J": "Keine öffentlichen Monitore",
+ "FHrzf5": "Es wurden keine öffentlichen Monitore zu dieser Seite hinzugefügt.",
+ "3cc4Ct": "Hell",
+ "tOdNiY": "Dunkel",
+ "+CwN9C": "System",
+ "EQpyb8": "Design umschalten",
+ "uPb/gh": "Updates erhalten",
+ "8OoV56": "RSS-Feed abrufen",
+ "Auj/Ki": "Atom-Feed abrufen",
+ "SyYroX": "JSON-Updates abrufen",
+ "rptmhC": "Für Status-Updates in Slack fügen Sie den folgenden Text in einen beliebigen Kanal ein.",
+ "PSqtlY": "Status über SSH abrufen",
+ "NOyDVq": "betrieben von",
+ "krEziQ": "Kontakt aufnehmen",
"3Vaz8F": "Status-Tracker",
"apbxET": "Tag {n} Status",
"GbVCQb": "Erneut klicken zum Lösen",
- "myq2ZL": "Normal",
- "KN7zKn": "Fehler",
- "D3rOMr": "Keine Daten",
- "2wsjxR": "laufend",
+ "heezSZ": "(in {duration})",
+ "lKJjwW": "({timeFromLast} früher)",
+ "VaZnIX": "(für {duration})",
"jC7BY1": "über {duration}",
- "uPb/gh": "Updates erhalten",
+ "tzMNF3": "Status",
+ "ZvKSfJ": "Ereignisse",
+ "xJrRMG": "Monitore",
+ "tKMlOc": "Menü",
+ "8kyEWd": "Ein Quantil stellt ein bestimmtes Perzentil in Ihrem Datensatz dar.",
+ "kd0Igx": "Zum Beispiel ist p50 das 50. Perzentil — der Punkt, unter dem 50 % der Daten liegen. Höhere Perzentile umfassen mehr Daten und heben den oberen Bereich hervor.",
+ "CYs0LF": "Ereignisverlauf anzeigen",
"sjzDbu": "Slack",
"q0qMyV": "RSS",
"9y9QQh": "JSON",
"waUHa4": "SSH",
"cVqFq/": "Erhalten Sie E-Mail-Benachrichtigungen, wenn ein Bericht erstellt oder gelöst wird",
"gczcC5": "Abonnieren",
- "8OoV56": "RSS-Feed abrufen",
- "Auj/Ki": "Atom-Feed abrufen",
- "SyYroX": "JSON-Updates abrufen",
- "PSqtlY": "Status über SSH abrufen",
- "rptmhC": "Für Status-Updates in Slack fügen Sie den folgenden Text in einen beliebigen Kanal ein.",
"45YlLU": "Bestätigen Sie Ihre E-Mail-Adresse, um Updates zu erhalten, und schon sind Sie fertig."
}
diff --git a/apps/status-page/messages/en.json b/apps/status-page/messages/en.json
index ccb786d5c..c08b931ed 100644
--- a/apps/status-page/messages/en.json
+++ b/apps/status-page/messages/en.json
@@ -1,8 +1,8 @@
{
"Y9HHck": "Authenticate",
"1QcGkA": "Enter your email to receive a magic link for accessing the status page. Note: Only emails from approved domains are accepted.",
- "wSZR47": "Submit",
"txkW56": "Submitting...",
+ "wSZR47": "Submit",
"OrFVks": "Check your inbox!",
"n36zhX": "Access the status page by clicking the link in the email.",
"qIAQSi": "Protected Page",
@@ -78,56 +78,60 @@
"Pgb3Xj": "Subscribed",
"WOH7Yj": "Failed to subscribe",
"L7z2/k": "This page has no components to subscribe to.",
- "NOyDVq": "powered by",
- "tzMNF3": "Status",
- "ZvKSfJ": "Events",
- "xJrRMG": "Monitors",
- "tKMlOc": "Menu",
- "krEziQ": "Get in touch",
- "8kyEWd": "A quantile represents a specific percentile in your dataset.",
- "kd0Igx": "For example, p50 is the 50th percentile - the point below which 50% of data falls. Higher percentiles include more data and highlight the upper range.",
"BQBZU+": "All Systems Operational",
+ "Dnob31": "Operational",
"b9fOA1": "Degraded Performance",
+ "VQDmmK": "Degraded",
"80EXUh": "Downtime Performance",
+ "JOZGPR": "Downtime",
"dudqv/": "Maintenance",
- "u++vY3": "No reports found",
- "2HGztY": "No reports found for this status page.",
- "50SA6J": "No public monitors",
- "FHrzf5": "No public monitors have been added to this page.",
- "2syGZB": "Report resolved",
- "heezSZ": "(in {duration})",
- "lKJjwW": "({timeFromLast} earlier)",
+ "D3rOMr": "No Data",
"W6nSYE": "Resolved",
"1P6GMj": "Monitoring",
"7cv4Uf": "Identified",
"/GKH/w": "Investigating",
- "VaZnIX": "(for {duration})",
+ "myq2ZL": "Normal",
+ "KN7zKn": "Error",
+ "kkpP2k": "today",
+ "2wsjxR": "ongoing",
+ "2syGZB": "Report resolved",
"FDReLp": "No recent notifications",
"qDj0JR": "There have been no reports within the last 7 days.",
- "CYs0LF": "View events history",
- "kkpP2k": "today",
- "Dnob31": "Operational",
- "VQDmmK": "Degraded",
- "JOZGPR": "Downtime",
+ "u++vY3": "No reports found",
+ "2HGztY": "No reports found for this status page.",
+ "50SA6J": "No public monitors",
+ "FHrzf5": "No public monitors have been added to this page.",
+ "3cc4Ct": "Light",
+ "tOdNiY": "Dark",
+ "+CwN9C": "System",
+ "EQpyb8": "Toggle theme",
+ "uPb/gh": "Get updates",
+ "8OoV56": "Get the RSS feed",
+ "Auj/Ki": "Get the Atom feed",
+ "SyYroX": "Get the JSON updates",
+ "rptmhC": "For status updates in Slack, paste the text below into any channel.",
+ "PSqtlY": "Get status via SSH",
+ "NOyDVq": "powered by",
+ "krEziQ": "Get in touch",
"3Vaz8F": "Status tracker",
"apbxET": "Day {n} status",
"GbVCQb": "Click again to unpin",
- "myq2ZL": "Normal",
- "KN7zKn": "Error",
- "D3rOMr": "No Data",
- "2wsjxR": "ongoing",
+ "heezSZ": "(in {duration})",
+ "lKJjwW": "({timeFromLast} earlier)",
+ "VaZnIX": "(for {duration})",
"jC7BY1": "across {duration}",
- "uPb/gh": "Get updates",
+ "tzMNF3": "Status",
+ "ZvKSfJ": "Events",
+ "xJrRMG": "Monitors",
+ "tKMlOc": "Menu",
+ "8kyEWd": "A quantile represents a specific percentile in your dataset.",
+ "kd0Igx": "For example, p50 is the 50th percentile - the point below which 50% of data falls. Higher percentiles include more data and highlight the upper range.",
+ "CYs0LF": "View events history",
"sjzDbu": "Slack",
"q0qMyV": "RSS",
"9y9QQh": "JSON",
"waUHa4": "SSH",
"cVqFq/": "Get email notifications whenever a report has been created or resolved",
"gczcC5": "Subscribe",
- "8OoV56": "Get the RSS feed",
- "Auj/Ki": "Get the Atom feed",
- "SyYroX": "Get the JSON updates",
- "PSqtlY": "Get status via SSH",
- "rptmhC": "For status updates in Slack, paste the text below into any channel.",
"45YlLU": "Validate your email to receive updates and you are all set."
}
diff --git a/apps/status-page/messages/fr.json b/apps/status-page/messages/fr.json
index 09627f407..dbc67d8c9 100644
--- a/apps/status-page/messages/fr.json
+++ b/apps/status-page/messages/fr.json
@@ -1,8 +1,8 @@
{
"Y9HHck": "S'authentifier",
"1QcGkA": "Entrez votre email pour recevoir un lien magique d'accès à la page de statut. Remarque : seuls les emails provenant de domaines approuvés sont acceptés.",
- "wSZR47": "Envoyer",
"txkW56": "Envoi en cours...",
+ "wSZR47": "Envoyer",
"OrFVks": "Vérifiez votre boîte de réception !",
"n36zhX": "Accédez à la page de statut en cliquant sur le lien dans l'email.",
"qIAQSi": "Page protégée",
@@ -78,56 +78,60 @@
"Pgb3Xj": "Abonné",
"WOH7Yj": "Échec de l'abonnement",
"L7z2/k": "Cette page n'a aucun composant auquel s'abonner.",
- "NOyDVq": "propulsé par",
- "tzMNF3": "Statut",
- "ZvKSfJ": "Événements",
- "xJrRMG": "Moniteurs",
- "tKMlOc": "Menu",
- "krEziQ": "Nous contacter",
- "8kyEWd": "Un quantile représente un percentile spécifique dans votre jeu de données.",
- "kd0Igx": "Par exemple, p50 est le 50e percentile — le point en dessous duquel 50 % des données se situent. Les percentiles plus élevés incluent plus de données et mettent en évidence la plage supérieure.",
"BQBZU+": "Tous les systèmes sont opérationnels",
+ "Dnob31": "Opérationnel",
"b9fOA1": "Performances dégradées",
+ "VQDmmK": "Dégradé",
"80EXUh": "Performances en panne",
+ "JOZGPR": "En panne",
"dudqv/": "Maintenance",
- "u++vY3": "Aucun rapport trouvé",
- "2HGztY": "Aucun rapport trouvé pour cette page de statut.",
- "50SA6J": "Aucun moniteur public",
- "FHrzf5": "Aucun moniteur public n'a été ajouté à cette page.",
- "2syGZB": "Rapport résolu",
- "heezSZ": "(en {duration})",
- "lKJjwW": "({timeFromLast} plus tôt)",
+ "D3rOMr": "Aucune donnée",
"W6nSYE": "Résolu",
"1P6GMj": "Surveillance",
"7cv4Uf": "Identifié",
"/GKH/w": "En cours d'investigation",
- "VaZnIX": "(pendant {duration})",
+ "myq2ZL": "Normal",
+ "KN7zKn": "Erreur",
+ "kkpP2k": "aujourd'hui",
+ "2wsjxR": "en cours",
+ "2syGZB": "Rapport résolu",
"FDReLp": "Aucune notification récente",
"qDj0JR": "Aucun rapport au cours des 7 derniers jours.",
- "CYs0LF": "Voir l'historique des événements",
- "kkpP2k": "aujourd'hui",
- "Dnob31": "Opérationnel",
- "VQDmmK": "Dégradé",
- "JOZGPR": "En panne",
+ "u++vY3": "Aucun rapport trouvé",
+ "2HGztY": "Aucun rapport trouvé pour cette page de statut.",
+ "50SA6J": "Aucun moniteur public",
+ "FHrzf5": "Aucun moniteur public n'a été ajouté à cette page.",
+ "3cc4Ct": "Clair",
+ "tOdNiY": "Sombre",
+ "+CwN9C": "Système",
+ "EQpyb8": "Changer de thème",
+ "uPb/gh": "Mises à jour",
+ "8OoV56": "Obtenir le flux RSS",
+ "Auj/Ki": "Obtenir le flux Atom",
+ "SyYroX": "Obtenir les mises à jour JSON",
+ "rptmhC": "Pour recevoir les mises à jour dans Slack, collez le texte ci-dessous dans n'importe quel canal.",
+ "PSqtlY": "Obtenir le statut via SSH",
+ "NOyDVq": "propulsé par",
+ "krEziQ": "Nous contacter",
"3Vaz8F": "Suivi de statut",
"apbxET": "Statut du jour {n}",
"GbVCQb": "Cliquez à nouveau pour désépingler",
- "myq2ZL": "Normal",
- "KN7zKn": "Erreur",
- "D3rOMr": "Aucune donnée",
- "2wsjxR": "en cours",
+ "heezSZ": "(en {duration})",
+ "lKJjwW": "({timeFromLast} plus tôt)",
+ "VaZnIX": "(pendant {duration})",
"jC7BY1": "sur {duration}",
- "uPb/gh": "Mises à jour",
+ "tzMNF3": "Statut",
+ "ZvKSfJ": "Événements",
+ "xJrRMG": "Moniteurs",
+ "tKMlOc": "Menu",
+ "8kyEWd": "Un quantile représente un percentile spécifique dans votre jeu de données.",
+ "kd0Igx": "Par exemple, p50 est le 50e percentile — le point en dessous duquel 50 % des données se situent. Les percentiles plus élevés incluent plus de données et mettent en évidence la plage supérieure.",
+ "CYs0LF": "Voir l'historique des événements",
"sjzDbu": "Slack",
"q0qMyV": "RSS",
"9y9QQh": "JSON",
"waUHa4": "SSH",
"cVqFq/": "Recevez des notifications par email à chaque création ou résolution d'un rapport",
"gczcC5": "S'abonner",
- "8OoV56": "Obtenir le flux RSS",
- "Auj/Ki": "Obtenir le flux Atom",
- "SyYroX": "Obtenir les mises à jour JSON",
- "PSqtlY": "Obtenir le statut via SSH",
- "rptmhC": "Pour recevoir les mises à jour dans Slack, collez le texte ci-dessous dans n'importe quel canal.",
"45YlLU": "Validez votre email pour recevoir les mises à jour et le tour est joué."
}
diff --git a/apps/status-page/messages/tr.json b/apps/status-page/messages/tr.json
index ea89ca777..1b0361fdc 100644
--- a/apps/status-page/messages/tr.json
+++ b/apps/status-page/messages/tr.json
@@ -1,8 +1,8 @@
{
"Y9HHck": "Kimlik Doğrula",
"1QcGkA": "Durum sayfasına erişmek için sihirli bağlantı almak üzere e-posta adresinizi girin. Not: Yalnızca onaylı alan adlarından gelen e-postalar kabul edilir.",
- "wSZR47": "Gönder",
"txkW56": "Gönderiliyor...",
+ "wSZR47": "Gönder",
"OrFVks": "Gelen kutunuzu kontrol edin!",
"n36zhX": "E-postadaki bağlantıya tıklayarak durum sayfasına erişin.",
"qIAQSi": "Korumalı Sayfa",
@@ -78,56 +78,60 @@
"Pgb3Xj": "Abone olundu",
"WOH7Yj": "Abone olma başarısız oldu",
"L7z2/k": "Bu sayfada abone olunacak bileşen bulunmuyor.",
- "NOyDVq": "tarafından desteklenmektedir",
- "tzMNF3": "Durum",
- "ZvKSfJ": "Olaylar",
- "xJrRMG": "Monitörler",
- "tKMlOc": "Menü",
- "krEziQ": "İletişime geçin",
- "8kyEWd": "Yüzdelik dilim, veri kümenizdeki belirli bir yüzdeyi temsil eder.",
- "kd0Igx": "Örneğin, p50, 50. yüzdelik dilimdir ve verilerin %50'sinin altında kaldığı noktayı gösterir. Daha yüksek yüzdelik dilimler daha fazla veri içerir ve üst aralığı vurgular.",
"BQBZU+": "Tüm Sistemler Çalışıyor",
+ "Dnob31": "Çalışıyor",
"b9fOA1": "Düşük Performans",
+ "VQDmmK": "Düşük",
"80EXUh": "Kesinti Performansı",
+ "JOZGPR": "Kesinti",
"dudqv/": "Bakım",
- "u++vY3": "Rapor bulunamadı",
- "2HGztY": "Bu durum sayfası için rapor bulunamadı.",
- "50SA6J": "Herkese açık monitör yok",
- "FHrzf5": "Bu sayfaya herkese açık monitör eklenmemiş.",
- "2syGZB": "Rapor çözüldü",
- "heezSZ": "({duration} içinde)",
- "lKJjwW": "({timeFromLast} önce)",
+ "D3rOMr": "Veri Yok",
"W6nSYE": "Çözüldü",
"1P6GMj": "İzleniyor",
"7cv4Uf": "Tespit Edildi",
"/GKH/w": "İnceleniyor",
- "VaZnIX": "({duration} boyunca)",
+ "myq2ZL": "Normal",
+ "KN7zKn": "Hata",
+ "kkpP2k": "bugün",
+ "2wsjxR": "devam ediyor",
+ "2syGZB": "Rapor çözüldü",
"FDReLp": "Son bildirim yok",
"qDj0JR": "Son 7 gün içinde herhangi bir rapor oluşturulmadı.",
- "CYs0LF": "Olay geçmişini görüntüle",
- "kkpP2k": "bugün",
- "Dnob31": "Çalışıyor",
- "VQDmmK": "Düşük",
- "JOZGPR": "Kesinti",
+ "u++vY3": "Rapor bulunamadı",
+ "2HGztY": "Bu durum sayfası için rapor bulunamadı.",
+ "50SA6J": "Herkese açık monitör yok",
+ "FHrzf5": "Bu sayfaya herkese açık monitör eklenmemiş.",
+ "3cc4Ct": "Açık",
+ "tOdNiY": "Koyu",
+ "+CwN9C": "Sistem",
+ "EQpyb8": "Temayı değiştir",
+ "uPb/gh": "Güncellemeleri alın",
+ "8OoV56": "RSS beslemesini alın",
+ "Auj/Ki": "Atom beslemesini alın",
+ "SyYroX": "JSON güncellemelerini alın",
+ "rptmhC": "Slack üzerinden durum güncellemeleri almak için aşağıdaki metni herhangi bir kanala yapıştırın.",
+ "PSqtlY": "SSH ile durumu öğrenin",
+ "NOyDVq": "tarafından desteklenmektedir",
+ "krEziQ": "İletişime geçin",
"3Vaz8F": "Durum izleyici",
"apbxET": "Gün {n} durumu",
"GbVCQb": "Sabitlemeyi kaldırmak için tekrar tıklayın",
- "myq2ZL": "Normal",
- "KN7zKn": "Hata",
- "D3rOMr": "Veri Yok",
- "2wsjxR": "devam ediyor",
+ "heezSZ": "({duration} içinde)",
+ "lKJjwW": "({timeFromLast} önce)",
+ "VaZnIX": "({duration} boyunca)",
"jC7BY1": "{duration} boyunca",
- "uPb/gh": "Güncellemeleri alın",
+ "tzMNF3": "Durum",
+ "ZvKSfJ": "Olaylar",
+ "xJrRMG": "Monitörler",
+ "tKMlOc": "Menü",
+ "8kyEWd": "Yüzdelik dilim, veri kümenizdeki belirli bir yüzdeyi temsil eder.",
+ "kd0Igx": "Örneğin, p50, 50. yüzdelik dilimdir ve verilerin %50'sinin altında kaldığı noktayı gösterir. Daha yüksek yüzdelik dilimler daha fazla veri içerir ve üst aralığı vurgular.",
+ "CYs0LF": "Olay geçmişini görüntüle",
"sjzDbu": "Slack",
"q0qMyV": "RSS",
"9y9QQh": "JSON",
"waUHa4": "SSH",
"cVqFq/": "Bir rapor oluşturulduğunda veya çözüldüğünde e-posta bildirimi alın",
"gczcC5": "Abone Ol",
- "8OoV56": "RSS beslemesini alın",
- "Auj/Ki": "Atom beslemesini alın",
- "SyYroX": "JSON güncellemelerini alın",
- "PSqtlY": "SSH ile durumu öğrenin",
- "rptmhC": "Slack üzerinden durum güncellemeleri almak için aşağıdaki metni herhangi bir kanala yapıştırın.",
"45YlLU": "Güncellemeleri almak için e-posta adresinizi doğrulayın, hepsi bu kadar."
}
diff --git a/apps/status-page/src/app/(public)/client.tsx b/apps/status-page/src/app/(public)/client.tsx
index 175b55fdf..7641ef06e 100644
--- a/apps/status-page/src/app/(public)/client.tsx
+++ b/apps/status-page/src/app/(public)/client.tsx
@@ -10,20 +10,20 @@ import {
SectionTitle,
} from "@/components/content/section";
import { recomputeStyles } from "@/components/status-page/floating-button";
-import { StatusMonitorStatic } from "@/components/status-page/static/status-monitor-static";
-import {
- Status,
- StatusContent,
- StatusDescription,
- StatusHeader,
- StatusTitle,
-} from "@/components/status-page/status";
+import { StatusComponentStatic } from "@/components/status-page/static/status-component-static";
import { ThemePalettePicker } from "@/components/themes/theme-palette-picker";
import { ThemeSelect } from "@/components/themes/theme-select";
import { monitors } from "@/data/monitors";
import { useTRPC } from "@/lib/trpc/client";
import { THEMES, THEME_KEYS } from "@openstatus/theme-store";
import { StatusBanner } from "@openstatus/ui/components/blocks/status-banner";
+import {
+ Status,
+ StatusContent,
+ StatusDescription,
+ StatusHeader,
+ StatusTitle,
+} from "@openstatus/ui/components/blocks/status-layout";
import { Button } from "@openstatus/ui/components/ui/button";
import { Input } from "@openstatus/ui/components/ui/input";
import { Separator } from "@openstatus/ui/components/ui/separator";
@@ -298,7 +298,7 @@ function ThemePlaygroundStatus({
<StatusBanner status="success" />
<StatusContent>
{/* TODO: create mock data */}
- <StatusMonitorStatic
+ <StatusComponentStatic
status="success"
data={uptimeData?.data || []}
monitor={monitors[0]}
diff --git a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/client.tsx b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/client.tsx
index 8c77c2cb9..8a9075a40 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/client.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/client.tsx
@@ -2,13 +2,6 @@
import { Link } from "@/components/common/link";
import { useStatusPage } from "@/components/status-page/floating-button";
-import {
- Status,
- StatusContent,
- StatusDescription,
- StatusHeader,
- StatusTitle,
-} from "@/components/status-page/status";
import {
StatusBanner,
StatusBannerContainer,
@@ -18,6 +11,11 @@ import {
StatusBannerTabsList,
StatusBannerTabsTrigger,
} from "@/components/status-page/status-banner";
+import {
+ StatusBar,
+ StatusBarSkeleton,
+} from "@/components/status-page/status-bar";
+import { StatusComponentGroup } from "@/components/status-page/status-component-group";
import {
StatusEventAffected,
StatusEventAffectedBadge,
@@ -25,11 +23,30 @@ import {
StatusEventTimelineReportUpdate,
} from "@/components/status-page/status-events";
import { StatusFeed } from "@/components/status-page/status-feed";
-import { StatusMonitor } from "@/components/status-page/status-monitor";
-import { StatusTrackerGroup } from "@/components/status-page/status-tracker-group";
import { useEmbed } from "@/hooks/use-embed";
import { usePathnamePrefix } from "@/hooks/use-pathname-prefix";
import { useTRPC } from "@/lib/trpc/client";
+import {
+ StatusComponent,
+ StatusComponentBody,
+ StatusComponentDescription,
+ StatusComponentFooter,
+ StatusComponentHeader,
+ StatusComponentHeaderLeft,
+ StatusComponentHeaderRight,
+ StatusComponentIcon,
+ StatusComponentStatus,
+ StatusComponentTitle,
+ StatusComponentUptime,
+ StatusComponentUptimeSkeleton,
+} from "@openstatus/ui/components/blocks/status-component";
+import {
+ Status,
+ StatusContent,
+ StatusDescription,
+ StatusHeader,
+ StatusTitle,
+} from "@openstatus/ui/components/blocks/status-layout";
import { Separator } from "@openstatus/ui/components/ui/separator";
import { cn } from "@openstatus/ui/lib/utils";
import { skipToken, useQuery } from "@tanstack/react-query";
@@ -259,21 +276,17 @@ export function Client() {
{page.trackers.map((tracker) => {
if (tracker.type === "component") {
const component = tracker.component;
-
- // Fetch uptime data by component ID
const { data, uptime } =
uptimeData?.find((u) => u.pageComponentId === component.id) ??
{};
return (
- <StatusMonitor
+ <ComponentCard
key={`component-${component.id}`}
+ name={component.name}
+ description={component.description}
status={component.status}
data={data}
- monitor={{
- name: component.name,
- description: component.description,
- }}
uptime={uptime}
showUptime={showUptime}
isLoading={isLoading}
@@ -282,7 +295,7 @@ export function Client() {
}
return (
- <StatusTrackerGroup
+ <StatusComponentGroup
key={`group-${tracker.groupId}`}
title={tracker.groupName}
status={tracker.status}
@@ -295,21 +308,19 @@ export function Client() {
) ?? {};
return (
- <StatusMonitor
+ <ComponentCard
key={`component-${component.id}`}
+ name={component.name}
+ description={component.description}
status={component.status}
data={data}
- monitor={{
- name: component.name,
- description: component.description,
- }}
uptime={uptime}
showUptime={showUptime}
isLoading={isLoading}
/>
);
})}
- </StatusTrackerGroup>
+ </StatusComponentGroup>
);
})}
</StatusContent>
@@ -318,10 +329,13 @@ export function Client() {
<StatusContent className="group-data-[hide-feed=true]/embed:hidden">
<StatusFeed
statusReports={page.statusReports
- .filter((report) =>
- page.lastEvents.some(
- (event) => event.id === report.id && event.type === "report",
- ),
+ .filter(
+ (report) =>
+ report.statusReportUpdates.length > 0 &&
+ page.lastEvents.some(
+ (event) =>
+ event.id === report.id && event.type === "report",
+ ),
)
.map((report) => ({
...report,
@@ -349,3 +363,52 @@ export function Client() {
</div>
);
}
+
+type ComponentCardData = NonNullable<Parameters<typeof StatusBar>[0]["data"]>;
+
+function ComponentCard({
+ name,
+ description,
+ status,
+ data,
+ uptime,
+ showUptime,
+ isLoading,
+}: {
+ name: string;
+ description?: string | null;
+ status: "success" | "degraded" | "error" | "info";
+ data?: ComponentCardData;
+ uptime?: string;
+ showUptime?: boolean;
+ isLoading?: boolean;
+}) {
+ return (
+ <StatusComponent variant={status}>
+ <StatusComponentHeader>
+ <StatusComponentHeaderLeft>
+ <StatusComponentTitle>{name}</StatusComponentTitle>
+ <StatusComponentDescription>{description}</StatusComponentDescription>
+ </StatusComponentHeaderLeft>
+ <StatusComponentHeaderRight>
+ {showUptime ? (
+ <>
+ {isLoading ? (
+ <StatusComponentUptimeSkeleton />
+ ) : (
+ <StatusComponentUptime>{uptime}</StatusComponentUptime>
+ )}
+ <StatusComponentIcon />
+ </>
+ ) : (
+ <StatusComponentStatus />
+ )}
+ </StatusComponentHeaderRight>
+ </StatusComponentHeader>
+ <StatusComponentBody>
+ {isLoading ? <StatusBarSkeleton /> : <StatusBar data={data ?? []} />}
+ <StatusComponentFooter data={data ?? []} isLoading={isLoading} />
+ </StatusComponentBody>
+ </StatusComponent>
+ );
+}
diff --git a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/(list)/page.tsx b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/(list)/page.tsx
index b11a20cb8..e93273d37 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/(list)/page.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/(list)/page.tsx
@@ -100,7 +100,6 @@ export default function Page() {
) : null}
<StatusEventTimelineReport
updates={report.statusReportUpdates}
- reportId={report.id}
/>
</StatusEventContent>
</Link>
diff --git a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/(view)/report/[id]/page.tsx b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/(view)/report/[id]/page.tsx
index ea702bb9a..bd4ad029f 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/(view)/report/[id]/page.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/(view)/report/[id]/page.tsx
@@ -72,10 +72,7 @@ export default function ReportPage() {
))}
</StatusEventAffected>
) : null}
- <StatusEventTimelineReport
- updates={report.statusReportUpdates}
- reportId={report.id}
- />
+ <StatusEventTimelineReport updates={report.statusReportUpdates} />
</StatusEventContent>
</StatusEvent>
</div>
diff --git a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/layout.tsx b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/layout.tsx
index 0c5c7f7f5..052ad1715 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/layout.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/events/layout.tsx
@@ -1,13 +1,13 @@
"use client";
+import { useTRPC } from "@/lib/trpc/client";
import {
Status,
StatusContent,
StatusDescription,
StatusHeader,
StatusTitle,
-} from "@/components/status-page/status";
-import { useTRPC } from "@/lib/trpc/client";
+} from "@openstatus/ui/components/blocks/status-layout";
import { useQuery } from "@tanstack/react-query";
import { useParams } from "next/navigation";
diff --git a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/layout.tsx b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/layout.tsx
index d86bd2c11..5f48d770c 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/layout.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/layout.tsx
@@ -1,28 +1,23 @@
import { EmbedShell } from "@/components/layout/embed-shell";
import { Footer } from "@/components/nav/footer";
import { Header } from "@/components/nav/header";
-import { cn } from "@openstatus/ui/lib/utils";
+import {
+ StatusPageMain,
+ StatusPageShell,
+} from "@openstatus/ui/components/blocks/status-page-shell";
import { Suspense } from "react";
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<Suspense>
- <EmbedShell
- className={cn(
- "flex min-h-screen flex-col gap-4",
- "group-data-[embed=true]/embed:min-h-0",
- )}
- >
- <Header className="w-full border-b" />
- <main
- className={cn(
- "mx-auto flex w-full max-w-2xl flex-1 flex-col px-3 py-2",
- "group-data-[embed=true]/embed:mx-0 group-data-[embed=true]/embed:max-w-none",
- )}
- >
- {children}
- </main>
- <Footer className="w-full border-t" />
+ <EmbedShell>
+ <StatusPageShell className="group-data-[embed=true]/embed:min-h-0">
+ <Header className="w-full border-b" />
+ <StatusPageMain className="group-data-[embed=true]/embed:mx-0 group-data-[embed=true]/embed:max-w-none">
+ {children}
+ </StatusPageMain>
+ <Footer className="w-full border-t" />
+ </StatusPageShell>
</EmbedShell>
</Suspense>
);
diff --git a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/manage/layout.tsx b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/manage/layout.tsx
index 0c5c7f7f5..052ad1715 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/manage/layout.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/manage/layout.tsx
@@ -1,13 +1,13 @@
"use client";
+import { useTRPC } from "@/lib/trpc/client";
import {
Status,
StatusContent,
StatusDescription,
StatusHeader,
StatusTitle,
-} from "@/components/status-page/status";
-import { useTRPC } from "@/lib/trpc/client";
+} from "@openstatus/ui/components/blocks/status-layout";
import { useQuery } from "@tanstack/react-query";
import { useParams } from "next/navigation";
diff --git a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/monitors/[id]/page.tsx b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/monitors/[id]/page.tsx
index 6e6fe4c35..a8cbf08c5 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/monitors/[id]/page.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/monitors/[id]/page.tsx
@@ -14,13 +14,6 @@ import {
ChartLineRegions,
ChartLineRegionsSkeleton,
} from "@/components/chart/chart-line-regions";
-import {
- Status,
- StatusContent,
- StatusDescription,
- StatusHeader,
- StatusTitle,
-} from "@/components/status-page/status";
import { StatusBlankMonitors } from "@/components/status-page/status-blank";
import {
StatusChartContent,
@@ -43,6 +36,13 @@ import {
formatPercentage,
} from "@/lib/formatter";
import { useTRPC } from "@/lib/trpc/client";
+import {
+ Status,
+ StatusContent,
+ StatusDescription,
+ StatusHeader,
+ StatusTitle,
+} from "@openstatus/ui/components/blocks/status-layout";
import { Badge } from "@openstatus/ui/components/ui/badge";
import { useQuery } from "@tanstack/react-query";
import { TrendingUp } from "lucide-react";
diff --git a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/monitors/page.tsx b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/monitors/page.tsx
index 1b02621dc..c9797fece 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/monitors/page.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/monitors/page.tsx
@@ -4,17 +4,19 @@ import {
ChartAreaPercentiles,
ChartAreaPercentilesSkeleton,
} from "@/components/chart/chart-area-percentiles";
+import { StatusBlankMonitors } from "@/components/status-page/status-blank";
+import { useTRPC } from "@/lib/trpc/client";
+import {
+ StatusComponentDescription,
+ StatusComponentTitle,
+} from "@openstatus/ui/components/blocks/status-component";
import {
Status,
StatusContent,
StatusDescription,
StatusHeader,
StatusTitle,
-} from "@/components/status-page/status";
-import { StatusBlankMonitors } from "@/components/status-page/status-blank";
-import { StatusMonitorTitle } from "@/components/status-page/status-monitor";
-import { StatusMonitorDescription } from "@/components/status-page/status-monitor";
-import { useTRPC } from "@/lib/trpc/client";
+} from "@openstatus/ui/components/blocks/status-layout";
import { useQuery } from "@tanstack/react-query";
import Link from "next/link";
import { useParams } from "next/navigation";
@@ -68,10 +70,10 @@ export default function Page() {
>
<div className="group -mx-3 -my-2 flex flex-col gap-2 rounded-lg border border-transparent px-3 py-2 hover:border-border/50 hover:bg-muted/50">
<div className="flex flex-row items-center justify-start gap-2">
- <StatusMonitorTitle>{monitor.name}</StatusMonitorTitle>
- <StatusMonitorDescription>
+ <StatusComponentTitle>{monitor.name}</StatusComponentTitle>
+ <StatusComponentDescription>
{monitor.description}
- </StatusMonitorDescription>
+ </StatusComponentDescription>
</div>
{isLoading ? (
<ChartAreaPercentilesSkeleton className="h-[80px]" />
diff --git a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/unsubscribe/[token]/layout.tsx b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/unsubscribe/[token]/layout.tsx
index 9edb11c2d..eb69ec81b 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/unsubscribe/[token]/layout.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/unsubscribe/[token]/layout.tsx
@@ -1,13 +1,13 @@
"use client";
+import { useTRPC } from "@/lib/trpc/client";
import {
Status,
StatusContent,
StatusDescription,
StatusHeader,
StatusTitle,
-} from "@/components/status-page/status";
-import { useTRPC } from "@/lib/trpc/client";
+} from "@openstatus/ui/components/blocks/status-layout";
import { useQuery } from "@tanstack/react-query";
import { useParams } from "next/navigation";
diff --git a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/verify/[token]/layout.tsx b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/verify/[token]/layout.tsx
index 0c5c7f7f5..052ad1715 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/verify/[token]/layout.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/[locale]/(public)/verify/[token]/layout.tsx
@@ -1,13 +1,13 @@
"use client";
+import { useTRPC } from "@/lib/trpc/client";
import {
Status,
StatusContent,
StatusDescription,
StatusHeader,
StatusTitle,
-} from "@/components/status-page/status";
-import { useTRPC } from "@/lib/trpc/client";
+} from "@openstatus/ui/components/blocks/status-layout";
import { useQuery } from "@tanstack/react-query";
import { useParams } from "next/navigation";
diff --git a/apps/status-page/src/app/(status-page)/[domain]/[locale]/layout.tsx b/apps/status-page/src/app/(status-page)/[domain]/[locale]/layout.tsx
index 151bc44a4..59f536abd 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/[locale]/layout.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/[locale]/layout.tsx
@@ -1,4 +1,5 @@
import { DateFnsProvider } from "@/components/date-fns-provider";
+import { StatusBlocksProvider } from "@/components/i18n/status-blocks-provider";
import { routing } from "@/i18n/routing";
import { NextIntlClientProvider, hasLocale } from "next-intl";
import { setRequestLocale } from "next-intl/server";
@@ -24,7 +25,9 @@ export default async function LocaleLayout({
return (
<NextIntlClientProvider locale={locale} messages={messages}>
- <DateFnsProvider locale={locale}>{children}</DateFnsProvider>
+ <DateFnsProvider locale={locale}>
+ <StatusBlocksProvider>{children}</StatusBlocksProvider>
+ </DateFnsProvider>
</NextIntlClientProvider>
);
}
diff --git a/apps/status-page/src/app/(status-page)/[domain]/layout.tsx b/apps/status-page/src/app/(status-page)/[domain]/layout.tsx
index 5401e1216..5d04c18e8 100644
--- a/apps/status-page/src/app/(status-page)/[domain]/layout.tsx
+++ b/apps/status-page/src/app/(status-page)/[domain]/layout.tsx
@@ -7,22 +7,13 @@ import {
import { FloatingTheme } from "@/components/status-page/floating-theme";
import { ThemeProvider } from "@/components/themes/theme-provider";
import { HydrateClient, getQueryClient, trpc } from "@/lib/trpc/server";
-import {
- THEME_KEYS,
- type ThemeKey,
- generateThemeStyles,
-} from "@openstatus/theme-store";
+import { pageConfigurationSchema } from "@openstatus/db/src/schema";
+import { generateThemeStyles } from "@openstatus/theme-store";
import { Toaster } from "@openstatus/ui/components/ui/sonner";
import type { Metadata } from "next";
import { notFound } from "next/navigation";
-import { z } from "zod";
-const schema = z.object({
- value: z.enum(["duration", "requests", "manual"]).prefault("duration"),
- type: z.enum(["absolute", "manual"]).prefault("absolute"),
- uptime: z.coerce.boolean().prefault(true),
- theme: z.enum(THEME_KEYS as [ThemeKey, ...ThemeKey[]]).prefault("default"),
-});
+// Canonical schema — guarantees concrete enum output (never null/undefined).
export default async function Layout({
children,
@@ -39,8 +30,14 @@ export default async function Layout({
if (!page) return notFound();
- const validation = schema.safeParse(page?.configuration);
- const communityTheme = validation.data?.theme;
+ // safeParse + fallback so a stale enum value in stored config (e.g. removed
+ // theme key) doesn't crash the layout.
+ const cfgResult = pageConfigurationSchema.safeParse(
+ page?.configuration ?? {},
+ );
+ const cfg = cfgResult.success
+ ? cfgResult.data
+ : pageConfigurationSchema.parse({});
return (
<HydrateClient>
@@ -48,7 +45,7 @@ export default async function Layout({
id="theme-styles"
// biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation>
dangerouslySetInnerHTML={{
- __html: generateThemeStyles(communityTheme),
+ __html: generateThemeStyles(cfg.theme),
}}
/>
<ThemeProvider
@@ -58,10 +55,10 @@ export default async function Layout({
disableTransitionOnChange
>
<StatusPageProvider
- defaultBarType={validation.data?.type}
- defaultCardType={validation.data?.value}
- defaultShowUptime={validation.data?.uptime}
- defaultCommunityTheme={validation.data?.theme}
+ defaultBarType={cfg.type}
+ defaultCardType={cfg.value}
+ defaultShowUptime={cfg.uptime}
+ defaultCommunityTheme={cfg.theme}
>
{children}
<FloatingButton
diff --git a/apps/status-page/src/components/forms/form-subscribe-email.tsx b/apps/status-page/src/components/forms/form-subscribe-email.tsx
index 02e8c7ba7..92d73433b 100644
--- a/apps/status-page/src/components/forms/form-subscribe-email.tsx
+++ b/apps/status-page/src/components/forms/form-subscribe-email.tsx
@@ -16,7 +16,6 @@ import {
FormLabel,
} from "@openstatus/ui/components/ui/form";
import { Input } from "@openstatus/ui/components/ui/input";
-import { Separator } from "@openstatus/ui/components/ui/separator";
import { cn } from "@openstatus/ui/lib/utils";
import { isTRPCClientError } from "@trpc/client";
import { useExtracted } from "next-intl";
@@ -90,7 +89,7 @@ export function FormSubscribeEmail({
control={form.control}
name="email"
render={({ field }) => (
- <FormItem className="px-2">
+ <FormItem>
<FormLabel className="sr-only">{t("Email")}</FormLabel>
<FormControl>
<Input placeholder="[email protected]" {...field} />
@@ -103,7 +102,7 @@ export function FormSubscribeEmail({
control={form.control}
name="subscribeComponents"
render={({ field }) => (
- <FormItem className="flex items-center gap-2 px-2">
+ <FormItem className="flex items-center gap-2">
<FormControl>
<Checkbox
checked={field.value}
@@ -115,144 +114,133 @@ export function FormSubscribeEmail({
)}
/>
{form.watch("subscribeComponents") && (
- <>
- <Separator />
- <div className="-my-2 flex max-h-56 flex-col gap-2 overflow-y-auto bg-muted p-2 px-2">
- {page?.trackers && page.trackers.length > 0 ? (
- page.trackers.map((tracker) => {
- if (tracker.type === "group") {
- const groupIds = tracker.components.map((c) => c.id);
- return (
- <div
- key={tracker.groupId}
- className="flex flex-col gap-2"
- >
+ <div className="flex max-h-56 flex-col gap-2 overflow-y-auto rounded-md border border-border bg-muted p-2">
+ {page?.trackers && page.trackers.length > 0 ? (
+ page.trackers.map((tracker) => {
+ if (tracker.type === "group") {
+ const groupIds = tracker.components.map((c) => c.id);
+ return (
+ <div key={tracker.groupId} className="flex flex-col gap-2">
+ <FormField
+ control={form.control}
+ name="pageComponents"
+ render={({ field }) => {
+ const allChecked = groupIds.every((id) =>
+ field.value?.includes(id),
+ );
+ const someChecked = groupIds.some((id) =>
+ field.value?.includes(id),
+ );
+ return (
+ <FormItem className="flex items-center gap-2">
+ <FormControl>
+ <Checkbox
+ checked={
+ allChecked
+ ? true
+ : someChecked
+ ? "indeterminate"
+ : false
+ }
+ onCheckedChange={(checked) => {
+ const value = field.value ?? [];
+ if (checked) {
+ field.onChange([
+ ...new Set([...value, ...groupIds]),
+ ]);
+ } else {
+ field.onChange(
+ value.filter(
+ (id) => !groupIds.includes(id),
+ ),
+ );
+ }
+ }}
+ />
+ </FormControl>
+ <FormLabel>{tracker.groupName}</FormLabel>
+ </FormItem>
+ );
+ }}
+ />
+ {tracker.components.map((component) => (
<FormField
+ key={component.id}
control={form.control}
name="pageComponents"
- render={({ field }) => {
- const allChecked = groupIds.every((id) =>
- field.value?.includes(id),
- );
- const someChecked = groupIds.some((id) =>
- field.value?.includes(id),
- );
- return (
- <FormItem className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- checked={
- allChecked
- ? true
- : someChecked
- ? "indeterminate"
- : false
+ render={({ field }) => (
+ <FormItem className="flex items-center gap-2 pl-6">
+ <FormControl>
+ <Checkbox
+ checked={field.value?.includes(component.id)}
+ onCheckedChange={(checked) => {
+ const value = field.value ?? [];
+ if (checked) {
+ field.onChange([...value, component.id]);
+ } else {
+ field.onChange(
+ value.filter(
+ (id) => id !== component.id,
+ ),
+ );
}
- onCheckedChange={(checked) => {
- const value = field.value ?? [];
- if (checked) {
- field.onChange([
- ...new Set([...value, ...groupIds]),
- ]);
- } else {
- field.onChange(
- value.filter(
- (id) => !groupIds.includes(id),
- ),
- );
- }
- }}
- />
- </FormControl>
- <FormLabel>{tracker.groupName}</FormLabel>
- </FormItem>
- );
- }}
+ }}
+ />
+ </FormControl>
+ <FormLabel>{component.name}</FormLabel>
+ </FormItem>
+ )}
/>
- {tracker.components.map((component) => (
- <FormField
- key={component.id}
- control={form.control}
- name="pageComponents"
- render={({ field }) => (
- <FormItem className="flex items-center gap-2 pl-6">
- <FormControl>
- <Checkbox
- checked={field.value?.includes(
- component.id,
- )}
- onCheckedChange={(checked) => {
- const value = field.value ?? [];
- if (checked) {
- field.onChange([
- ...value,
- component.id,
- ]);
- } else {
- field.onChange(
- value.filter(
- (id) => id !== component.id,
- ),
- );
- }
- }}
- />
- </FormControl>
- <FormLabel>{component.name}</FormLabel>
- </FormItem>
+ ))}
+ </div>
+ );
+ }
+ return (
+ <FormField
+ key={tracker.component.id}
+ control={form.control}
+ name="pageComponents"
+ render={({ field }) => (
+ <FormItem className="flex items-center gap-2">
+ <FormControl>
+ <Checkbox
+ checked={field.value?.includes(
+ tracker.component.id,
)}
+ onCheckedChange={(checked) => {
+ const value = field.value ?? [];
+ if (checked) {
+ field.onChange([
+ ...value,
+ tracker.component.id,
+ ]);
+ } else {
+ field.onChange(
+ value.filter(
+ (id) => id !== tracker.component.id,
+ ),
+ );
+ }
+ }}
/>
- ))}
- </div>
- );
- }
- return (
- <FormField
- key={tracker.component.id}
- control={form.control}
- name="pageComponents"
- render={({ field }) => (
- <FormItem className="flex items-center gap-2">
- <FormControl>
- <Checkbox
- checked={field.value?.includes(
- tracker.component.id,
- )}
- onCheckedChange={(checked) => {
- const value = field.value ?? [];
- if (checked) {
- field.onChange([
- ...value,
- tracker.component.id,
- ]);
- } else {
- field.onChange(
- value.filter(
- (id) => id !== tracker.component.id,
- ),
- );
- }
- }}
- />
- </FormControl>
- <FormLabel>{tracker.component.name}</FormLabel>
- </FormItem>
- )}
- />
- );
- })
- ) : (
- <StatusBlankContainer>
- <StatusBlankTitle>
- {t("No components to subscribe to")}
- </StatusBlankTitle>
- <StatusBlankDescription>
- {t("This page has no components to subscribe to.")}
- </StatusBlankDescription>
- </StatusBlankContainer>
- )}
- </div>
- </>
+ </FormControl>
+ <FormLabel>{tracker.component.name}</FormLabel>
+ </FormItem>
+ )}
+ />
+ );
+ })
+ ) : (
+ <StatusBlankContainer>
+ <StatusBlankTitle>
+ {t("No components to subscribe to")}
+ </StatusBlankTitle>
+ <StatusBlankDescription>
+ {t("This page has no components to subscribe to.")}
+ </StatusBlankDescription>
+ </StatusBlankContainer>
+ )}
+ </div>
)}
</form>
</Form>
diff --git a/apps/status-page/src/components/i18n/status-blocks-provider.tsx b/apps/status-page/src/components/i18n/status-blocks-provider.tsx
new file mode 100644
index 000000000..6f795b629
--- /dev/null
+++ b/apps/status-page/src/components/i18n/status-blocks-provider.tsx
@@ -0,0 +1,123 @@
+"use client";
+
+import {
+ formatDate,
+ formatDateRange,
+ formatDateRangeParts,
+ formatDateTime,
+} from "@/lib/formatter";
+import {
+ StatusBlocksI18nProvider,
+ type StatusBlocksLabels,
+} from "@openstatus/ui/components/blocks/status-i18n";
+import { useExtracted, useLocale } from "next-intl";
+import { useMemo } from "react";
+
+/**
+ * StatusBlocksProvider
+ *
+ * Bridges next-intl translations + locale-aware date formatters into the
+ * `@openstatus/ui` blocks. Mounted once at the locale layout — every block
+ * rendered below it (banner, bar, component, events, feed, blank) reads
+ * translated labels via `useStatusBlocksLabels()`.
+ *
+ * Extractor note: the t("…") keys below must remain literal strings so the
+ * next-intl extractor can pick them up from `apps/status-page/src/...`.
+ */
+export function StatusBlocksProvider({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ const t = useExtracted();
+ const locale = useLocale();
+
+ const value = useMemo<StatusBlocksLabels>(
+ () => ({
+ systemStatus: {
+ success: {
+ long: t("All Systems Operational"),
+ short: t("Operational"),
+ },
+ degraded: { long: t("Degraded Performance"), short: t("Degraded") },
+ error: { long: t("Downtime Performance"), short: t("Downtime") },
+ info: { long: t("Maintenance"), short: t("Maintenance") },
+ empty: { long: t("No Data"), short: t("No Data") },
+ },
+ incidentStatus: {
+ resolved: t("Resolved"),
+ monitoring: t("Monitoring"),
+ identified: t("Identified"),
+ investigating: t("Investigating"),
+ },
+ requestStatus: {
+ success: t("Normal"),
+ degraded: t("Degraded"),
+ error: t("Error"),
+ info: t("Maintenance"),
+ empty: t("No Data"),
+ },
+
+ today: t("today"),
+ ongoing: t("ongoing"),
+ reportResolved: t("Report resolved"),
+ noRecentNotifications: t("No recent notifications"),
+ noRecentNotificationsDescription: t(
+ "There have been no reports within the last 7 days.",
+ ),
+ noReports: t("No reports found"),
+ noReportsDescription: t("No reports found for this status page."),
+ noPublicMonitors: t("No public monitors"),
+ noPublicMonitorsDescription: t(
+ "No public monitors have been added to this page.",
+ ),
+
+ themeNames: {
+ light: t("Light"),
+ dark: t("Dark"),
+ system: t("System"),
+ },
+ ariaToggleTheme: t("Toggle theme"),
+
+ subscribe: t("Get updates"),
+ subscribeRssDescription: t("Get the RSS feed"),
+ subscribeAtomDescription: t("Get the Atom feed"),
+ subscribeJsonDescription: t("Get the JSON updates"),
+ subscribeSlackDescription: t(
+ "For status updates in Slack, paste the text below into any channel.",
+ ),
+ subscribeSshDescription: t("Get status via SSH"),
+ linkCopiedToClipboard: t("Link copied to clipboard"),
+ ariaCopyLink: t("Copy Link"),
+
+ poweredBy: t("powered by"),
+ getInTouch: t("Get in touch"),
+
+ ariaStatusTracker: t("Status tracker"),
+ ariaDayStatus: (n: number) => t("Day {n} status", { n: String(n) }),
+ clickAgainToUnpin: t("Click again to unpin"),
+
+ durationIn: (duration: string) => t("(in {duration})", { duration }),
+ durationEarlier: (timeFromLast: string) =>
+ t("({timeFromLast} earlier)", { timeFromLast }),
+ durationFor: (duration: string) => t("(for {duration})", { duration }),
+ durationAcross: (duration: string) =>
+ t("across {duration}", { duration }),
+
+ formatDate: (d: Date) => formatDate(d, { locale }),
+ formatDateShort: (d: Date) => formatDate(d, { month: "short", locale }),
+ formatDateTime: (d: Date) => formatDateTime(d, locale),
+ formatDateRange: (from?: Date, to?: Date) =>
+ formatDateRange(from, to, locale),
+ formatDateRangeParts: (from: Date, to: Date) =>
+ formatDateRangeParts(from, to, locale),
+ }),
+ [t, locale],
+ );
+
+ return (
+ <StatusBlocksI18nProvider value={value}>
+ {children}
+ </StatusBlocksI18nProvider>
+ );
+}
diff --git a/apps/status-page/src/components/locale-switcher.tsx b/apps/status-page/src/components/locale-switcher.tsx
index 99870d38e..f6638f2c5 100644
--- a/apps/status-page/src/components/locale-switcher.tsx
+++ b/apps/status-page/src/components/locale-switcher.tsx
@@ -5,26 +5,24 @@ import {
localeTranslations,
locales,
} from "@/i18n/config";
-import { cn } from "@/lib/utils";
-import { Button } from "@openstatus/ui/components/ui/button";
import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuGroup,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from "@openstatus/ui/components/ui/dropdown-menu";
-import { Skeleton } from "@openstatus/ui/components/ui/skeleton";
+ StatusLocaleSwitcher as BlockLocaleSwitcher,
+ type StatusLocaleOption,
+ StatusLocaleSwitcherSkeleton,
+} from "@openstatus/ui/components/blocks/status-locale-switcher";
import { useLocale } from "next-intl";
import { useParams, useRouter } from "next/navigation";
-import { useEffect, useState, useTransition } from "react";
+import { useEffect, useMemo, useState, useTransition } from "react";
export function LocaleSwitcher({
className,
pageLocales,
pageDefaultLocale,
...props
-}: React.ComponentProps<typeof DropdownMenuTrigger> & {
+}: Omit<
+ React.ComponentProps<typeof BlockLocaleSwitcher>,
+ "value" | "onValueChange" | "locales" | "disabled"
+> & {
pageLocales?: string[] | null;
pageDefaultLocale?: string;
}) {
@@ -39,6 +37,14 @@ export function LocaleSwitcher({
setMounted(true);
}, []);
+ const localeOptions = useMemo<StatusLocaleOption[]>(
+ () =>
+ Object.entries(localeTranslations)
+ .filter(([key]) => pageLocales?.includes(key))
+ .map(([value, { name }]) => ({ value, label: name })),
+ [pageLocales],
+ );
+
function onSelectLocale(nextLocale: string) {
startTransition(() => {
// Use the browser pathname — usePathname() returns the rewritten path
@@ -73,48 +79,22 @@ export function LocaleSwitcher({
});
}
- // Don't render if the page has no multi-locale config or only one locale
if (!pageLocales || pageLocales.length <= 1) {
return null;
}
if (!mounted) {
- return <Skeleton className={cn("size-9", className)} />;
+ return <StatusLocaleSwitcherSkeleton className={className} />;
}
return (
- <DropdownMenu>
- <DropdownMenuTrigger className={cn(className)} asChild {...props}>
- <Button
- variant="ghost"
- size="icon"
- disabled={isPending}
- className="font-mono uppercase"
- >
- {locale}
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" alignOffset={-4}>
- <DropdownMenuGroup>
- {Object.entries(localeTranslations)
- .filter(([key]) => pageLocales?.includes(key))
- .map(([key, { name }]) => (
- <DropdownMenuItem key={key} onClick={() => onSelectLocale(key)}>
- {name}{" "}
- <span
- className={cn(
- "ml-auto font-mono uppercase",
- key === locale
- ? "text-foreground"
- : "text-muted-foreground",
- )}
- >
- {key}
- </span>
- </DropdownMenuItem>
- ))}
- </DropdownMenuGroup>
- </DropdownMenuContent>
- </DropdownMenu>
+ <BlockLocaleSwitcher
+ value={locale}
+ onValueChange={onSelectLocale}
+ locales={localeOptions}
+ disabled={isPending}
+ className={className}
+ {...props}
+ />
);
}
diff --git a/apps/status-page/src/components/nav/footer.tsx b/apps/status-page/src/components/nav/footer.tsx
index 751b62fc0..bc5f91d63 100644
--- a/apps/status-page/src/components/nav/footer.tsx
+++ b/apps/status-page/src/components/nav/footer.tsx
@@ -3,14 +3,19 @@
import { Link } from "@/components/common/link";
import { TimestampHoverCard } from "@/components/content/timestamp-hover-card";
import { LocaleSwitcher } from "@/components/locale-switcher";
-import { ThemeDropdown } from "@/components/themes/theme-dropdown";
+import { ThemeSwitcher } from "@/components/themes/theme-switcher";
import { useEmbed } from "@/hooks/use-embed";
import { useTRPC } from "@/lib/trpc/client";
+import {
+ StatusPageFooter,
+ StatusPageFooterActions,
+ StatusPageFooterContent,
+ StatusPagePoweredBy,
+} from "@openstatus/ui/components/blocks/status-page-footer";
import { Skeleton } from "@openstatus/ui/components/ui/skeleton";
import { cn } from "@openstatus/ui/lib/utils";
import { useQuery } from "@tanstack/react-query";
import { Clock } from "lucide-react";
-import { useExtracted } from "next-intl";
import { useParams } from "next/navigation";
import { useEffect, useState } from "react";
@@ -18,7 +23,6 @@ export function Footer({
className,
...props
}: React.ComponentProps<"footer">) {
- const t = useExtracted();
const { domain } = useParams<{ domain: string }>();
const [isMounted, setIsMounted] = useState(false);
const trpc = useTRPC();
@@ -39,15 +43,14 @@ export function Footer({
if (embed.mode && page.whiteLabel) return null;
return (
- <footer
+ <StatusPageFooter
className={cn("group-data-[embed=true]/embed:border-t-0", className)}
{...props}
>
- <div className="mx-auto flex max-w-2xl items-center justify-between gap-4 px-3 py-2 group-data-[embed=true]/embed:justify-center">
+ <StatusPageFooterContent className="group-data-[embed=true]/embed:justify-center">
<div>
{!page.whiteLabel ? (
- <p className="font-mono text-muted-foreground text-xs leading-none sm:text-sm">
- {t("powered by")}{" "}
+ <StatusPagePoweredBy>
<Link
href={`https://openstatus.dev?utm_medium=status-page&utm_source=${page.slug}`}
target="_blank"
@@ -55,10 +58,10 @@ export function Footer({
>
openstatus.dev
</Link>
- </p>
+ </StatusPagePoweredBy>
) : null}
</div>
- <div className="flex items-center gap-2 group-data-[embed=true]/embed:hidden">
+ <StatusPageFooterActions className="group-data-[embed=true]/embed:hidden">
<TimestampHoverCard
date={new Date(dataUpdatedAt)}
side="top"
@@ -78,9 +81,9 @@ export function Footer({
pageLocales={page.locales}
pageDefaultLocale={page.defaultLocale}
/>
- <ThemeDropdown />
- </div>
- </div>
- </footer>
+ <ThemeSwitcher />
+ </StatusPageFooterActions>
+ </StatusPageFooterContent>
+ </StatusPageFooter>
);
}
diff --git a/apps/status-page/src/components/nav/header.tsx b/apps/status-page/src/components/nav/header.tsx
index 4cb05f20b..2ab32c9cc 100644
--- a/apps/status-page/src/components/nav/header.tsx
+++ b/apps/status-page/src/components/nav/header.tsx
@@ -8,6 +8,17 @@ import {
import { usePathnamePrefix } from "@/hooks/use-pathname-prefix";
import { useTRPC } from "@/lib/trpc/client";
import type { RouterOutputs } from "@openstatus/api";
+import { StatusPageGetInTouchIcon } from "@openstatus/ui/components/blocks/status-page-get-in-touch";
+import {
+ StatusPageHeader,
+ StatusPageHeaderActions,
+ StatusPageHeaderBrand,
+ StatusPageHeaderBrandButton,
+ StatusPageHeaderBrandFallback,
+ StatusPageHeaderContent,
+ StatusPageHeaderNav,
+ StatusPageHeaderNavItem,
+} from "@openstatus/ui/components/blocks/status-page-header";
import { Button } from "@openstatus/ui/components/ui/button";
import {
Sheet,
@@ -16,12 +27,6 @@ import {
SheetTitle,
SheetTrigger,
} from "@openstatus/ui/components/ui/sheet";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@openstatus/ui/components/ui/tooltip";
import { cn } from "@openstatus/ui/lib/utils";
import { useMutation, useQuery } from "@tanstack/react-query";
import { isTRPCClientError } from "@trpc/client";
@@ -113,20 +118,15 @@ export function Header({
);
return (
- <header
+ <StatusPageHeader
className={cn("group-data-[embed=true]/embed:hidden", className)}
{...props}
>
- <nav className="mx-auto flex max-w-2xl items-center justify-between gap-3 px-3 py-2">
+ <StatusPageHeaderContent>
{/* NOTE: same width as the `StatusUpdates` button */}
- <div className="flex w-[150px] shrink-0">
+ <StatusPageHeaderBrand>
<div className="flex items-center justify-center">
- <Button
- variant="outline"
- size="icon"
- className="size-8 overflow-hidden"
- asChild
- >
+ <StatusPageHeaderBrandButton>
<Link
href={page?.homepageUrl || `/${prefix}`}
target={page?.homepageUrl ? "_blank" : undefined}
@@ -139,24 +139,22 @@ export function Header({
className="size-8"
/>
) : (
- <div className="flex size-8 items-center justify-center font-mono">
- {/* NOTE: show the first two letters of the title and if its multiple words, show the first letter of the first two words */}
- {page?.title
- ?.split(" ")
- .map((word) => word.charAt(0))
- .slice(0, 2)
- .join("")
- .toUpperCase()}
- </div>
+ // NOTE: show the first two letters of the title and if its multiple words, show the first letter of the first two words
+ <StatusPageHeaderBrandFallback title={page?.title} />
)}
</Link>
- </Button>
+ </StatusPageHeaderBrandButton>
</div>
- </div>
+ </StatusPageHeaderBrand>
<NavDesktop className="hidden md:flex" />
- <div className="flex min-w-[150px] items-center justify-end gap-2">
+ <StatusPageHeaderActions>
{page?.contactUrl ? (
- <GetInTouch buttonType="icon" link={page.contactUrl} />
+ <StatusPageGetInTouchIcon>
+ <a href={page.contactUrl} target="_blank" rel="noreferrer">
+ <MessageCircleMore />
+ <span className="sr-only">{t("Get in touch")}</span>
+ </a>
+ </StatusPageGetInTouchIcon>
) : null}
<StatusUpdates
types={getStatusUpdateTypes(page)}
@@ -166,34 +164,25 @@ export function Header({
page={page}
/>
<NavMobile className="md:hidden" />
- </div>
- </nav>
- </header>
+ </StatusPageHeaderActions>
+ </StatusPageHeaderContent>
+ </StatusPageHeader>
);
}
-function NavDesktop({ className, ...props }: React.ComponentProps<"ul">) {
+function NavDesktop({
+ className,
+ ...props
+}: React.ComponentProps<typeof StatusPageHeaderNav>) {
const nav = useNav();
return (
- <ul className={cn("flex flex-row gap-0.5", className)} {...props}>
- {nav.map((item) => {
- return (
- <li key={item.key}>
- <Button
- variant={item.isActive ? "secondary" : "ghost"}
- className={cn(
- "border",
- item.isActive ? "border-input" : "border-transparent",
- )}
- size="sm"
- asChild
- >
- <NextLink href={item.href}>{item.label}</NextLink>
- </Button>
- </li>
- );
- })}
- </ul>
+ <StatusPageHeaderNav className={className} {...props}>
+ {nav.map((item) => (
+ <StatusPageHeaderNavItem key={item.key} isActive={item.isActive}>
+ <NextLink href={item.href}>{item.label}</NextLink>
+ </StatusPageHeaderNavItem>
+ ))}
+ </StatusPageHeaderNav>
);
}
@@ -243,54 +232,3 @@ function NavMobile({
</Sheet>
);
}
-
-function GetInTouch({
- buttonType,
- className,
- link,
- ...props
-}: React.ComponentProps<typeof Button> & {
- buttonType: "icon" | "text";
- link: string;
-}) {
- const t = useExtracted();
- if (buttonType === "text") {
- return (
- <Button
- variant="outline"
- size="sm"
- type="button"
- className={className}
- asChild
- {...props}
- >
- <a href={link} target="_blank" rel="noreferrer">
- {t("Get in touch")}
- </a>
- </Button>
- );
- }
- return (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- size="icon"
- type="button"
- className={cn("size-8", className)}
- asChild
- {...props}
- >
- <a href={link} target="_blank" rel="noreferrer">
- <MessageCircleMore />
- </a>
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- <p>{t("Get in touch")}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- );
-}
diff --git a/apps/status-page/src/components/status-page/static/status-component-static.tsx b/apps/status-page/src/components/status-page/static/status-component-static.tsx
new file mode 100644
index 000000000..4a9ae94bf
--- /dev/null
+++ b/apps/status-page/src/components/status-page/static/status-component-static.tsx
@@ -0,0 +1,82 @@
+"use client";
+
+import type { RouterOutputs } from "@openstatus/api";
+import {
+ StatusBar,
+ StatusBarSkeleton,
+} from "@openstatus/ui/components/blocks/status-bar";
+import {
+ StatusComponent,
+ StatusComponentBody,
+ StatusComponentDescription,
+ StatusComponentFooter,
+ StatusComponentHeader,
+ StatusComponentHeaderLeft,
+ StatusComponentHeaderRight,
+ StatusComponentIcon,
+ StatusComponentStatus,
+ StatusComponentTitle,
+ StatusComponentUptime,
+ StatusComponentUptimeSkeleton,
+} from "@openstatus/ui/components/blocks/status-component";
+import { cn } from "@openstatus/ui/lib/utils";
+
+type VariantType = "success" | "degraded" | "error" | "info";
+
+type Data = NonNullable<
+ RouterOutputs["statusPage"]["getUptime"]
+>[number]["data"];
+
+/**
+ * StatusComponentStatic — non-interactive status-component card used by the
+ * theme playground / static preview at `apps/(public)/client.tsx`. Composes
+ * the canonical block primitives directly; no Link wiring (no live page).
+ */
+export function StatusComponentStatic({
+ className,
+ status = "success",
+ showUptime = true,
+ data = [],
+ monitor,
+ uptime,
+ isLoading = false,
+}: {
+ className?: string;
+ status?: VariantType;
+ showUptime?: boolean;
+ uptime?: string;
+ monitor: { name: string; description?: string | null };
+ data?: Data;
+ isLoading?: boolean;
+}) {
+ return (
+ <StatusComponent variant={status} className={cn(className)}>
+ <StatusComponentHeader>
+ <StatusComponentHeaderLeft>
+ <StatusComponentTitle>{monitor.name}</StatusComponentTitle>
+ <StatusComponentDescription>
+ {monitor.description}
+ </StatusComponentDescription>
+ </StatusComponentHeaderLeft>
+ <StatusComponentHeaderRight>
+ {showUptime ? (
+ <>
+ {isLoading ? (
+ <StatusComponentUptimeSkeleton />
+ ) : (
+ <StatusComponentUptime>{uptime}</StatusComponentUptime>
+ )}
+ <StatusComponentIcon />
+ </>
+ ) : (
+ <StatusComponentStatus />
+ )}
+ </StatusComponentHeaderRight>
+ </StatusComponentHeader>
+ <StatusComponentBody>
+ {isLoading ? <StatusBarSkeleton /> : <StatusBar data={data} />}
+ <StatusComponentFooter data={data} isLoading={isLoading} />
+ </StatusComponentBody>
+ </StatusComponent>
+ );
+}
diff --git a/apps/status-page/src/components/status-page/static/status-monitor-static.tsx b/apps/status-page/src/components/status-page/static/status-monitor-static.tsx
deleted file mode 100644
index f1a3a136b..000000000
--- a/apps/status-page/src/components/status-page/static/status-monitor-static.tsx
+++ /dev/null
@@ -1,165 +0,0 @@
-"use client";
-
-import type { RouterOutputs } from "@openstatus/api";
-import {
- StatusBar,
- StatusBarSkeleton,
-} from "@openstatus/ui/components/blocks/status-bar";
-import { Skeleton } from "@openstatus/ui/components/ui/skeleton";
-import { cn } from "@openstatus/ui/lib/utils";
-import { formatDistanceToNowStrict } from "date-fns";
-import {
- AlertCircleIcon,
- CheckIcon,
- TriangleAlertIcon,
- WrenchIcon,
-} from "lucide-react";
-import {
- StatusMonitorDescription,
- StatusMonitorTitle,
- StatusMonitorUptime,
- StatusMonitorUptimeSkeleton,
-} from "../status-monitor";
-
-type VariantType = "success" | "degraded" | "error" | "info";
-
-type Data = NonNullable<
- RouterOutputs["statusPage"]["getUptime"]
->[number]["data"];
-
-export function StatusMonitorStatic({
- className,
- status = "success",
- showUptime = true,
- data = [],
- monitor,
- uptime,
- isLoading = false,
- ...props
-}: React.ComponentProps<"div"> & {
- status?: VariantType;
- showUptime?: boolean;
- uptime?: string;
- monitor: {
- name: string;
- description?: string | null;
- };
- data?: Data;
- isLoading?: boolean;
-}) {
- return (
- <div
- data-slot="status-monitor"
- data-variant={status}
- className={cn("group/monitor flex flex-col gap-1", className)}
- {...props}
- >
- <div className="flex flex-row items-center justify-between gap-4">
- <div className="flex min-w-0 flex-row items-center gap-2">
- <StatusMonitorTitle>{monitor.name}</StatusMonitorTitle>
- <StatusMonitorDescription>
- {monitor.description}
- </StatusMonitorDescription>
- </div>
- <div className="flex flex-row items-center gap-2">
- {showUptime ? (
- <>
- {isLoading ? (
- <StatusMonitorUptimeSkeleton />
- ) : (
- <StatusMonitorUptime>{uptime}</StatusMonitorUptime>
- )}
- <StatusMonitorIconStatic />
- </>
- ) : (
- <StatusMonitorStatusStatic />
- )}
- </div>
- </div>
- {isLoading ? <StatusBarSkeleton /> : <StatusBar data={data} />}
- <StatusMonitorFooterStatic data={data} isLoading={isLoading} />
- </div>
- );
-}
-
-function StatusMonitorFooterStatic({
- data,
- isLoading,
-}: {
- data: Data;
- isLoading?: boolean;
-}) {
- return (
- <div className="flex flex-row items-center justify-between font-mono text-muted-foreground text-xs leading-none">
- <div>
- {isLoading ? (
- <Skeleton className="h-3 w-18" />
- ) : data.length > 0 ? (
- formatDistanceToNowStrict(new Date(data[0].day), {
- unit: "day",
- addSuffix: true,
- })
- ) : (
- "-"
- )}
- </div>
- <div>today</div>
- </div>
- );
-}
-
-function StatusMonitorIconStatic({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "flex size-[12.5px] items-center justify-center rounded-full bg-muted text-background [&>svg]:size-[9px]",
- "group-data-[variant=success]/monitor:bg-success",
- "group-data-[variant=degraded]/monitor:bg-warning",
- "group-data-[variant=error]/monitor:bg-destructive",
- "group-data-[variant=info]/monitor:bg-info",
- className,
- )}
- {...props}
- >
- <CheckIcon className="hidden group-data-[variant=success]/monitor:block" />
- <TriangleAlertIcon className="hidden group-data-[variant=degraded]/monitor:block" />
- <AlertCircleIcon className="hidden group-data-[variant=error]/monitor:block" />
- <WrenchIcon className="hidden group-data-[variant=info]/monitor:block" />
- </div>
- );
-}
-
-function StatusMonitorStatusStatic({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "font-mono text-sm leading-none",
- "group-data-[variant=success]/monitor:text-success",
- "group-data-[variant=degraded]/monitor:text-warning",
- "group-data-[variant=error]/monitor:text-destructive",
- "group-data-[variant=info]/monitor:text-info",
- className,
- )}
- {...props}
- >
- <span className="hidden group-data-[variant=success]/monitor:block">
- Operational
- </span>
- <span className="hidden group-data-[variant=degraded]/monitor:block">
- Degraded
- </span>
- <span className="hidden group-data-[variant=error]/monitor:block">
- Downtime
- </span>
- <span className="hidden group-data-[variant=info]/monitor:block">
- Maintenance
- </span>
- </div>
- );
-}
diff --git a/apps/status-page/src/components/status-page/status-banner.tsx b/apps/status-page/src/components/status-page/status-banner.tsx
index 4fd66d12c..3f020a5ac 100644
--- a/apps/status-page/src/components/status-page/status-banner.tsx
+++ b/apps/status-page/src/components/status-page/status-banner.tsx
@@ -1,246 +1,14 @@
-"use client";
-
-import {
- Tabs,
- TabsContent,
- TabsList,
- TabsTrigger,
-} from "@openstatus/ui/components/ui/tabs";
-import { cn } from "@openstatus/ui/lib/utils";
-import {
- AlertCircleIcon,
- CheckIcon,
- TriangleAlertIcon,
- WrenchIcon,
-} from "lucide-react";
-import { useExtracted } from "next-intl";
-import { StatusTimestamp } from "./status";
-
-export function StatusBanner({
- className,
- status,
-}: React.ComponentProps<"div"> & {
- status?: "success" | "degraded" | "error" | "info";
-}) {
- return (
- <StatusBannerContainer
- status={status}
- className={cn(
- "flex items-center gap-3 px-3 py-2 sm:px-4 sm:py-3",
- "data-[status=success]:bg-success/20",
- "data-[status=degraded]:bg-warning/20",
- "data-[status=error]:bg-destructive/20",
- "data-[status=info]:bg-info/20",
- className,
- )}
- >
- <StatusBannerIcon className="flex-shrink-0" />
- <div className="flex flex-1 flex-wrap items-center justify-between gap-2">
- <StatusBannerMessage className="font-semibold text-xl" />
- <StatusTimestamp date={new Date()} className="text-xs" />
- </div>
- </StatusBannerContainer>
- );
-}
-
-export function StatusBannerContainer({
- className,
- children,
- status,
-}: React.ComponentProps<"div"> & {
- status?: "success" | "degraded" | "error" | "info";
-}) {
- return (
- <div
- data-slot="status-banner"
- data-status={status}
- className={cn(
- "group/status-banner overflow-hidden rounded-lg border",
- "data-[status=success]:border-success data-[status=success]:bg-success/5 dark:data-[status=success]:bg-success/10",
- "data-[status=degraded]:border-warning data-[status=degraded]:bg-warning/5 dark:data-[status=degraded]:bg-warning/10",
- "data-[status=error]:border-destructive data-[status=error]:bg-destructive/5 dark:data-[status=error]:bg-destructive/10",
- "data-[status=info]:border-info data-[status=info]:bg-info/5 dark:data-[status=info]:bg-info/10",
- className,
- )}
- >
- {children}
- </div>
- );
-}
-
-export function StatusBannerMessage({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- const t = useExtracted();
- return (
- <div className={cn(className)} {...props}>
- <span className="hidden group-data-[status=success]/status-banner:block">
- {t("All Systems Operational")}
- </span>
- <span className="hidden group-data-[status=degraded]/status-banner:block">
- {t("Degraded Performance")}
- </span>
- <span className="hidden group-data-[status=error]/status-banner:block">
- {t("Downtime Performance")}
- </span>
- <span className="hidden group-data-[status=info]/status-banner:block">
- {t("Maintenance")}
- </span>
- </div>
- );
-}
-
-export function StatusBannerTitle({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "px-3 py-2 font-medium text-background",
- "group-data-[status=success]/status-banner:bg-success",
- "group-data-[status=degraded]/status-banner:bg-warning",
- "group-data-[status=error]/status-banner:bg-destructive",
- "group-data-[status=info]/status-banner:bg-info",
- className,
- )}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-export function StatusBannerContent({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn("flex flex-col gap-2 px-3 py-2 sm:px-4 sm:py-3", className)}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-export function StatusBannerIcon({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "flex size-7 items-center justify-center rounded-full bg-muted text-background [&>svg]:size-4",
- "group-data-[status=success]/status-banner:bg-success",
- "group-data-[status=degraded]/status-banner:bg-warning",
- "group-data-[status=error]/status-banner:bg-destructive",
- "group-data-[status=info]/status-banner:bg-info",
- className,
- )}
- {...props}
- >
- <CheckIcon className="hidden group-data-[status=success]/status-banner:block" />
- <TriangleAlertIcon className="hidden group-data-[status=degraded]/status-banner:block" />
- <AlertCircleIcon className="hidden group-data-[status=error]/status-banner:block" />
- <WrenchIcon className="hidden group-data-[status=info]/status-banner:block" />
- </div>
- );
-}
-
-// Tabs Components
-
-export function StatusBannerTabs({
- className,
- children,
- status,
- ...props
-}: React.ComponentProps<typeof Tabs> & {
- status?: "success" | "degraded" | "error" | "info";
-}) {
- return (
- <Tabs
- data-slot="status-banner-tabs"
- data-status={status}
- className={cn(
- "gap-0",
- "data-[status=success]:bg-success/20",
- "data-[status=degraded]:bg-warning/20",
- "data-[status=error]:bg-destructive/20",
- "data-[status=info]:bg-info/20",
- className,
- )}
- {...props}
- >
- {children}
- </Tabs>
- );
-}
-
-export function StatusBannerTabsList({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof TabsList>) {
- return (
- <div className={cn("rounded-t-lg", "w-full overflow-x-auto")}>
- <TabsList
- className={cn(
- "rounded-none rounded-t-lg p-0",
- "border-none",
- className,
- )}
- {...props}
- >
- {children}
- </TabsList>
- </div>
- );
-}
-
-export function StatusBannerTabsTrigger({
- className,
- children,
- status,
- ...props
-}: React.ComponentProps<typeof TabsTrigger> & {
- status?: "success" | "degraded" | "error" | "info";
-}) {
- return (
- <TabsTrigger
- data-slot="status-banner-tabs-trigger"
- data-status={status}
- className={cn(
- "font-mono",
- "rounded-none border-none focus-visible:ring-inset",
- "h-full text-foreground data-[state=active]:text-background dark:text-foreground dark:data-[state=active]:text-background",
- "data-[state=active]:data-[status=success]:bg-success data-[status=success]:bg-success/50 dark:data-[state=active]:data-[status=success]:bg-success dark:data-[status=success]:bg-success/50",
- "data-[state=active]:data-[status=degraded]:bg-warning data-[status=degraded]:bg-warning/50 dark:data-[state=active]:data-[status=degraded]:bg-warning dark:data-[status=degraded]:bg-warning/50",
- "data-[state=active]:data-[status=error]:bg-destructive data-[status=error]:bg-destructive/50 dark:data-[state=active]:data-[status=error]:bg-destructive dark:data-[status=error]:bg-destructive/50",
- "data-[state=active]:data-[status=info]:bg-info data-[status=info]:bg-info/50 dark:data-[state=active]:data-[status=info]:bg-info dark:data-[status=info]:bg-info/50",
- "data-[state=active]:shadow-none",
- className,
- )}
- {...props}
- >
- {children}
- </TabsTrigger>
- );
-}
-
-// NOTE: tabing into content is not being highlighted
-export function StatusBannerTabsContent({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof TabsContent>) {
- return (
- <TabsContent className={cn("-mx-3", className)} {...props}>
- {children}
- </TabsContent>
- );
-}
+// Re-exports the canonical block. Translations come from
+// `<StatusBlocksProvider>` mounted in `[locale]/layout.tsx`.
+export {
+ StatusBanner,
+ StatusBannerContainer,
+ StatusBannerMessage,
+ StatusBannerTitle,
+ StatusBannerContent,
+ StatusBannerIcon,
+ StatusBannerTabs,
+ StatusBannerTabsList,
+ StatusBannerTabsTrigger,
+ StatusBannerTabsContent,
+} from "@openstatus/ui/components/blocks/status-banner";
diff --git a/apps/status-page/src/components/status-page/status-bar.tsx b/apps/status-page/src/components/status-page/status-bar.tsx
new file mode 100644
index 000000000..668d51e59
--- /dev/null
+++ b/apps/status-page/src/components/status-page/status-bar.tsx
@@ -0,0 +1,50 @@
+"use client";
+
+import { Link } from "@/components/common/link";
+import { usePathnamePrefix } from "@/hooks/use-pathname-prefix";
+import {
+ StatusBar as BlockStatusBar,
+ StatusBarEvent,
+} from "@openstatus/ui/components/blocks/status-bar";
+
+export { StatusBarSkeleton } from "@openstatus/ui/components/blocks/status-bar";
+
+/**
+ * StatusBar — wrapper that wires Next.js `<Link>` (with locale/slug prefix)
+ * around report/maintenance event badges in the hover card. Incidents stay
+ * unwrapped (no detail page).
+ */
+export function StatusBar(
+ props: Omit<React.ComponentProps<typeof BlockStatusBar>, "renderEvent">,
+) {
+ const prefix = usePathnamePrefix();
+ return (
+ <BlockStatusBar
+ renderEvent={(event, index) => {
+ const node = (
+ <StatusBarEvent
+ key={`${event.id}-${event.type}-${index}`}
+ type={event.type}
+ name={event.name}
+ from={event.from}
+ to={event.to}
+ isAggregated={event.isAggregated}
+ />
+ );
+ if (event.type === "report" || event.type === "maintenance") {
+ return (
+ <Link
+ variant="unstyled"
+ key={`${event.id}-${event.type}-${index}`}
+ href={`${prefix ? `/${prefix}` : ""}/events/${event.type}/${event.id}`}
+ >
+ {node}
+ </Link>
+ );
+ }
+ return node;
+ }}
+ {...props}
+ />
+ );
+}
diff --git a/apps/status-page/src/components/status-page/status-blank.tsx b/apps/status-page/src/components/status-page/status-blank.tsx
index 86d4834c3..38c792bd0 100644
--- a/apps/status-page/src/components/status-page/status-blank.tsx
+++ b/apps/status-page/src/components/status-page/status-blank.tsx
@@ -3,53 +3,28 @@
import { Link } from "@/components/common/link";
import { Button } from "@openstatus/ui/components/ui/button";
import { cn } from "@openstatus/ui/lib/utils";
-import { useExtracted } from "next-intl";
-
-export function StatusBlankContainer({
- children,
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "flex flex-col items-center justify-center gap-2.5 rounded-lg border bg-muted/30 px-3 py-2 text-center sm:px-8 sm:py-6",
- className,
- )}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-export function StatusBlankTitle({
- children,
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div className={cn("font-medium", className)} {...props}>
- {children}
- </div>
- );
-}
-
-export function StatusBlankDescription({
- children,
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn("font-mono text-muted-foreground text-sm", className)}
- {...props}
- >
- {children}
- </div>
- );
-}
+export {
+ StatusBlankContainer,
+ StatusBlankTitle,
+ StatusBlankDescription,
+ StatusBlankContent,
+ StatusBlankReport,
+ StatusBlankMonitor,
+ StatusBlankPage,
+ StatusBlankPageHeader,
+ StatusBlankMonitorUptime,
+ StatusBlankReportUpdate,
+ StatusBlankOverlay,
+ StatusBlankAction,
+ StatusBlankEvents,
+ StatusBlankMonitors,
+} from "@openstatus/ui/components/blocks/status-blank";
+
+/**
+ * StatusBlankLink — outlined Button-as-Link CTA for empty states.
+ * Kept as the canonical look used outside `StatusBlankEvents`/`Monitors`.
+ */
export function StatusBlankLink({
children,
className,
@@ -70,205 +45,3 @@ export function StatusBlankLink({
</Button>
);
}
-
-export function StatusBlankContent({
- children,
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div className={cn("space-y-1", className)} {...props}>
- {children}
- </div>
- );
-}
-
-export function StatusBlankReport({ ...props }: React.ComponentProps<"div">) {
- return (
- <StatusBlankPage {...props}>
- <StatusBlankPageHeader />
- <div className="flex w-full flex-col">
- <StatusBlankReportUpdate />
- <StatusBlankReportUpdate />
- </div>
- <StatusBlankOverlay />
- </StatusBlankPage>
- );
-}
-
-export function StatusBlankMonitor({ ...props }: React.ComponentProps<"div">) {
- return (
- <StatusBlankPage {...props}>
- <StatusBlankPageHeader />
- <StatusBlankMonitorUptime />
- <StatusBlankOverlay />
- </StatusBlankPage>
- );
-}
-
-export function StatusBlankPage({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "relative flex w-full max-w-xs flex-1 flex-col items-center justify-center gap-4 overflow-hidden rounded-lg border border-border/70 bg-background px-3 py-2 text-center",
- className,
- )}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-export function StatusBlankPageHeader({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "flex w-full items-center justify-between gap-4",
- className,
- )}
- {...props}
- >
- <div className="size-3 rounded-sm bg-accent/60" />
- <div className="flex flex-row gap-1">
- <div className="h-3 w-8 rounded-sm bg-accent/60" />
- <div className="h-3 w-8 rounded-sm bg-accent/60" />
- <div className="h-3 w-8 rounded-sm bg-accent/60" />
- </div>
- <div className="h-3 w-8 rounded-sm bg-accent/60" />
- </div>
- );
-}
-
-export function StatusBlankMonitorUptime({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "flex w-full flex-col items-center justify-between gap-1",
- className,
- )}
- {...props}
- >
- <div className="flex w-full flex-row gap-1">
- <div className="h-3 w-8 rounded-sm bg-accent" />
- <div className="h-3 w-12 rounded-sm bg-accent" />
- <div className="h-3 w-10 rounded-sm bg-accent" />
- </div>
- <div className="flex w-full flex-row items-end gap-0.5">
- {Array.from({ length: 30 }).map((_, index) => (
- <div
- key={index}
- className={cn(
- "h-12 flex-1 rounded-sm bg-accent",
- [10, 20].includes(index) && "h-8",
- [25].includes(index) && "h-10",
- )}
- />
- ))}
- </div>
- </div>
- );
-}
-
-export function StatusBlankReportUpdate({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div className={cn("flex w-full items-start gap-2", className)} {...props}>
- <div className="flex h-full flex-col items-center gap-0.5">
- <div className="size-3 rounded-sm bg-accent" />
- </div>
- <div className="flex flex-1 flex-col gap-1 pb-2">
- <div className="flex items-center gap-1">
- <div className="h-3 w-12 rounded-sm bg-accent" />
- <div className="h-3 w-16 rounded-sm bg-accent" />
- </div>
- <div className="h-3 w-full rounded-sm bg-accent" />
- <div className="h-3 w-full rounded-sm bg-accent" />
- </div>
- </div>
- );
-}
-
-export function StatusBlankOverlay({
- children,
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "absolute inset-0 flex flex-col items-center justify-center gap-2 bg-gradient-to-b from-40% from-transparent to-background p-2",
- className,
- )}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-export function StatusBlankEvents({
- title,
- description,
- ...props
-}: React.ComponentProps<typeof StatusBlankContainer> & {
- title?: string;
- description?: string;
-}) {
- const t = useExtracted();
- const resolvedTitle = title ?? t("No reports found");
- const resolvedDescription =
- description ?? t("No reports found for this status page.");
- return (
- <StatusBlankContainer {...props}>
- <div className="relative mt-8 flex w-full flex-col items-center justify-center">
- <StatusBlankReport className="-top-16 absolute scale-60 opacity-50" />
- <StatusBlankReport className="-top-8 absolute scale-80 opacity-80" />
- <StatusBlankReport />
- </div>
- <StatusBlankContent>
- <StatusBlankTitle>{resolvedTitle}</StatusBlankTitle>
- <StatusBlankDescription>{resolvedDescription}</StatusBlankDescription>
- </StatusBlankContent>
- </StatusBlankContainer>
- );
-}
-
-export function StatusBlankMonitors({
- title,
- description,
- ...props
-}: React.ComponentProps<typeof StatusBlankContainer> & {
- title?: string;
- description?: string;
-}) {
- const t = useExtracted();
- const resolvedTitle = title ?? t("No public monitors");
- const resolvedDescription =
- description ?? t("No public monitors have been added to this page.");
- return (
- <StatusBlankContainer {...props}>
- <div className="relative mt-8 flex w-full flex-col items-center justify-center">
- <StatusBlankMonitor className="-top-16 absolute scale-60 opacity-50" />
- <StatusBlankMonitor className="-top-8 absolute scale-80 opacity-80" />
- <StatusBlankMonitor />
- </div>
- <StatusBlankContent>
- <StatusBlankTitle>{resolvedTitle}</StatusBlankTitle>
- <StatusBlankDescription>{resolvedDescription}</StatusBlankDescription>
- </StatusBlankContent>
- </StatusBlankContainer>
- );
-}
diff --git a/apps/status-page/src/components/status-page/status-tracker-group.tsx b/apps/status-page/src/components/status-page/status-component-group.tsx
similarity index 67%
rename from apps/status-page/src/components/status-page/status-tracker-group.tsx
rename to apps/status-page/src/components/status-page/status-component-group.tsx
index 310ca7bc3..376b1d585 100644
--- a/apps/status-page/src/components/status-page/status-tracker-group.tsx
+++ b/apps/status-page/src/components/status-page/status-component-group.tsx
@@ -1,5 +1,9 @@
"use client";
+import {
+ StatusComponentIcon,
+ StatusComponentStatus,
+} from "@openstatus/ui/components/blocks/status-component";
import {
Collapsible,
CollapsibleContent,
@@ -7,10 +11,17 @@ import {
} from "@openstatus/ui/components/ui/collapsible";
import { cn } from "@openstatus/ui/lib/utils";
import { useEffect, useState } from "react";
-import type { VariantType } from "./floating-button";
-import { StatusMonitorIcon, StatusMonitorStatus } from "./status-monitor";
-export function StatusTrackerGroup({
+type VariantType = "success" | "degraded" | "error" | "info";
+
+/**
+ * StatusComponentGroup — collapsible aggregation of status components.
+ *
+ * Replaces the legacy `StatusTrackerGroup`. Renders the trigger with the
+ * group title + aggregated status, and the children (individual `<StatusComponent>`
+ * nodes) inside an animated collapsible region.
+ */
+export function StatusComponentGroup({
children,
title,
status,
@@ -40,7 +51,7 @@ export function StatusTrackerGroup({
>
<CollapsibleTrigger
className={cn(
- "group/monitor flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 font-medium font-mono",
+ "group/component flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 font-medium font-mono",
"cursor-pointer",
className,
)}
@@ -49,8 +60,8 @@ export function StatusTrackerGroup({
>
{title}
<div className="flex items-center gap-2">
- <StatusMonitorStatus className="text-sm" />
- <StatusMonitorIcon />
+ <StatusComponentStatus className="text-sm" />
+ <StatusComponentIcon />
</div>
</CollapsibleTrigger>
<CollapsibleContent
@@ -58,7 +69,6 @@ export function StatusTrackerGroup({
className={cn(
"flex flex-col gap-3 border-border/50 border-t px-3 py-2",
"overflow-hidden",
- // REMINDER: otherwise, if defaultOpen is true, the animation will be triggered and we have a layout shift
"data-[animate=true]:data-[state=closed]:animate-collapsible-up data-[animate=true]:data-[state=open]:animate-collapsible-down",
)}
>
diff --git a/apps/status-page/src/components/status-page/status-events.tsx b/apps/status-page/src/components/status-page/status-events.tsx
index 70d165af9..92c08f7d8 100644
--- a/apps/status-page/src/components/status-page/status-events.tsx
+++ b/apps/status-page/src/components/status-page/status-events.tsx
@@ -1,368 +1,84 @@
+"use client";
+
import { ProcessMessage } from "@/components/content/process-message";
-import { TimestampHoverCard } from "@/components/content/timestamp-hover-card";
-import { formatDate, formatDateRange, formatDateTime } from "@/lib/formatter";
import {
- StatusEventTimelineDot,
+ StatusEventTimelineMaintenance as BlockStatusEventTimelineMaintenance,
+ StatusEventTimelineReport as BlockStatusEventTimelineReport,
+ StatusEventTimelineReportUpdate as BlockStatusEventTimelineReportUpdate,
+} from "@openstatus/ui/components/blocks/status-events";
+
+// Re-export pass-through primitives that don't need glue.
+export {
+ StatusEvent,
+ StatusEventGroup,
+ StatusEventContent,
+ StatusEventTitle,
+ StatusEventTitleCheck,
+ StatusEventAffected,
+ StatusEventAffectedBadge,
+ StatusEventDate,
+ StatusEventAside,
+ StatusEventTimelineTitle,
StatusEventTimelineMessage,
+ StatusEventTimelineDot,
StatusEventTimelineSeparator,
- StatusEventTimelineTitle,
} from "@openstatus/ui/components/blocks/status-events";
-import { Badge } from "@openstatus/ui/components/ui/badge";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@openstatus/ui/components/ui/tooltip";
-import { cn } from "@openstatus/ui/lib/utils";
-import { formatDistanceStrict } from "date-fns";
-import { Check } from "lucide-react";
-import { useExtracted, useLocale } from "next-intl";
-
-export function StatusEventGroup({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div className={cn("flex flex-col gap-4", className)} {...props}>
- {children}
- </div>
- );
-}
-
-export function StatusEvent({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div className={cn("relative flex flex-col gap-2", className)} {...props}>
- {children}
- </div>
- );
-}
-export function StatusEventContent({
- className,
- hoverable = true,
- children,
- ...props
-}: React.ComponentProps<"div"> & {
- hoverable?: boolean;
-}) {
- // TODO: add Link
+const renderMarkdownMessage = (message: string) => (
+ <ProcessMessage value={message} />
+);
+
+/**
+ * StatusEventTimelineReport — wrapper that pipes user-authored markdown
+ * through `<ProcessMessage>` so report messages render with formatting.
+ */
+export function StatusEventTimelineReport(
+ props: Omit<
+ React.ComponentProps<typeof BlockStatusEventTimelineReport>,
+ "renderMessage"
+ >,
+) {
return (
- <div
- data-hoverable={hoverable}
- className={cn(
- "group -mx-3 -my-2 flex flex-col gap-2 rounded-lg border border-transparent px-3 py-2",
- "data-[hoverable=true]:hover:cursor-pointer data-[hoverable=true]:hover:border-border/50 data-[hoverable=true]:hover:bg-muted/50",
- className,
- )}
+ <BlockStatusEventTimelineReport
+ renderMessage={renderMarkdownMessage}
{...props}
- >
- {children}
- </div>
- );
-}
-
-export function StatusEventTitle({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div className={cn("font-medium", className)} {...props}>
- {children}
- </div>
+ />
);
}
-export function StatusEventTitleCheck({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
- const t = useExtracted();
+/**
+ * StatusEventTimelineMaintenance — wrapper that pipes user-authored markdown
+ * through `<ProcessMessage>` so maintenance messages render with formatting.
+ */
+export function StatusEventTimelineMaintenance(
+ props: Omit<
+ React.ComponentProps<typeof BlockStatusEventTimelineMaintenance>,
+ "renderMessage"
+ >,
+) {
return (
- <div className={cn("flex items-center pl-1", className)} {...props}>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger>
- <div className="rounded-full border border-success/20 bg-success/10 p-0.5 text-success">
- <Check className="size-3 shrink-0" />
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>{t("Report resolved")}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- );
-}
-
-// TODO: affected monitors
-export function StatusEventAffected({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div className={cn("flex flex-wrap gap-1", className)} {...props}>
- {children}
- </div>
- );
-}
-
-export function StatusEventAffectedBadge({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <Badge
- variant="secondary"
- className={cn("text-[10px]", className)}
+ <BlockStatusEventTimelineMaintenance
+ renderMessage={renderMarkdownMessage}
{...props}
- >
- {children}
- </Badge>
+ />
);
}
-export function StatusEventDate({
- className,
- date,
- ...props
-}: React.ComponentProps<"div"> & {
- date: Date;
-}) {
- const locale = useLocale();
- const isFuture = date > new Date();
- const distance = formatDistanceStrict(date, new Date(), { addSuffix: true });
+/**
+ * StatusEventTimelineReportUpdate — wrapper for single-update rendering
+ * (used by the banner tabs to show only the latest update). Pipes markdown
+ * through `<ProcessMessage>`.
+ */
+export function StatusEventTimelineReportUpdate(
+ props: Omit<
+ React.ComponentProps<typeof BlockStatusEventTimelineReportUpdate>,
+ "renderMessage"
+ >,
+) {
return (
- <div className={cn("flex gap-2 lg:flex-col", className)} {...props}>
- <div className="font-medium text-foreground">
- {formatDate(date, { month: "short", locale })}
- </div>{" "}
- <Badge
- variant="secondary"
- className={cn(
- "text-[10px]",
- isFuture ? "bg-info text-background dark:text-foreground" : "",
- )}
- >
- {distance}
- </Badge>
- </div>
- );
-}
-
-export function StatusEventAside({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div className="lg:-left-32 border border-transparent lg:absolute lg:top-0 lg:h-full">
- <div className={cn("lg:sticky lg:top-0 lg:left-0", className)} {...props}>
- {children}
- </div>
- </div>
- );
-}
-
-export function StatusEventTimelineReport({
- className,
- updates,
- withDot = true,
- maxUpdates,
- reportId,
- ...props
-}: React.ComponentProps<"div"> & {
- // TODO: remove unused props
- reportId: number;
- updates: {
- date: Date;
- message: string;
- status: "investigating" | "identified" | "monitoring" | "resolved";
- }[];
- withDot?: boolean;
- maxUpdates?: number;
-}) {
- const t = useExtracted();
- const sortedUpdates = [...updates].sort(
- (a, b) => b.date.getTime() - a.date.getTime(),
- );
- const displayedUpdates = maxUpdates
- ? sortedUpdates.slice(0, maxUpdates)
- : sortedUpdates;
-
- return (
- <div className={cn("text-muted-foreground text-sm", className)} {...props}>
- {/* NOTE: make sure they are sorted by date */}
- {displayedUpdates.map((update, index) => {
- const updateDate = new Date(update.date);
- let durationText: string | undefined;
-
- if (index === 0) {
- const startedAt = new Date(
- sortedUpdates[sortedUpdates.length - 1].date,
- );
- const duration = formatDistanceStrict(startedAt, updateDate);
-
- if (duration !== "0 seconds" && update.status === "resolved") {
- durationText = t("(in {duration})", { duration });
- }
- } else {
- const lastUpdateDate = new Date(displayedUpdates[index - 1].date);
- const timeFromLast = formatDistanceStrict(updateDate, lastUpdateDate);
- durationText = t("({timeFromLast} earlier)", { timeFromLast });
- }
-
- return (
- <StatusEventTimelineReportUpdate
- key={index}
- report={update}
- duration={durationText}
- withSeparator={index !== displayedUpdates.length - 1}
- withDot={withDot}
- isLast={index === displayedUpdates.length - 1}
- />
- );
- })}
- </div>
- );
-}
-
-export function StatusEventTimelineReportUpdate({
- report,
- duration,
- withSeparator = true,
- withDot = true,
- isLast = false,
-}: {
- report: {
- date: Date;
- message: string;
- status: "investigating" | "identified" | "monitoring" | "resolved";
- };
- withSeparator?: boolean;
- duration?: string;
- withDot?: boolean;
- isLast?: boolean;
-}) {
- const locale = useLocale();
- const t = useExtracted();
- const statusLabels = {
- resolved: t("Resolved"),
- monitoring: t("Monitoring"),
- identified: t("Identified"),
- investigating: t("Investigating"),
- } as const;
-
- return (
- <div data-variant={report.status} className="group">
- <div className="flex flex-row items-center justify-between gap-2">
- <div className="flex flex-row gap-4">
- {withDot ? (
- <div className="flex flex-col">
- <div className="flex h-5 flex-col items-center justify-center">
- <StatusEventTimelineDot />
- </div>
- {withSeparator ? <StatusEventTimelineSeparator /> : null}
- </div>
- ) : null}
- <div className={cn(isLast ? "mb-0" : "mb-2")}>
- <StatusEventTimelineTitle>
- <span>{statusLabels[report.status]}</span>{" "}
- <span className="text-muted-foreground/70">·</span>{" "}
- <span className="font-mono text-muted-foreground text-xs">
- <TimestampHoverCard date={new Date(report.date)} asChild>
- <span>{formatDateTime(report.date, locale)}</span>
- </TimestampHoverCard>
- </span>{" "}
- {duration ? (
- <span className="font-mono text-muted-foreground/70 text-xs">
- {duration}
- </span>
- ) : null}
- </StatusEventTimelineTitle>
- <StatusEventTimelineMessage>
- {report.message.trim() === "" ? (
- <span className="text-muted-foreground/70">-</span>
- ) : (
- <ProcessMessage value={report.message} />
- )}
- </StatusEventTimelineMessage>
- </div>
- </div>
- </div>
- </div>
- );
-}
-
-export function StatusEventTimelineMaintenance({
- maintenance,
- withDot = true,
-}: {
- maintenance: {
- title: string;
- message: string;
- from: Date;
- to: Date;
- };
- withDot?: boolean;
-}) {
- const locale = useLocale();
- const t = useExtracted();
- const duration = formatDistanceStrict(maintenance.from, maintenance.to);
- const range = formatDateRange(maintenance.from, maintenance.to, locale);
- // NOTE: because formatDateRange is sure to return a range, we can split it into two dates
- const [from, to] = range.split(" - ");
- return (
- <div data-variant="maintenance" className="group">
- <div className="flex flex-row items-center justify-between gap-2">
- <div className="flex flex-row gap-4">
- {withDot ? (
- <div className="flex flex-col">
- <div className="flex h-5 flex-col items-center justify-center">
- <StatusEventTimelineDot />
- </div>
- </div>
- ) : null}
- {/* NOTE: is always last, no need for className="mb-2" */}
- <div>
- <StatusEventTimelineTitle>
- <span>{t("Maintenance")}</span>{" "}
- <span className="text-muted-foreground/70">·</span>{" "}
- <span className="font-mono text-muted-foreground text-xs">
- <TimestampHoverCard date={maintenance.from} asChild>
- <span>{from}</span>
- </TimestampHoverCard>
- {" - "}
- <TimestampHoverCard date={maintenance.to} asChild>
- <span>{to}</span>
- </TimestampHoverCard>
- </span>{" "}
- {duration ? (
- <span className="font-mono text-muted-foreground/70 text-xs">
- {t("(for {duration})", { duration })}
- </span>
- ) : null}
- </StatusEventTimelineTitle>
- <StatusEventTimelineMessage>
- {maintenance.message.trim() === "" ? (
- <span className="text-muted-foreground/70">-</span>
- ) : (
- <ProcessMessage value={maintenance.message} />
- )}
- </StatusEventTimelineMessage>
- </div>
- </div>
- </div>
- </div>
+ <BlockStatusEventTimelineReportUpdate
+ renderMessage={renderMarkdownMessage}
+ {...props}
+ />
);
}
diff --git a/apps/status-page/src/components/status-page/status-feed.tsx b/apps/status-page/src/components/status-page/status-feed.tsx
index 0893494e5..5f54a21f9 100644
--- a/apps/status-page/src/components/status-page/status-feed.tsx
+++ b/apps/status-page/src/components/status-page/status-feed.tsx
@@ -1,194 +1,59 @@
"use client";
+
import { Link } from "@/components/common/link";
+import { ProcessMessage } from "@/components/content/process-message";
import { usePathnamePrefix } from "@/hooks/use-pathname-prefix";
+import { StatusBlankAction } from "@openstatus/ui/components/blocks/status-blank";
+import { StatusFeed as BlockStatusFeed } from "@openstatus/ui/components/blocks/status-feed";
import { useExtracted } from "next-intl";
-import {
- StatusBlankContainer,
- StatusBlankContent,
- StatusBlankDescription,
- StatusBlankLink,
- StatusBlankReport,
- StatusBlankTitle,
-} from "./status-blank";
-import {
- StatusEvent,
- StatusEventAffected,
- StatusEventAffectedBadge,
- StatusEventAside,
- StatusEventContent,
- StatusEventDate,
- StatusEventGroup,
- StatusEventTimelineMaintenance,
- StatusEventTimelineReport,
- StatusEventTitle,
-} from "./status-events";
-
-type StatusReport = {
- id: number;
- title: string;
- createdAt?: Date | null;
- affected: string[];
- updates: {
- date: Date;
- message: string;
- status: "investigating" | "identified" | "monitoring" | "resolved";
- }[];
-};
-
-type Maintenance = {
- id: number;
- title: string;
- message: string;
- from: Date;
- to: Date;
- affected: string[];
-};
+import { StatusBlankLink } from "./status-blank";
-type UnifiedEvent = {
- id: number;
- title: string;
- type: "report" | "maintenance";
- startDate: Date;
- data: StatusReport | Maintenance;
-};
+const renderMarkdownMessage = (message: string) => (
+ <ProcessMessage value={message} />
+);
export function StatusFeed({
statusReports = [],
maintenances = [],
...props
-}: React.ComponentProps<"div"> & {
- statusReports?: StatusReport[];
- maintenances?: Maintenance[];
- showLinks?: boolean;
-}) {
+}: Omit<
+ React.ComponentProps<typeof BlockStatusFeed>,
+ | "renderEvent"
+ | "renderReportMessage"
+ | "renderMaintenanceMessage"
+ | "footer"
+ | "emptyAction"
+>) {
const prefix = usePathnamePrefix();
const t = useExtracted();
- const unifiedEvents: UnifiedEvent[] = [
- ...statusReports.map((report) => ({
- id: report.id,
- title: report.title,
- type: "report" as const,
- // FIXME: we have a flicker here when the report is updated
- startDate:
- report.updates[report.updates.length - 1]?.date ??
- report.createdAt ??
- new Date(),
- data: report,
- })),
- ...maintenances.map((maintenance) => ({
- id: maintenance.id,
- title: maintenance.title,
- type: "maintenance" as const,
- startDate: maintenance.from,
- data: maintenance,
- })),
- ].sort((a, b) => b.startDate.getTime() - a.startDate.getTime());
-
- if (unifiedEvents.length === 0) {
- return (
- <StatusBlankContainer>
- <div className="relative mt-8 flex w-full flex-col items-center justify-center">
- <StatusBlankReport className="-top-16 absolute scale-60 opacity-50" />
- <StatusBlankReport className="-top-8 absolute scale-80 opacity-80" />
- <StatusBlankReport />
- </div>
- <StatusBlankContent>
- <StatusBlankTitle>{t("No recent notifications")}</StatusBlankTitle>
- <StatusBlankDescription>
- {t("There have been no reports within the last 7 days.")}
- </StatusBlankDescription>
- <StatusBlankLink href={`${prefix ? `/${prefix}` : ""}/events`}>
- {t("View events history")}
- </StatusBlankLink>
- </StatusBlankContent>
- </StatusBlankContainer>
- );
- }
+ const eventsHref = `${prefix ? `/${prefix}` : ""}/events`;
return (
- <StatusEventGroup {...props}>
- {unifiedEvents.map((event) => {
- if (event.type === "report") {
- const report = event.data as StatusReport;
- return (
- <StatusEvent key={`report-${event.id}`}>
- <StatusEventAside>
- <StatusEventDate date={event.startDate} />
- </StatusEventAside>
- <Link
- variant="unstyled"
- href={`${prefix ? `/${prefix}` : ""}/events/report/${
- report.id
- }`}
- className="rounded-lg"
- >
- <StatusEventContent>
- <StatusEventTitle>{report.title}</StatusEventTitle>
- {report.affected.length > 0 && (
- <StatusEventAffected>
- {report.affected.map((affected, index) => (
- <StatusEventAffectedBadge key={index}>
- {affected}
- </StatusEventAffectedBadge>
- ))}
- </StatusEventAffected>
- )}
- <StatusEventTimelineReport
- updates={report.updates}
- reportId={report.id}
- />
- </StatusEventContent>
- </Link>
- </StatusEvent>
- );
- }
-
- if (event.type === "maintenance") {
- const maintenance = event.data as Maintenance;
- return (
- <StatusEvent key={`maintenance-${event.id}`}>
- <StatusEventAside>
- <StatusEventDate date={event.startDate} />
- </StatusEventAside>
- <Link
- variant="unstyled"
- href={`${prefix ? `/${prefix}` : ""}/events/maintenance/${
- maintenance.id
- }`}
- className="rounded-lg"
- >
- <StatusEventContent>
- <StatusEventTitle>{maintenance.title}</StatusEventTitle>
- {maintenance.affected.length > 0 && (
- <StatusEventAffected>
- {maintenance.affected.map((affected, index) => (
- <StatusEventAffectedBadge key={index}>
- {affected}
- </StatusEventAffectedBadge>
- ))}
- </StatusEventAffected>
- )}
- <StatusEventTimelineMaintenance
- maintenance={{
- title: maintenance.title,
- message: maintenance.message,
- from: maintenance.from,
- to: maintenance.to,
- }}
- />
- </StatusEventContent>
- </Link>
- </StatusEvent>
- );
- }
- return null;
- })}
- <StatusBlankLink
- className="mx-auto"
- href={`${prefix ? `/${prefix}` : ""}/events`}
- >
- {t("View events history")}
- </StatusBlankLink>
- </StatusEventGroup>
+ <BlockStatusFeed
+ statusReports={statusReports}
+ maintenances={maintenances}
+ renderReportMessage={renderMarkdownMessage}
+ renderMaintenanceMessage={renderMarkdownMessage}
+ renderEvent={(event, content) => (
+ <Link
+ variant="unstyled"
+ href={`${prefix ? `/${prefix}` : ""}/events/${event.type}/${event.data.id}`}
+ className="rounded-lg"
+ >
+ {content}
+ </Link>
+ )}
+ emptyAction={
+ <StatusBlankAction>
+ <Link href={eventsHref}>{t("View events history")}</Link>
+ </StatusBlankAction>
+ }
+ footer={
+ <StatusBlankLink className="mx-auto mt-4" href={eventsHref}>
+ {t("View events history")}
+ </StatusBlankLink>
+ }
+ {...props}
+ />
);
}
diff --git a/apps/status-page/src/components/status-page/status-monitor.tsx b/apps/status-page/src/components/status-page/status-monitor.tsx
deleted file mode 100644
index e862249a2..000000000
--- a/apps/status-page/src/components/status-page/status-monitor.tsx
+++ /dev/null
@@ -1,244 +0,0 @@
-"use client";
-
-import type { RouterOutputs } from "@openstatus/api";
-import { Skeleton } from "@openstatus/ui/components/ui/skeleton";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@openstatus/ui/components/ui/tooltip";
-import { useMediaQuery } from "@openstatus/ui/hooks/use-media-query";
-import { cn } from "@openstatus/ui/lib/utils";
-import { formatDistanceToNowStrict } from "date-fns";
-import {
- AlertCircleIcon,
- CheckIcon,
- InfoIcon,
- TriangleAlertIcon,
- WrenchIcon,
-} from "lucide-react";
-import { useExtracted } from "next-intl";
-import { useState } from "react";
-import type { VariantType } from "./floating-button";
-import { StatusTracker, StatusTrackerSkeleton } from "./status-tracker";
-
-// TODO: use status instead of variant
-
-type Data = NonNullable<
- RouterOutputs["statusPage"]["getUptime"]
->[number]["data"];
-
-export function StatusMonitor({
- className,
- status = "success",
- showUptime = true,
- data = [],
- monitor,
- uptime,
- isLoading = false,
- ...props
-}: React.ComponentProps<"div"> & {
- status?: VariantType;
- showUptime?: boolean;
- uptime?: string;
- monitor: {
- name: string;
- description?: string | null;
- };
- data?: Data;
- isLoading?: boolean;
-}) {
- return (
- <div
- data-slot="status-monitor"
- data-variant={status}
- className={cn("group/monitor flex flex-col gap-1", className)}
- {...props}
- >
- <div className="flex flex-row items-center justify-between gap-4">
- <div className="flex min-w-0 flex-row items-center gap-2">
- <StatusMonitorTitle>{monitor.name}</StatusMonitorTitle>
- <StatusMonitorDescription>
- {monitor.description}
- </StatusMonitorDescription>
- </div>
- <div className="flex flex-row items-center gap-2">
- {/* TODO: check if we can improve that cuz its looking ugly */}
- {showUptime ? (
- <>
- {isLoading ? (
- <StatusMonitorUptimeSkeleton />
- ) : (
- <StatusMonitorUptime>{uptime}</StatusMonitorUptime>
- )}
- <StatusMonitorIcon />
- </>
- ) : (
- <StatusMonitorStatus />
- )}
- </div>
- </div>
- {isLoading ? <StatusTrackerSkeleton /> : <StatusTracker data={data} />}
- <StatusMonitorFooter data={data} isLoading={isLoading} />
- </div>
- );
-}
-
-export function StatusMonitorTitle({
- children,
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "truncate font-medium font-mono text-base text-foreground leading-5",
- className,
- )}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-export function StatusMonitorDescription({
- onClick,
- children,
- ...props
-}: React.ComponentProps<typeof TooltipTrigger>) {
- const isTouch = useMediaQuery("(hover: none)");
- const [open, setOpen] = useState(false);
-
- if (!children) return null;
-
- return (
- <TooltipProvider delayDuration={0}>
- <Tooltip open={open} onOpenChange={setOpen}>
- <TooltipTrigger
- onClick={(e) => {
- if (isTouch) setOpen((prev) => !prev);
- onClick?.(e);
- }}
- className="rounded-full"
- {...props}
- >
- <InfoIcon className="size-4 text-muted-foreground" />
- </TooltipTrigger>
- <TooltipContent>
- <p>{children}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- );
-}
-
-export function StatusMonitorIcon({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "flex size-[12.5px] items-center justify-center rounded-full bg-muted text-background [&>svg]:size-[9px]",
- "group-data-[variant=success]/monitor:bg-success",
- "group-data-[variant=degraded]/monitor:bg-warning",
- "group-data-[variant=error]/monitor:bg-destructive",
- "group-data-[variant=info]/monitor:bg-info",
- className,
- )}
- {...props}
- >
- <CheckIcon className="hidden group-data-[variant=success]/monitor:block" />
- <TriangleAlertIcon className="hidden group-data-[variant=degraded]/monitor:block" />
- <AlertCircleIcon className="hidden group-data-[variant=error]/monitor:block" />
- <WrenchIcon className="hidden group-data-[variant=info]/monitor:block" />
- </div>
- );
-}
-
-export function StatusMonitorFooter({
- data,
- isLoading,
-}: {
- data: Data;
- isLoading?: boolean;
-}) {
- const t = useExtracted();
- return (
- <div className="flex flex-row items-center justify-between font-mono text-muted-foreground text-xs leading-none">
- <div>
- {isLoading ? (
- <Skeleton className="h-3 w-18" />
- ) : data.length > 0 ? (
- formatDistanceToNowStrict(new Date(data[0].day), {
- unit: "day",
- addSuffix: true,
- })
- ) : (
- "-"
- )}
- </div>
- <div>{t("today")}</div>
- </div>
- );
-}
-
-export function StatusMonitorUptime({
- className,
- children,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- {...props}
- className={cn(
- "font-mono text-foreground/80 text-sm leading-none",
- className,
- )}
- >
- {children}
- </div>
- );
-}
-
-export function StatusMonitorUptimeSkeleton({
- className,
- ...props
-}: React.ComponentProps<typeof Skeleton>) {
- return <Skeleton className={cn("h-4 w-16", className)} {...props} />;
-}
-
-export function StatusMonitorStatus({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- const t = useExtracted();
- return (
- <div
- className={cn(
- "font-mono text-sm leading-none",
- "group-data-[variant=success]/monitor:text-success",
- "group-data-[variant=degraded]/monitor:text-warning",
- "group-data-[variant=error]/monitor:text-destructive",
- "group-data-[variant=info]/monitor:text-info",
- className,
- )}
- {...props}
- >
- <span className="hidden group-data-[variant=success]/monitor:block">
- {t("Operational")}
- </span>
- <span className="hidden group-data-[variant=degraded]/monitor:block">
- {t("Degraded")}
- </span>
- <span className="hidden group-data-[variant=error]/monitor:block">
- {t("Downtime")}
- </span>
- <span className="hidden group-data-[variant=info]/monitor:block">
- {t("Maintenance")}
- </span>
- </div>
- );
-}
diff --git a/apps/status-page/src/components/status-page/status-tracker.tsx b/apps/status-page/src/components/status-page/status-tracker.tsx
deleted file mode 100644
index 4f4b2affb..000000000
--- a/apps/status-page/src/components/status-page/status-tracker.tsx
+++ /dev/null
@@ -1,460 +0,0 @@
-"use client";
-
-import { Kbd } from "@/components/common/kbd";
-import { Link } from "@/components/common/link";
-import { usePathnamePrefix } from "@/hooks/use-pathname-prefix";
-import { formatDateRange } from "@/lib/formatter";
-import type { RouterOutputs } from "@openstatus/api";
-import {
- HoverCard,
- HoverCardContent,
- HoverCardTrigger,
-} from "@openstatus/ui/components/ui/hover-card";
-import { Separator } from "@openstatus/ui/components/ui/separator";
-import { Skeleton } from "@openstatus/ui/components/ui/skeleton";
-import { useMediaQuery } from "@openstatus/ui/hooks/use-media-query";
-import { cn } from "@openstatus/ui/lib/utils";
-import { formatDistanceStrict } from "date-fns";
-import { useExtracted, useLocale } from "next-intl";
-import { useEffect, useRef, useState } from "react";
-import { chartConfig } from "./utils";
-
-type UptimeData = NonNullable<
- RouterOutputs["statusPage"]["getUptime"]
->[number]["data"];
-
-// TODO: keyboard arrow navigation
-// FIXME: on small screens, avoid pinned state
-// TODO: only on real mobile devices, use click events
-// TODO: improve status reports -> add duration and time
-// TODO: support headless mode -> both card and bar type share only maintenance or degraded mode
-// TODO: support status page logo + onClick to homepage
-// TODO: widget type -> current status only | with status history
-
-export function StatusTracker({ data }: { data: UptimeData }) {
- const t = useExtracted();
- const locale = useLocale();
- const [pinnedIndex, setPinnedIndex] = useState<number | null>(null);
- const [focusedIndex, setFocusedIndex] = useState<number | null>(null);
- const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
- const containerRef = useRef<HTMLDivElement>(null);
- const hoverTimeoutRef = useRef<NodeJS.Timeout | null>(null);
- const isTouch = useMediaQuery("(hover: none)");
- const prefix = usePathnamePrefix();
-
- useEffect(() => {
- const handleOutsideClick = (e: MouseEvent) => {
- if (
- pinnedIndex !== null &&
- containerRef.current &&
- !containerRef.current.contains(e.target as Node)
- ) {
- setPinnedIndex(null);
- }
- };
-
- if (pinnedIndex !== null) {
- document.addEventListener("mousedown", handleOutsideClick);
- return () =>
- document.removeEventListener("mousedown", handleOutsideClick);
- }
- }, [pinnedIndex]);
-
- useEffect(() => {
- if (focusedIndex !== null && containerRef.current) {
- const buttons = containerRef.current.querySelectorAll('[role="button"]');
- const targetButton = buttons[focusedIndex] as HTMLElement;
- if (targetButton) {
- targetButton.focus();
- }
- }
- }, [focusedIndex]);
-
- useEffect(() => {
- return () => {
- if (hoverTimeoutRef.current) {
- clearTimeout(hoverTimeoutRef.current);
- }
- };
- }, []);
-
- const handleKeyDown = (e: React.KeyboardEvent) => {
- if (e.key === "Escape") {
- setPinnedIndex(null);
- setFocusedIndex(null);
- setHoveredIndex(null);
-
- if (focusedIndex !== null) {
- const buttons =
- containerRef.current?.querySelectorAll('[role="button"]');
- const button = buttons?.[focusedIndex] as HTMLElement;
- if (button) {
- button.blur();
- }
- }
-
- if (hoverTimeoutRef.current) {
- clearTimeout(hoverTimeoutRef.current);
- hoverTimeoutRef.current = null;
- }
- return;
- }
-
- if (focusedIndex !== null) {
- switch (e.key) {
- case "ArrowLeft":
- e.preventDefault();
- setFocusedIndex((prev) =>
- prev !== null && prev > 0 ? prev - 1 : data.length - 1,
- );
- break;
- case "ArrowRight":
- e.preventDefault();
- setFocusedIndex((prev) =>
- prev !== null && prev < data.length - 1 ? prev + 1 : 0,
- );
- break;
- case "ArrowUp":
- e.preventDefault();
- const prevMonitor = containerRef.current?.closest(
- '[data-slot="status-monitor"]',
- )?.previousElementSibling;
- if (prevMonitor) {
- const prevTracker = prevMonitor.querySelector('[role="toolbar"]');
- if (prevTracker) {
- const buttons = prevTracker.querySelectorAll('[role="button"]');
- const button = buttons?.[focusedIndex] as HTMLElement;
- if (button) {
- button.focus();
- }
- }
- }
- break;
- case "ArrowDown":
- e.preventDefault();
- const nextMonitor = containerRef.current?.closest(
- '[data-slot="status-monitor"]',
- )?.nextElementSibling;
- if (nextMonitor) {
- const nextTracker = nextMonitor.querySelector('[role="toolbar"]');
- if (nextTracker) {
- const buttons = nextTracker.querySelectorAll('[role="button"]');
- const button = buttons?.[focusedIndex] as HTMLElement;
- if (button) {
- button.focus();
- }
- }
- }
- break;
- case "Enter":
- case "Escape":
- case " ":
- e.preventDefault();
- handleBarClick(focusedIndex);
- break;
- }
- }
- };
-
- const handleBarClick = (index: number) => {
- // Clear any pending hover timeout
- if (hoverTimeoutRef.current) {
- clearTimeout(hoverTimeoutRef.current);
- hoverTimeoutRef.current = null;
- }
- if (pinnedIndex === index) {
- setPinnedIndex(null);
- } else {
- setPinnedIndex(index);
- }
- };
-
- const handleBarFocus = (index: number) => {
- setFocusedIndex(index);
- };
-
- const handleBarBlur = (e: React.FocusEvent, _currentIndex: number) => {
- const relatedTarget = e.relatedTarget as HTMLElement;
- const isMovingToAnotherBar =
- relatedTarget &&
- relatedTarget.closest('[role="toolbar"]') === containerRef.current &&
- relatedTarget.getAttribute("role") === "button";
-
- if (!isMovingToAnotherBar) {
- setFocusedIndex(null);
- }
- };
-
- const handleBarMouseEnter = (index: number) => {
- if (hoverTimeoutRef.current) {
- clearTimeout(hoverTimeoutRef.current);
- hoverTimeoutRef.current = null;
- }
- setHoveredIndex(index);
- };
-
- const handleBarMouseLeave = () => {
- hoverTimeoutRef.current = setTimeout(() => {
- setHoveredIndex(null);
- }, 100);
- };
-
- const handleHoverCardMouseEnter = () => {
- if (hoverTimeoutRef.current) {
- clearTimeout(hoverTimeoutRef.current);
- hoverTimeoutRef.current = null;
- }
- };
-
- const handleHoverCardMouseLeave = () => {
- setHoveredIndex(null);
- };
-
- return (
- <div
- ref={containerRef}
- className="flex h-[50px] w-full items-end"
- onKeyDown={handleKeyDown}
- role="toolbar"
- aria-label={t("Status tracker")}
- >
- {data.map((item, index) => {
- const isPinned = pinnedIndex === index;
- const isFocused = focusedIndex === index;
- const isHovered = hoveredIndex === index;
-
- return (
- <HoverCard
- key={item.day}
- openDelay={0}
- closeDelay={0}
- open={isPinned || isFocused || isHovered}
- >
- <HoverCardTrigger asChild>
- <div
- className={cn(
- "group relative mx-px flex h-full w-full cursor-pointer flex-col rounded-full outline-none first:ml-0 last:mr-0 hover:opacity-80 focus-visible:opacity-80 focus-visible:ring-[2px] focus-visible:ring-ring/50 data-[aria-pressed=true]:opacity-80",
- "overflow-hidden rounded-full",
- )}
- onClick={() => handleBarClick(index)}
- onFocus={() => handleBarFocus(index)}
- onBlur={(e) => handleBarBlur(e, index)}
- onMouseEnter={() => handleBarMouseEnter(index)}
- onMouseLeave={handleBarMouseLeave}
- tabIndex={
- index === data.length - 1 && focusedIndex === null
- ? 0
- : isFocused
- ? 0
- : -1
- }
- role="button"
- aria-label={t("Day {n} status", { n: String(index + 1) })}
- aria-pressed={isPinned}
- >
- {/* Render processed bar segments from backend */}
- {item.bar.map((segment, segmentIndex) => (
- <div
- key={`${item.day}-${segment.status}-${segmentIndex}`}
- className={cn("w-full transition-all", {
- "rounded-t-full": segmentIndex === 0,
- "rounded-b-full": segmentIndex === item.bar.length - 1,
- })}
- style={{
- height: `${segment.height}%`,
- backgroundColor: chartConfig[segment.status].color,
- }}
- />
- ))}
- </div>
- </HoverCardTrigger>
- <HoverCardContent
- side="top"
- align="center"
- // NOTE: remove animation and transition to avoid flickering
- className="![animation-duration:0ms] ![transition-duration:0ms] w-auto min-w-40 p-0"
- onMouseEnter={handleHoverCardMouseEnter}
- onMouseLeave={handleHoverCardMouseLeave}
- >
- <div>
- <div className="p-2 text-xs">
- {new Date(item.day).toLocaleDateString(locale, {
- day: "numeric",
- month: "short",
- year: "numeric",
- })}
- </div>
- <Separator />
- <div className="space-y-1 p-2 text-sm">
- {/* Render processed card data from backend */}
- {item.card.map((cardItem, cardIndex) => (
- <StatusTrackerContent
- key={`${item.day}-card-${cardIndex}`}
- status={cardItem.status}
- value={cardItem.value}
- />
- ))}
- </div>
- {item.events.length > 0 && (
- <>
- <Separator />
- <div className="p-2">
- {item.events.map((event) => {
- const eventStatus =
- event.type === "incident"
- ? "error"
- : event.type === "report"
- ? "degraded"
- : "info";
-
- const content = (
- <StatusTrackerEvent
- key={`${event.id}-${event.type}`}
- status={eventStatus}
- name={event.name}
- from={event.from}
- to={event.to}
- />
- );
-
- // Wrap reports and maintenances with links
- if (
- event.type === "report" ||
- event.type === "maintenance"
- ) {
- return (
- <Link
- variant="unstyled"
- key={`${event.id}-${event.type}`}
- href={`${prefix ? `/${prefix}` : ""}/events/${
- event.type
- }/${event.id}`}
- >
- {content}
- </Link>
- );
- }
-
- // Incidents don't have links
- return content;
- })}
- </div>
- </>
- )}
- {isPinned && !isTouch && (
- <>
- <Separator />
- <div className="flex cursor-pointer items-center p-2 text-muted-foreground text-xs">
- <span>{t("Click again to unpin")}</span>
- <Kbd>Esc</Kbd>
- </div>
- </>
- )}
- </div>
- </HoverCardContent>
- </HoverCard>
- );
- })}
- </div>
- );
-}
-
-export function StatusTrackerSkeleton({
- className,
- ...props
-}: React.ComponentProps<typeof Skeleton>) {
- return (
- <Skeleton
- className={cn("h-[50px] w-full rounded-none bg-muted", className)}
- {...props}
- />
- );
-}
-
-function StatusTrackerContent({
- status,
- value,
-}: {
- status: "success" | "degraded" | "error" | "info" | "empty";
- value: string;
-}) {
- const t = useExtracted();
- const requestLabels: Record<string, string> = {
- success: t("Normal"),
- degraded: t("Degraded"),
- error: t("Error"),
- info: t("Maintenance"),
- empty: t("No Data"),
- };
- return (
- <div className="flex items-baseline gap-4">
- <div className="flex items-center gap-2">
- <div
- className="h-2.5 w-2.5 rounded-sm"
- style={{
- backgroundColor: chartConfig[status].color,
- }}
- />
- <div className="text-sm">{requestLabels[status]}</div>
- </div>
- <div className="ml-auto font-mono text-muted-foreground text-xs tracking-tight">
- {value}
- </div>
- </div>
- );
-}
-
-function StatusTrackerEvent({
- name,
- from,
- to,
- status,
-}: {
- name: string;
- from?: Date | null;
- to?: Date | null;
- status: "success" | "degraded" | "error" | "info" | "empty";
-}) {
- const locale = useLocale();
- if (!from) return null;
-
- return (
- <div className="group relative text-sm">
- {/* NOTE: this is to make the text truncate based on the with of the sibling element */}
- {/* REMINDER: height needs to be equal the text height */}
- <div className="h-4 w-full" />
- <div className="absolute inset-0 text-muted-foreground hover:text-foreground">
- <div className="flex items-center gap-2">
- <div
- className="h-2.5 w-2.5 shrink-0 rounded-sm"
- style={{
- backgroundColor: chartConfig[status].color,
- }}
- />
- <div className="truncate">{name}</div>
- </div>
- </div>
- <div className="mt-1 text-muted-foreground text-xs">
- {formatDateRange(from, to ?? undefined, locale)}{" "}
- <span className="ml-1.5 font-mono text-muted-foreground/70">
- <FormatDuration from={from} to={to} name={name} status={status} />
- </span>
- </div>
- </div>
- );
-}
-
-function FormatDuration({
- from,
- to,
- name,
-}: React.ComponentProps<typeof StatusTrackerEvent>) {
- const t = useExtracted();
- if (!from) return null;
- if (!to) return t("ongoing");
- const duration = formatDistanceStrict(from, to);
- const isMultipleIncidents = name.includes("Downtime (");
- if (isMultipleIncidents) return t("across {duration}", { duration });
- if (duration === "0 seconds") return null;
- return duration;
-}
diff --git a/apps/status-page/src/components/status-page/status-updates.tsx b/apps/status-page/src/components/status-page/status-updates.tsx
index 225d292a1..a497518e2 100644
--- a/apps/status-page/src/components/status-page/status-updates.tsx
+++ b/apps/status-page/src/components/status-page/status-updates.tsx
@@ -6,13 +6,17 @@ import {
} from "@/components/forms/form-subscribe-email";
import { getBaseUrl } from "@/lib/base-url";
import type { RouterOutputs } from "@openstatus/api";
-import { Button } from "@openstatus/ui/components/ui/button";
-import { Input } from "@openstatus/ui/components/ui/input";
import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@openstatus/ui/components/ui/popover";
+ StatusUpdates as BlockStatusUpdates,
+ StatusUpdatesContent,
+ StatusUpdatesJson,
+ StatusUpdatesRss,
+ StatusUpdatesSection,
+ StatusUpdatesSlack,
+ StatusUpdatesSsh,
+ StatusUpdatesTrigger,
+} from "@openstatus/ui/components/blocks/status-updates";
+import { Button } from "@openstatus/ui/components/ui/button";
import { Separator } from "@openstatus/ui/components/ui/separator";
import {
Tabs,
@@ -20,9 +24,8 @@ import {
TabsList,
TabsTrigger,
} from "@openstatus/ui/components/ui/tabs";
-import { useCopyToClipboard } from "@openstatus/ui/hooks/use-copy-to-clipboard";
import { cn } from "@openstatus/ui/lib/utils";
-import { Check, Copy, Inbox } from "lucide-react";
+import { Inbox } from "lucide-react";
import { useExtracted } from "next-intl";
import { useState } from "react";
@@ -41,8 +44,6 @@ function getUpdateLink(type: "rss" | "json" | "atom", page?: Page | null) {
}`;
}
-// TODO: use domain instead of openstatus subdomain if available
-
interface StatusUpdatesProps extends React.ComponentProps<typeof Button> {
types?: StatusUpdateType[];
page?: Page | null;
@@ -61,19 +62,15 @@ export function StatusUpdates({
if (types.length === 0) return null;
+ const rssUrl = getUpdateLink("rss", page);
+ const atomUrl = getUpdateLink("atom", page);
+ const jsonUrl = getUpdateLink("json", page);
+ const sshCommand = `ssh ${page?.slug}@ssh.openstatus.dev`;
+
return (
- <Popover>
- <PopoverTrigger asChild>
- <Button
- size="sm"
- variant="outline"
- className={cn(className)}
- {...props}
- >
- {t("Get updates")}
- </Button>
- </PopoverTrigger>
- <PopoverContent align="end" className="w-80 overflow-hidden p-0">
+ <BlockStatusUpdates>
+ <StatusUpdatesTrigger className={cn(className)} {...props} />
+ <StatusUpdatesContent>
<Tabs defaultValue={types[0]}>
<TabsList className="w-full rounded-none border-b">
{types.includes("email") ? (
@@ -97,12 +94,12 @@ export function StatusUpdates({
<SuccessMessage />
) : (
<>
- <div className="flex flex-col gap-2">
- <p className="px-2 text-sm">
- {t(
- "Get email notifications whenever a report has been created or resolved",
- )}
- </p>
+ <StatusUpdatesSection
+ description={t(
+ "Get email notifications whenever a report has been created or resolved",
+ )}
+ className="py-0 pt-2"
+ >
<FormSubscribeEmail
id="email-form"
page={page}
@@ -111,112 +108,31 @@ export function StatusUpdates({
setSuccess(true);
}}
/>
- </div>
+ </StatusUpdatesSection>
<Separator />
<div className="px-2 pb-2">
<Button className="w-full" type="submit" form="email-form">
{t("Subscribe")}
</Button>
- </div>{" "}
+ </div>
</>
)}
</TabsContent>
- <TabsContent value="rss" className="flex flex-col gap-2">
- <div className="flex flex-col gap-2 px-2">
- <p className="text-sm">{t("Get the RSS feed")}</p>
- <CopyInputButton
- className="w-full"
- id="rss"
- value={getUpdateLink("rss", page)}
- />
- </div>
- <Separator />
- <div className="flex flex-col gap-2 px-2 pb-2">
- <p className="text-sm">{t("Get the Atom feed")}</p>
- <CopyInputButton
- className="w-full"
- id="atom"
- value={getUpdateLink("atom", page)}
- />
- </div>
+ <TabsContent value="rss">
+ <StatusUpdatesRss rssUrl={rssUrl} atomUrl={atomUrl} />
</TabsContent>
- <TabsContent value="json" className="flex flex-col gap-2">
- <div className="flex flex-col gap-2 px-2 pb-2">
- <p className="text-sm">{t("Get the JSON updates")}</p>
- <CopyInputButton
- className="w-full"
- id="json"
- value={getUpdateLink("json", page)}
- />
- </div>
+ <TabsContent value="json">
+ <StatusUpdatesJson url={jsonUrl} />
</TabsContent>
- <TabsContent value="ssh" className="flex flex-col gap-2">
- <div className="flex flex-col gap-2 px-2 pb-2">
- <p className="text-sm">{t("Get status via SSH")}</p>
- <CopyInputButton
- className="w-full"
- id="ssh"
- value={`ssh ${page?.slug}@ssh.openstatus.dev`}
- />
- </div>
+ <TabsContent value="ssh">
+ <StatusUpdatesSsh command={sshCommand} />
</TabsContent>
- <TabsContent value="slack" className="flex flex-col gap-2">
- <div className="flex flex-col gap-2 px-2 pb-2">
- <p className="text-sm">
- {t(
- "For status updates in Slack, paste the text below into any channel.",
- )}
- </p>
- <CopyInputButton
- className="w-full"
- id="slack"
- value={`/feed subscribe ${getUpdateLink("rss", page)}`}
- />
- </div>
+ <TabsContent value="slack">
+ <StatusUpdatesSlack rssUrl={rssUrl} />
</TabsContent>
</Tabs>
- </PopoverContent>
- </Popover>
- );
-}
-
-function CopyInputButton({
- value,
- onClick,
- ...props
-}: React.ComponentProps<typeof Input> & {
- value: string;
-}) {
- const t = useExtracted();
- const { copy, isCopied } = useCopyToClipboard();
- return (
- <div className="relative w-full">
- <Input
- placeholder={value}
- readOnly
- onClick={(e) => {
- copy(value, {
- successMessage: t("Link copied to clipboard"),
- withToast: true,
- });
- onClick?.(e);
- }}
- {...props}
- />
- <Button
- variant="outline"
- size="icon"
- onClick={() =>
- copy(value, {
- successMessage: t("Link copied to clipboard"),
- })
- }
- className="-translate-y-1/2 absolute top-1/2 right-2 size-6"
- >
- {isCopied ? <Check /> : <Copy />}
- <span className="sr-only">{t("Copy Link")}</span>
- </Button>
- </div>
+ </StatusUpdatesContent>
+ </BlockStatusUpdates>
);
}
diff --git a/apps/status-page/src/components/status-page/status.tsx b/apps/status-page/src/components/status-page/status.tsx
deleted file mode 100644
index f6ab12b49..000000000
--- a/apps/status-page/src/components/status-page/status.tsx
+++ /dev/null
@@ -1,191 +0,0 @@
-import { UTCDate } from "@date-fns/utc";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@openstatus/ui/components/ui/tooltip";
-import { cn } from "@openstatus/ui/lib/utils";
-import { format } from "date-fns";
-import {
- AlertCircleIcon,
- CheckIcon,
- TriangleAlertIcon,
- WrenchIcon,
-} from "lucide-react";
-
-export function Status({
- children,
- className,
- variant = "success",
- ...props
-}: React.ComponentProps<"div"> & {
- variant?: "success" | "degraded" | "error" | "info";
-}) {
- return (
- <div
- data-variant={variant}
- data-slot="status"
- className={cn("group peer flex flex-col gap-8", className)}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-export function StatusBrand({
- src,
- alt,
- className,
- ...props
-}: React.ComponentProps<"img">) {
- return (
- // biome-ignore lint/a11y/useAltText: <explanation>
- <img src={src} alt={alt} className={cn("size-8", className)} {...props} />
- );
-}
-
-export function StatusHeader({
- children,
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="status-header"
- className={cn("@container/status-header", className)}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-export function StatusTitle({
- children,
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "font-semibold text-foreground text-lg leading-none",
- className,
- )}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-export function StatusDescription({
- children,
- className,
-}: React.ComponentProps<"div">) {
- return (
- <div className={cn("text-muted-foreground", className)}>{children}</div>
- );
-}
-
-export function StatusContent({
- children,
- className,
-}: React.ComponentProps<"div">) {
- return <div className={cn("flex flex-col gap-3", className)}>{children}</div>;
-}
-
-export function StatusIcon({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "flex size-7 items-center justify-center rounded-full bg-muted text-background [&>svg]:size-4",
- "group-data-[variant=success]:bg-success",
- "group-data-[variant=degraded]:bg-warning",
- "group-data-[variant=error]:bg-destructive",
- "group-data-[variant=info]:bg-info",
- className,
- )}
- {...props}
- >
- <CheckIcon className="hidden group-data-[variant=success]:block" />
- <TriangleAlertIcon className="hidden group-data-[variant=degraded]:block" />
- <AlertCircleIcon className="hidden group-data-[variant=error]:block" />
- <WrenchIcon className="hidden group-data-[variant=info]:block" />
- </div>
- );
-}
-
-export function StatusTimestamp({
- date,
- className,
- ...props
-}: React.ComponentProps<typeof TooltipTrigger> & { date: Date }) {
- return (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger
- className={cn(
- "font-mono text-muted-foreground underline decoration-muted-foreground/30 decoration-dashed underline-offset-4",
- className,
- )}
- {...props}
- >
- {format(new UTCDate(date), "LLL dd, y HH:mm (z)")}
- </TooltipTrigger>
- <TooltipContent>
- <p className="font-mono">{format(date, "LLL dd, y HH:mm (z)")}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- );
-}
-
-export function StatusEmptyState({
- children,
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn(
- "flex flex-col items-center justify-center gap-0.5 rounded-lg border border-dashed bg-muted/30 px-3 py-2 text-center sm:px-8 sm:py-6",
- className,
- )}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-export function StatusEmptyStateTitle({
- children,
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div className={cn("font-medium", className)} {...props}>
- {children}
- </div>
- );
-}
-
-export function StatusEmptyStateDescription({
- children,
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- className={cn("font-mono text-muted-foreground text-sm", className)}
- {...props}
- >
- {children}
- </div>
- );
-}
diff --git a/apps/status-page/src/components/themes/theme-dropdown.tsx b/apps/status-page/src/components/themes/theme-dropdown.tsx
deleted file mode 100644
index e957913ba..000000000
--- a/apps/status-page/src/components/themes/theme-dropdown.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-"use client";
-
-import { useTheme } from "next-themes";
-import type * as React from "react";
-
-import { Button } from "@openstatus/ui/components/ui/button";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from "@openstatus/ui/components/ui/dropdown-menu";
-import { Skeleton } from "@openstatus/ui/components/ui/skeleton";
-import { cn } from "@openstatus/ui/lib/utils";
-import { Laptop, Moon, Sun } from "lucide-react";
-import { useState } from "react";
-import { useEffect } from "react";
-
-function getThemeIcon(theme?: string | null, className?: string) {
- if (theme === "light") return <Sun className={cn("h-4 w-4", className)} />;
- if (theme === "dark") return <Moon className={cn("h-4 w-4", className)} />;
- if (theme === "system")
- return <Laptop className={cn("h-4 w-4", className)} />;
- return null;
-}
-
-export function ThemeDropdown({
- className,
- ...props
-}: React.ComponentProps<typeof DropdownMenuTrigger>) {
- const { setTheme, theme } = useTheme();
- const [mounted, setMounted] = useState(false);
-
- useEffect(() => {
- setMounted(true);
- }, []);
-
- if (!mounted) {
- return <Skeleton className={cn("size-9", className)} />;
- }
-
- return (
- <DropdownMenu>
- <DropdownMenuTrigger className={cn(className)} asChild {...props}>
- <Button variant="ghost" size="icon">
- {getThemeIcon(theme ?? "system")}
- <span className="sr-only">{theme ?? "system"}</span>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" alignOffset={-4}>
- {["light", "dark", "system"].map((t) => {
- const isActive = t === theme;
- return (
- <DropdownMenuItem key={t} onClick={() => setTheme(t)}>
- <span className="capitalize">{t}</span>
- <span className={cn("ml-auto")}>
- {getThemeIcon(
- t,
- isActive ? "text-foreground" : "text-muted-foreground",
- )}
- </span>
- </DropdownMenuItem>
- );
- })}
- </DropdownMenuContent>
- </DropdownMenu>
- );
-}
diff --git a/apps/status-page/src/components/themes/theme-switcher.tsx b/apps/status-page/src/components/themes/theme-switcher.tsx
new file mode 100644
index 000000000..c4632a403
--- /dev/null
+++ b/apps/status-page/src/components/themes/theme-switcher.tsx
@@ -0,0 +1,43 @@
+"use client";
+
+import {
+ StatusThemeSwitcher as BlockThemeSwitcher,
+ StatusThemeSwitcherSkeleton,
+ type ThemeValue,
+} from "@openstatus/ui/components/blocks/status-theme-switcher";
+import { useTheme } from "next-themes";
+import { useEffect, useState } from "react";
+
+function isThemeValue(value: string | undefined): value is ThemeValue {
+ return value === "light" || value === "dark" || value === "system";
+}
+
+export function ThemeSwitcher({
+ className,
+ ...props
+}: Omit<
+ React.ComponentProps<typeof BlockThemeSwitcher>,
+ "value" | "onValueChange"
+>) {
+ const { setTheme, theme } = useTheme();
+ const [mounted, setMounted] = useState(false);
+
+ useEffect(() => {
+ setMounted(true);
+ }, []);
+
+ if (!mounted) {
+ return <StatusThemeSwitcherSkeleton className={className} />;
+ }
+
+ const value: ThemeValue = isThemeValue(theme) ? theme : "system";
+
+ return (
+ <BlockThemeSwitcher
+ value={value}
+ onValueChange={setTheme}
+ className={className}
+ {...props}
+ />
+ );
+}
diff --git a/apps/status-page/src/lib/formatter.ts b/apps/status-page/src/lib/formatter.ts
index 7ecfe2234..f2e1a3d72 100644
--- a/apps/status-page/src/lib/formatter.ts
+++ b/apps/status-page/src/lib/formatter.ts
@@ -70,6 +70,36 @@ export function formatTime(date: Date, locale?: string) {
});
}
+/**
+ * Returns the start/end of a closed range as separate strings, collapsing the
+ * `to` side to a time-only render when `from` and `to` fall on the same day.
+ * Use `formatDateRange` for open-ended cases (`Until …` / `Since …`).
+ */
+export function formatDateRangeParts(
+ from: Date,
+ to: Date,
+ locale?: string,
+): { from: string; to: string } {
+ if (isSameDay(from, to)) {
+ return {
+ from: formatDateTime(from, locale),
+ to: formatTime(to, locale),
+ };
+ }
+ const isFromStartDay = startOfDay(from).getTime() === from.getTime();
+ const isToEndDay = endOfDay(to).getTime() === to.getTime();
+ if (isFromStartDay && isToEndDay) {
+ return {
+ from: formatDate(from, { locale }),
+ to: formatDate(to, { locale }),
+ };
+ }
+ return {
+ from: formatDateTime(from, locale),
+ to: formatDateTime(to, locale),
+ };
+}
+
export function formatDateRange(from?: Date, to?: Date, locale?: string) {
const sameDay = from && to && isSameDay(from, to);
const isFromStartDay = from && startOfDay(from).getTime() === from.getTime();
diff --git a/apps/web/src/content/pages/unrelated/registry.mdx b/apps/web/src/content/pages/unrelated/registry.mdx
index e57f86ee7..8e2cc39c9 100644
--- a/apps/web/src/content/pages/unrelated/registry.mdx
+++ b/apps/web/src/content/pages/unrelated/registry.mdx
@@ -16,6 +16,7 @@ All components are:
- **Accessible** - Built with ARIA patterns and keyboard navigation
- **Customizable** - Fully themeable with Tailwind CSS
- **Type-safe** - Written in TypeScript with complete type definitions
+- **Localizable** - Optional i18n provider for translated labels and locale-aware date formatters; English defaults out of the box
- **Production-ready** - Battle-tested in production at openstatus
## Example
@@ -60,11 +61,19 @@ pnpm dlx shadcn@latest add @openstatus/status-complete
Components are organized by functionality:
-- **Collections:** `status-complete`, `status-essentials` - Full status page bundles
-- **Building Blocks:** `status-banner`, `status-bar`, `status-feed`, `status-events`, `status-component`, `status-icon`, `status-layout`, `status-timestamp` - Individual components
+- **Collections:** `status-complete` (everything — body + chrome), `status-essentials` (body subset), `status-chrome` (header + footer + switchers + status-updates) - Full status page bundles
+- **Body Blocks:** `status-banner`, `status-bar`, `status-feed`, `status-events`, `status-component`, `status-component-group`, `status-blank`, `status-icon`, `status-layout`, `status-timestamp` - Individual components for the page body
+- **Chrome Blocks:** `status-page-shell`, `status-page-header`, `status-page-footer`, `status-page-get-in-touch`, `status-updates`, `status-theme-switcher`, `status-locale-switcher` - Header, footer, and surrounding chrome for a full status page
+- **i18n:** `status-i18n` - Optional context provider + hook for translated labels and locale-aware date formatters (auto-installed as a dependency of the blocks above)
Explore the full registry at [openstatus.dev/r/registry.json](https://openstatus.dev/r/registry.json)
+### Localization
+
+Blocks ship with English (`en-US`) defaults and require zero setup. To localize, mount `<StatusBlocksI18nProvider>` near your app root and pass a `StatusBlocksLabels` value (translated strings + locale-aware date formatters built from your own i18n library — `next-intl`, `react-intl`, or whatever you use). Blocks read labels via `useStatusBlocksLabels()`; if no provider is mounted, they fall back to `defaultStatusBlocksLabels`.
+
+This contract keeps the registry library-agnostic — `@openstatus/ui` does not depend on `next-intl` or any other i18n package directly.
+
---
Want to customize your theme?
diff --git a/packages/api/src/router/statusPage.utils.ts b/packages/api/src/router/statusPage.utils.ts
index 130f2be8c..d8d36cec4 100644
--- a/packages/api/src/router/statusPage.utils.ts
+++ b/packages/api/src/router/statusPage.utils.ts
@@ -822,6 +822,7 @@ export function setDataByType({
),
type: "incident" as const,
status: "error" as const,
+ isAggregated: true,
},
]
: incidents;
diff --git a/packages/db/src/schema/pages/validation.ts b/packages/db/src/schema/pages/validation.ts
index 4bc8e5c75..ff49349d0 100644
--- a/packages/db/src/schema/pages/validation.ts
+++ b/packages/db/src/schema/pages/validation.ts
@@ -81,17 +81,29 @@ export const insertPageSchema = createInsertSchema(page, {
},
);
+// NOTE: every field uses `.nullish().transform(v => v ?? <default>)` so the
+// OUTPUT is always a concrete enum value — never `null`/`undefined`. `.prefault`
+// alone only handles `undefined`; without the transform a stored `null` (which
+// the write path permits) leaks through and tanks downstream consumers that
+// expect a strict enum (e.g. the status-page layout falling back to "absolute"
+// barType and rendering manual-mode bars as empty).
export const pageConfigurationSchema = z.object({
value: z
.enum(["duration", "requests", "manual"])
.nullish()
- .prefault("requests"),
- type: z.enum(["absolute", "manual"]).nullish().prefault("absolute"),
- uptime: z.coerce.boolean().nullish().prefault(true),
+ .transform((v) => v ?? "requests"),
+ type: z
+ .enum(["absolute", "manual"])
+ .nullish()
+ .transform((v) => v ?? "absolute"),
+ uptime: z.coerce
+ .boolean()
+ .nullish()
+ .transform((v) => v ?? true),
theme: z
.enum(THEME_KEYS as [ThemeKey, ...ThemeKey[]])
.nullish()
- .prefault("default"),
+ .transform((v) => v ?? "default"),
});
export type PageConfiguration = z.infer<typeof pageConfigurationSchema>;
diff --git a/packages/ui/REGISTRY.md b/packages/ui/REGISTRY.md
index a80f5a4a7..3baba879b 100644
--- a/packages/ui/REGISTRY.md
+++ b/packages/ui/REGISTRY.md
@@ -38,6 +38,15 @@ Or configure it as their registry in `components.json`:
}
```
+## Localization (i18n)
+
+The status blocks ship with English (`en-US`) defaults and an optional context provider for translation. When a consumer installs `status-banner`, `status-bar`, `status-component`, `status-events`, or `status-feed`, the registry automatically pulls in `status-i18n` (declared as a `registryDependencies` entry on each consumer).
+
+- **Default behavior**: blocks render English with no setup — `useStatusBlocksLabels()` falls back to `defaultStatusBlocksLabels` when no provider is mounted.
+- **Localizing**: consumers mount `<StatusBlocksI18nProvider>` near their app root and supply a `StatusBlocksLabels` value (translated strings + locale-aware date formatters built from their own i18n library).
+
+Blocks intentionally do **not** import `next-intl`, `react-intl`, or any i18n library directly — that contract keeps them shadcn-shippable. See [`src/components/blocks/README.md`](./src/components/blocks/README.md#internationalization-i18n) for the full provider example.
+
## Adding Components to the Registry
To add a new component to the registry, update `packages/ui/registry.json`:
diff --git a/packages/ui/package.json b/packages/ui/package.json
index 6245018f0..51214b19c 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -31,7 +31,7 @@
},
"scripts": {
"build": "echo '@openstatus/ui has no build step (registry builds separately)'",
- "registry:build": "node scripts/transform-imports.mjs && cd dist && shadcn build && cd .. && node scripts/copy-to-web.mjs",
+ "registry:build": "node scripts/transform-imports.mjs && shadcn build --cwd dist --output public/r registry.json && node scripts/copy-to-web.mjs",
"lint": "biome lint \"**/*.ts*\"",
"tsc": "tsc --noEmit"
},
diff --git a/packages/ui/registry.json b/packages/ui/registry.json
index 54ee19f3f..e0788363c 100644
--- a/packages/ui/registry.json
+++ b/packages/ui/registry.json
@@ -2,7 +2,7 @@
"$schema": "https://ui.shadcn.com/schema/registry.json",
"name": "openstatus",
"homepage": "https://openstatus.dev",
- "version": "0.1.0",
+ "version": "0.2.0",
"style": "default",
"tailwind": {
"config": {
@@ -141,6 +141,20 @@
}
]
},
+ {
+ "name": "status-i18n",
+ "type": "registry:block",
+ "title": "Status Blocks i18n Provider",
+ "description": "React context for supplying translated labels and locale-aware date formatters to status blocks. Optional — blocks fall back to defaultStatusBlocksLabels (en-US) when no provider is mounted.",
+ "registryDependencies": ["status-types", "status-utils"],
+ "files": [
+ {
+ "path": "src/components/blocks/status-i18n.tsx",
+ "type": "registry:ui",
+ "target": "components/blocks/status-i18n.tsx"
+ }
+ ]
+ },
{
"name": "status-timestamp",
"type": "registry:block",
@@ -171,6 +185,7 @@
"status-types",
"status-utils",
"status-timestamp",
+ "status-i18n",
"tabs"
],
"files": [
@@ -189,6 +204,8 @@
"registryDependencies": [
"status-icon",
"status-types",
+ "status-utils",
+ "status-i18n",
"skeleton",
"tooltip",
"use-media-query"
@@ -229,6 +246,7 @@
"status-types",
"status-utils",
"status-timestamp",
+ "status-i18n",
"badge",
"separator",
"tooltip"
@@ -250,6 +268,7 @@
"registryDependencies": [
"status-types",
"status-utils",
+ "status-i18n",
"hover-card",
"separator",
"skeleton",
@@ -269,7 +288,12 @@
"type": "registry:block",
"title": "Status Feed",
"description": "Unified feed component combining status reports and maintenance events",
- "registryDependencies": ["status-blank", "status-events", "status-types"],
+ "registryDependencies": [
+ "status-blank",
+ "status-events",
+ "status-types",
+ "status-i18n"
+ ],
"files": [
{
"path": "src/components/blocks/status-feed.tsx",
@@ -278,14 +302,143 @@
}
]
},
+ {
+ "name": "status-theme-switcher",
+ "type": "registry:block",
+ "title": "Status Theme Switcher",
+ "description": "Agnostic light/dark/system theme switcher. Caller owns the value and onValueChange wiring (next-themes, form state, etc.)",
+ "registryDependencies": [
+ "status-i18n",
+ "status-types",
+ "button",
+ "dropdown-menu",
+ "skeleton"
+ ],
+ "dependencies": ["lucide-react"],
+ "files": [
+ {
+ "path": "src/components/blocks/status-theme-switcher.tsx",
+ "type": "registry:ui",
+ "target": "components/blocks/status-theme-switcher.tsx"
+ }
+ ]
+ },
+ {
+ "name": "status-locale-switcher",
+ "type": "registry:block",
+ "title": "Status Locale Switcher",
+ "description": "Agnostic locale picker. Caller owns value, onValueChange, and label resolution — no next-intl, router, or locale detection",
+ "registryDependencies": ["button", "dropdown-menu", "skeleton"],
+ "files": [
+ {
+ "path": "src/components/blocks/status-locale-switcher.tsx",
+ "type": "registry:ui",
+ "target": "components/blocks/status-locale-switcher.tsx"
+ }
+ ]
+ },
+ {
+ "name": "status-updates",
+ "type": "registry:block",
+ "title": "Status Updates",
+ "description": "Popover with copy-link primitives for RSS, Atom, JSON, Slack, and SSH subscription channels. Flat exports — caller composes layout (tabs, sections, etc.)",
+ "registryDependencies": [
+ "status-i18n",
+ "use-copy-to-clipboard",
+ "button",
+ "input",
+ "popover",
+ "separator"
+ ],
+ "dependencies": ["lucide-react"],
+ "files": [
+ {
+ "path": "src/components/blocks/status-updates.tsx",
+ "type": "registry:ui",
+ "target": "components/blocks/status-updates.tsx"
+ }
+ ]
+ },
+ {
+ "name": "status-page-get-in-touch",
+ "type": "registry:block",
+ "title": "Status Page Get-in-Touch",
+ "description": "Two flat button primitives (icon + text) with tooltip chrome for the contact link in a status page header",
+ "registryDependencies": ["status-i18n", "button", "tooltip"],
+ "files": [
+ {
+ "path": "src/components/blocks/status-page-get-in-touch.tsx",
+ "type": "registry:ui",
+ "target": "components/blocks/status-page-get-in-touch.tsx"
+ }
+ ]
+ },
+ {
+ "name": "status-page-header",
+ "type": "registry:block",
+ "title": "Status Page Header",
+ "description": "Presentation-only header chrome (brand, nav, actions). Routing-agnostic — apps inject their own Link component via asChild",
+ "registryDependencies": ["button"],
+ "files": [
+ {
+ "path": "src/components/blocks/status-page-header.tsx",
+ "type": "registry:ui",
+ "target": "components/blocks/status-page-header.tsx"
+ }
+ ]
+ },
+ {
+ "name": "status-page-footer",
+ "type": "registry:block",
+ "title": "Status Page Footer",
+ "description": "Presentation-only footer chrome (powered-by, action cluster). Embed/white-label gating, switchers, and tRPC fetch stay in the wrapping app",
+ "registryDependencies": ["status-i18n"],
+ "files": [
+ {
+ "path": "src/components/blocks/status-page-footer.tsx",
+ "type": "registry:ui",
+ "target": "components/blocks/status-page-footer.tsx"
+ }
+ ]
+ },
+ {
+ "name": "status-page-shell",
+ "type": "registry:block",
+ "title": "Status Page Shell",
+ "description": "Outer chrome wrappers (StatusPageShell + StatusPageMain) around header / main / footer. Routing-agnostic with embed-aware Tailwind classes that activate only when an ancestor sets data-embed",
+ "files": [
+ {
+ "path": "src/components/blocks/status-page-shell.tsx",
+ "type": "registry:ui",
+ "target": "components/blocks/status-page-shell.tsx"
+ }
+ ]
+ },
+ {
+ "name": "status-chrome",
+ "type": "registry:block",
+ "title": "Status Page Chrome",
+ "description": "Full status page chrome — shell, header, footer, get-in-touch, status-updates, theme + locale switchers. Combine with status-essentials or status-complete for the body",
+ "registryDependencies": [
+ "status-i18n",
+ "status-page-shell",
+ "status-page-header",
+ "status-page-footer",
+ "status-page-get-in-touch",
+ "status-updates",
+ "status-theme-switcher",
+ "status-locale-switcher"
+ ]
+ },
{
"name": "status-complete",
"type": "registry:block",
"title": "Status Page (Complete)",
- "description": "Complete status page components including all primitives, displays, and interactive elements",
+ "description": "Complete status page components including all primitives, displays, interactive elements, and chrome (header / footer / switchers)",
"registryDependencies": [
"status-types",
"status-utils",
+ "status-i18n",
"status-icon",
"status-layout",
"status-blank",
@@ -294,7 +447,14 @@
"status-component-group",
"status-events",
"status-bar",
- "status-feed"
+ "status-feed",
+ "status-page-shell",
+ "status-page-header",
+ "status-page-footer",
+ "status-page-get-in-touch",
+ "status-updates",
+ "status-theme-switcher",
+ "status-locale-switcher"
]
},
{
@@ -305,6 +465,7 @@
"registryDependencies": [
"status-types",
"status-utils",
+ "status-i18n",
"status-icon",
"status-layout",
"status-banner",
diff --git a/packages/ui/scripts/transform-imports.mjs b/packages/ui/scripts/transform-imports.mjs
index 1db4c4bad..1e01a1541 100644
--- a/packages/ui/scripts/transform-imports.mjs
+++ b/packages/ui/scripts/transform-imports.mjs
@@ -94,16 +94,26 @@ if (existsSync(registryJsonPath)) {
console.log(`🔗 Using registry base URL: ${baseUrl}`);
- // Transform registryDependencies for all items
+ // Transform registryDependencies for all items.
+ //
+ // Any dep that names another local registry item gets rewritten to a full
+ // URL pointing at our hosted registry; everything else is assumed to be a
+ // shadcn upstream component and left alone. Driving this off the registry's
+ // own item names (rather than a `status-*` / `use-*` prefix check) avoids
+ // silently mis-routing chrome blocks like `theme-switcher` /
+ // `locale-switcher`.
if (registryJson.items) {
+ const localItemNames = new Set(
+ registryJson.items.map((i) => i.name).filter(Boolean),
+ );
+
for (const item of registryJson.items) {
if (
item.registryDependencies &&
Array.isArray(item.registryDependencies)
) {
item.registryDependencies = item.registryDependencies.map((dep) => {
- // Prefix custom OpenStatus components (status-* and use-*) with full URL
- if (dep.startsWith("status-") || dep.startsWith("use-")) {
+ if (localItemNames.has(dep)) {
return `${baseUrl}/${dep}.json`;
}
// Leave shadcn components unprefixed
diff --git a/packages/ui/src/components/blocks/README.md b/packages/ui/src/components/blocks/README.md
index 3fa417a19..0716adcf4 100644
--- a/packages/ui/src/components/blocks/README.md
+++ b/packages/ui/src/components/blocks/README.md
@@ -14,6 +14,7 @@ The blocks components are built on a **composition pattern** where simple primit
- **Themeable**: CSS variables for colors, dark mode support
- **Responsive**: Mobile-first design with adaptive layouts
- **Interactive**: Keyboard navigation, hover cards, collapsible groups
+- **Localizable**: Optional i18n provider for translated labels and locale-aware date formatters; sensible English defaults out of the box
## Architecture
@@ -28,19 +29,23 @@ The blocks components are built on a **composition pattern** where simple primit
### Component Layers
```
-┌─────────────────────────────────────────────────────────┐
-│ Layout Components (Status, StatusComponent, StatusEvent)│
-│ └─ Establish context via data-variant/data-status │
-├─────────────────────────────────────────────────────────┤
-│ Display Components (StatusIcon, StatusMessage, etc.) │
-│ └─ Respond to parent context via CSS selectors │
-├─────────────────────────────────────────────────────────┤
-│ Interactive Components (StatusBar, StatusComponentGroup)│
-│ └─ Manage state and interactions via hooks │
-├─────────────────────────────────────────────────────────┤
-│ Utility Components (StatusTimestamp, StatusBlank, etc.) │
-│ └─ Provide specialized functionality │
-└─────────────────────────────────────────────────────────┘
+┌──────────────────────────────────────────────────────────┐
+│ Layout Components (Status, StatusComponent, StatusEvent) │
+│ └─ Establish context via data-variant/data-status │
+├──────────────────────────────────────────────────────────┤
+│ Display Components (StatusIcon, StatusMessage, etc.) │
+│ └─ Respond to parent context via CSS selectors │
+├──────────────────────────────────────────────────────────┤
+│ Interactive Components (StatusBar, StatusComponentGroup) │
+│ └─ Manage state and interactions via hooks │
+├──────────────────────────────────────────────────────────┤
+│ Utility Components (StatusTimestamp, StatusBlank, etc.) │
+│ └─ Provide specialized functionality │
+├──────────────────────────────────────────────────────────┤
+│ i18n (StatusBlocksI18nProvider, useStatusBlocksLabels) │
+│ └─ Supply translated labels + locale-aware date │
+│ formatters; English defaults when unmounted │
+└──────────────────────────────────────────────────────────┘
```
## Core Concepts
@@ -202,6 +207,58 @@ Specialized functionality components.
- **StatusTimestamp**: Timezone-aware timestamp with hover details
- **StatusFeed**: Unified feed of reports and maintenance
- **StatusComponentGroup**: Collapsible monitor grouping
+- **StatusBlankAction**: Styled chrome wrapper for empty-state CTAs (links/buttons)
+
+### 8. i18n / Localization
+
+- **StatusBlocksI18nProvider**: React context that supplies translated labels + locale-aware date formatters to all blocks
+- **useStatusBlocksLabels**: Hook blocks read from; falls back to `defaultStatusBlocksLabels` when no provider is mounted
+- **defaultStatusBlocksLabels**: English (`en-US`) defaults exported from `status.utils.ts`
+
+### 9. Page Chrome (Header / Footer / Switchers)
+
+Presentation-only chrome blocks for assembling a complete status page around the body components above. All routing-, theme-, and locale-agnostic — caller wires their own `next/link`, `next-themes`, `next-intl`, etc.
+
+#### Shell
+- **StatusPageShell**: Outer `<div>` wrapper (full-height column with gap)
+- **StatusPageMain**: Inner `<main>` content column with embed-aware Tailwind classes that activate only when an ancestor sets `data-embed=true` on a `group/embed` element
+
+#### Header
+- **StatusPageHeader**: `<header>` wrapper
+- **StatusPageHeaderContent**: Inner `<nav>` row with default centering and padding
+- **StatusPageHeaderBrand**: Left-side fixed-width slot for the brand button
+- **StatusPageHeaderBrandButton**: Outlined size-8 icon button (uses `asChild` for the link)
+- **StatusPageHeaderBrandFallback**: Letter-from-title typography for when no page icon is present
+- **StatusPageHeaderNav**: Desktop nav `<ul>`
+- **StatusPageHeaderNavItem**: Single nav entry with active styling (`asChild` for the link)
+- **StatusPageHeaderActions**: Right-side fixed-width cluster (subscribe, contact, mobile-menu trigger)
+
+#### Footer
+- **StatusPageFooter**: `<footer>` wrapper
+- **StatusPageFooterContent**: Inner row with default centering and padding
+- **StatusPagePoweredBy**: "powered by …" line — pass the link element as children
+- **StatusPageFooterActions**: Right-side cluster (last-updated, locale, theme)
+
+#### Get-in-Touch
+- **StatusPageGetInTouchIcon**: Ghost icon button with tooltip chrome (uses `asChild` for the link)
+- **StatusPageGetInTouchButton**: Outlined text-label button (uses `asChild` for the link)
+
+#### Status Updates (subscription channels)
+- **StatusUpdates**: Popover root for "Get updates" controls
+- **StatusUpdatesTrigger**: Trigger button (default label from `labels.subscribe`)
+- **StatusUpdatesContent**: Popover content wrapper
+- **StatusUpdatesSection**: Per-channel description + content slot
+- **StatusUpdatesCopyInput**: Copyable URL input with toast feedback
+- **StatusUpdatesRss**: RSS + optional Atom copy boxes
+- **StatusUpdatesJson**: JSON feed copy box
+- **StatusUpdatesSlack**: Slack `/feed subscribe` snippet
+- **StatusUpdatesSsh**: SSH command copy box
+
+#### Switchers
+- **StatusThemeSwitcher**: Agnostic light/dark/system switcher — caller owns `value` + `onValueChange`
+- **StatusThemeSwitcherSkeleton**: Same footprint as the trigger; render before the active theme is known
+- **StatusLocaleSwitcher**: Agnostic locale picker — caller owns `value` + `onValueChange` + `locales` list
+- **StatusLocaleSwitcherSkeleton**: Same footprint; render before the active locale is known
## Composition Patterns
@@ -384,6 +441,146 @@ Specialized functionality components.
</StatusContent>
```
+## Internationalization (i18n)
+
+All user-facing strings, ARIA labels, and date formatters used by blocks are sourced from a single `StatusBlocksLabels` object via the `useStatusBlocksLabels()` hook. Blocks never import `next-intl`, `react-intl`, or any other i18n library directly — that contract makes them shadcn-registry-shippable while still letting consumer apps localize them.
+
+### Default behavior (no provider)
+
+Blocks render English (`en-US`) out of the box. No setup is required:
+
+```tsx
+import { StatusBanner } from "@openstatus/ui/components/blocks/status-banner";
+
+<StatusBanner status="success" />
+// Renders: "All Systems Operational" with en-US date formatting
+```
+
+Internally, `useStatusBlocksLabels()` returns `defaultStatusBlocksLabels` (exported from `status.utils.ts`) when no provider is mounted.
+
+### Localizing in your app
+
+Mount `<StatusBlocksI18nProvider>` once near the root of your tree and pass a `StatusBlocksLabels` object:
+
+```tsx
+"use client";
+
+import { useMemo } from "react";
+import { useTranslations, useLocale } from "next-intl"; // or any i18n library
+import {
+ StatusBlocksI18nProvider,
+ type StatusBlocksLabels,
+} from "@openstatus/ui/components/blocks/status-i18n";
+
+export function MyStatusBlocksProvider({ children }: { children: React.ReactNode }) {
+ const t = useTranslations();
+ const locale = useLocale();
+
+ const labels = useMemo<StatusBlocksLabels>(() => {
+ const dateFmt = new Intl.DateTimeFormat(locale, { dateStyle: "long" });
+ const dateShortFmt = new Intl.DateTimeFormat(locale, { dateStyle: "medium" });
+ const dateTimeFmt = new Intl.DateTimeFormat(locale, {
+ dateStyle: "medium",
+ timeStyle: "short",
+ });
+ return {
+ systemStatus: {
+ success: { long: t("All Systems Operational"), short: t("Operational") },
+ degraded: { long: t("Degraded Performance"), short: t("Degraded") },
+ error: { long: t("Partial Outage"), short: t("Outage") },
+ info: { long: t("Maintenance"), short: t("Maintenance") },
+ empty: { long: t("No Data"), short: t("No Data") },
+ },
+ incidentStatus: {
+ resolved: t("Resolved"),
+ monitoring: t("Monitoring"),
+ identified: t("Identified"),
+ investigating: t("Investigating"),
+ },
+ requestStatus: {
+ success: t("Normal"),
+ degraded: t("Degraded"),
+ error: t("Error"),
+ info: t("Maintenance"),
+ empty: t("No Data"),
+ },
+ today: t("today"),
+ ongoing: t("ongoing"),
+ reportResolved: t("Report resolved"),
+ noRecentNotifications: t("No recent notifications"),
+ // ...remaining labels (see StatusBlocksLabels type for the full list)
+ ariaStatusTracker: t("Status tracker"),
+ ariaDayStatus: (n) => t("Day {n} status", { n }),
+ clickAgainToUnpin: t("Click again to unpin"),
+ durationIn: (s) => t("(in {duration})", { duration: s }),
+ durationEarlier: (s) => t("({timeFromLast} earlier)", { timeFromLast: s }),
+ durationFor: (s) => t("(for {duration})", { duration: s }),
+ durationAcross: (s) => t("across {duration}", { duration: s }),
+ formatDate: (d) => dateFmt.format(d),
+ formatDateShort: (d) => dateShortFmt.format(d),
+ formatDateTime: (d) => dateTimeFmt.format(d),
+ formatDateRange: (from, to) =>
+ from && to ? `${dateFmt.format(from)} – ${dateFmt.format(to)}` : "",
+ };
+ }, [t, locale]);
+
+ return (
+ <StatusBlocksI18nProvider value={labels}>{children}</StatusBlocksI18nProvider>
+ );
+}
+```
+
+Mount it at the locale layout (or app root) above any block usage:
+
+```tsx
+<NextIntlClientProvider locale={locale} messages={messages}>
+ <MyStatusBlocksProvider>{children}</MyStatusBlocksProvider>
+</NextIntlClientProvider>
+```
+
+### Why a context (not props)?
+
+Blocks like `StatusComponentStatus` and `StatusBannerMessage` use CSS-only conditional rendering (`data-[variant=...]:block`) to swap labels — they need *all* status labels available at render time, not just "the active one." A context gives them that without prop drilling through every parent.
+
+### Why no `next-intl` import inside blocks?
+
+`@openstatus/ui` ships through the shadcn registry. A direct dependency on `next-intl` would force every consumer (Next.js or not) to install it. The provider pattern lets the consumer's app — which already has its own i18n setup — bridge translations into the blocks.
+
+### Customizing dates only
+
+If you only need locale-aware dates (English copy is fine), supply just the formatter fields and spread the defaults for the rest:
+
+```tsx
+import { defaultStatusBlocksLabels } from "@openstatus/ui/components/blocks/status.utils";
+
+const labels: StatusBlocksLabels = {
+ ...defaultStatusBlocksLabels,
+ formatDate: (d) => new Intl.DateTimeFormat(locale, { dateStyle: "long" }).format(d),
+ formatDateShort: (d) => new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(d),
+ formatDateTime: (d) =>
+ new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short" }).format(d),
+};
+```
+
+## Extension Slots
+
+Blocks expose slot props so app-specific concerns (Next.js `<Link>`, markdown rendering, etc.) stay out of the registry while still being injectable by consumers.
+
+| Block | Slot | Purpose |
+|---|---|---|
+| `StatusEventTimelineReport` | `renderMessage?: (msg: string) => ReactNode` | Pipe report message body through a markdown renderer (`<ProcessMessage>`, etc.) |
+| `StatusEventTimelineMaintenance` | `renderMessage?: (msg: string) => ReactNode` | Same, for maintenance bodies |
+| `StatusEventTimelineTitle` | `asChild?: boolean` | Wrap the title in a custom element (e.g. `<Link>`) — narrow click target without invalidating nested-interactive HTML |
+| `StatusBar` | `renderEvent?: (event, index) => ReactNode` | Wrap event badges with a Next `<Link>` (for routing to event detail) |
+| `StatusBar` | `renderBar?` / `renderCard?` | Customize bar segments and hover-card content |
+| `StatusFeed` | `renderEvent?: (event, content) => ReactNode` | Wrap each event row (e.g. with `<Link>`) |
+| `StatusFeed` | `renderReportMessage?` / `renderMaintenanceMessage?` | Forwarded to the timeline blocks above |
+| `StatusFeed` | `footer?: ReactNode` | Append content below the feed (e.g. "View events history" link) |
+| `StatusFeed` | `emptyAction?: ReactNode` | Append content inside the empty state |
+| `StatusBlankEvents` / `StatusBlankMonitors` | `action?: ReactNode` | CTA inside the empty state, wrapped in `<StatusBlankAction>` chrome |
+
+Default behavior is preserved when slots are omitted — the registry preview and unconfigured consumers render correctly without any wiring.
+
## Theming & Styling
### CSS Variables
@@ -447,7 +644,15 @@ For detailed API documentation, see the JSDoc comments in each component file:
- [status-blank.tsx](./status-blank.tsx) - Empty state components
- [status-component-group.tsx](./status-component-group.tsx) - Grouping component
- [status-icon.tsx](./status-icon.tsx) - Icon component
-- [status.utils.ts](./status.utils.ts) - Utility functions
+- [status-i18n.tsx](./status-i18n.tsx) - i18n provider, hook, and `StatusBlocksLabels` type
+- [status.utils.ts](./status.utils.ts) - Utility functions and `defaultStatusBlocksLabels`
+- [status-page-shell.tsx](./status-page-shell.tsx) - Outer page-shell wrappers (`StatusPageShell`, `StatusPageMain`)
+- [status-page-header.tsx](./status-page-header.tsx) - Header chrome (brand, nav, actions slots)
+- [status-page-footer.tsx](./status-page-footer.tsx) - Footer chrome (powered-by, action cluster)
+- [status-page-get-in-touch.tsx](./status-page-get-in-touch.tsx) - Contact-link button variants (icon + text)
+- [status-updates.tsx](./status-updates.tsx) - Subscription channel primitives (RSS / Atom / JSON / Slack / SSH)
+- [status-theme-switcher.tsx](./status-theme-switcher.tsx) - Agnostic light/dark/system switcher
+- [status-locale-switcher.tsx](./status-locale-switcher.tsx) - Agnostic locale picker
---
diff --git a/packages/ui/src/components/blocks/status-banner.tsx b/packages/ui/src/components/blocks/status-banner.tsx
index 68c968241..6fe23e21a 100644
--- a/packages/ui/src/components/blocks/status-banner.tsx
+++ b/packages/ui/src/components/blocks/status-banner.tsx
@@ -1,3 +1,5 @@
+"use client";
+
import {
Tabs,
TabsContent,
@@ -5,10 +7,10 @@ import {
TabsTrigger,
} from "@openstatus/ui/components/ui/tabs";
import { cn } from "@openstatus/ui/lib/utils";
-import { systemStatusLabels } from "@openstatus/ui/components/blocks/status.utils";
import { StatusIcon as UnifiedStatusIcon } from "@openstatus/ui/components/blocks/status-icon";
import type { StatusType } from "@openstatus/ui/components/blocks/status.types";
import { StatusTimestamp } from "@openstatus/ui/components/blocks/status-timestamp";
+import { useStatusBlocksLabels } from "@openstatus/ui/components/blocks/status-i18n";
/**
* StatusBanner - Complete banner component with integrated icon, message, and timestamp
@@ -153,19 +155,20 @@ export function StatusBannerMessage({
className,
...props
}: React.ComponentProps<"div">) {
+ const labels = useStatusBlocksLabels();
return (
<div className={cn(className)} {...props}>
<span className="hidden group-data-[status=success]/status-banner:block">
- {systemStatusLabels.success.long}
+ {labels.systemStatus.success.long}
</span>
<span className="hidden group-data-[status=degraded]/status-banner:block">
- {systemStatusLabels.degraded.long}
+ {labels.systemStatus.degraded.long}
</span>
<span className="hidden group-data-[status=error]/status-banner:block">
- {systemStatusLabels.error.long}
+ {labels.systemStatus.error.long}
</span>
<span className="hidden group-data-[status=info]/status-banner:block">
- {systemStatusLabels.info.long}
+ {labels.systemStatus.info.long}
</span>
</div>
);
diff --git a/packages/ui/src/components/blocks/status-bar.tsx b/packages/ui/src/components/blocks/status-bar.tsx
index 666c7b91f..6f7fd9cf9 100644
--- a/packages/ui/src/components/blocks/status-bar.tsx
+++ b/packages/ui/src/components/blocks/status-bar.tsx
@@ -11,16 +11,13 @@ import { useMediaQuery } from "@openstatus/ui/hooks/use-media-query";
import { cn } from "@openstatus/ui/lib/utils";
import { formatDistanceStrict } from "date-fns";
import { useCallback, useEffect, useRef, useState, forwardRef } from "react";
-import {
- statusColors,
- formatDateRange,
- requestStatusLabels,
-} from "@openstatus/ui/components/blocks/status.utils";
+import { statusColors } from "@openstatus/ui/components/blocks/status.utils";
import type {
StatusBarData,
StatusEventType,
StatusType,
} from "@openstatus/ui/components/blocks/status.types";
+import { useStatusBlocksLabels } from "@openstatus/ui/components/blocks/status-i18n";
interface StatusBarProps {
data: StatusBarData[];
@@ -423,6 +420,7 @@ export function StatusBar({
renderBar,
renderEvent,
}: StatusBarProps) {
+ const labels = useStatusBlocksLabels();
const isTouch = useMediaQuery("(hover: none)");
const { activeIndex, interactionType, containerRef, handlers, setButtonRef } =
useStatusBar({
@@ -436,7 +434,7 @@ export function StatusBar({
className="flex h-[50px] w-full items-end gap-px"
data-slot="status-bar"
role="toolbar"
- aria-label="Status tracker"
+ aria-label={labels.ariaStatusTracker}
>
{data.map((item, index) => {
const isActive = activeIndex === index;
@@ -493,12 +491,13 @@ const StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(
},
ref,
) => {
+ const labels = useStatusBlocksLabels();
return (
<HoverCard openDelay={0} closeDelay={0} open={isActive}>
<HoverCardTrigger asChild>
<div
ref={ref}
- className="group relative flex h-full flex-1 cursor-pointer flex-col outline-none hover:opacity-80 focus-visible:opacity-80 focus-visible:ring-[2px] focus-visible:ring-ring/50 data-[aria-pressed=true]:opacity-80 rounded-full"
+ className="group relative flex h-full flex-1 cursor-pointer flex-col outline-none hover:opacity-80 focus-visible:opacity-80 focus-visible:ring-[2px] focus-visible:ring-ring/50 aria-pressed:opacity-80 rounded-full"
onClick={() => handlers.onClick(index)}
onFocus={() => handlers.onFocus(index)}
onBlur={handlers.onBlur}
@@ -507,7 +506,7 @@ const StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(
onKeyDown={(e) => handlers.onKeyDown(e, index)}
tabIndex={isLastItem && !isActive ? 0 : isActive ? 0 : -1}
role="button"
- aria-label={`Day ${index + 1} status`}
+ aria-label={labels.ariaDayStatus(index + 1)}
aria-pressed={isPinned}
aria-expanded={isActive}
data-slot="status-bar-item"
@@ -595,14 +594,11 @@ function StatusBarCard({
renderCard,
renderEvent,
}: StatusBarCardProps) {
+ const labels = useStatusBlocksLabels();
return (
<div data-slot="status-bar-card">
<div className="p-2 text-xs">
- {new Date(item.day).toLocaleDateString("default", {
- day: "numeric",
- month: "short",
- year: "numeric",
- })}
+ {labels.formatDateShort(new Date(item.day))}
</div>
<Separator />
<div className="space-y-1 p-2 text-sm">
@@ -634,6 +630,7 @@ function StatusBarCard({
name={event.name}
from={event.from}
to={event.to}
+ isAggregated={event.isAggregated}
/>
);
})}
@@ -644,7 +641,7 @@ function StatusBarCard({
<>
<Separator />
<div className="flex cursor-pointer items-center p-2 text-muted-foreground text-xs">
- <span>Click again to unpin</span>
+ <span>{labels.clickAgainToUnpin}</span>
<kbd className="ml-auto inline-flex h-5 max-h-5 min-w-5 items-center justify-center rounded border border-input bg-background px-1.5 font-mono text-[10px] font-medium text-muted-foreground">
Esc
</kbd>
@@ -709,6 +706,7 @@ function StatusBarContent({
status: StatusType;
value: string;
}) {
+ const labels = useStatusBlocksLabels();
return (
<div className="flex items-baseline gap-4" data-slot="status-bar-content">
<div className="flex items-center gap-2">
@@ -718,7 +716,7 @@ function StatusBarContent({
backgroundColor: statusColors[status],
}}
/>
- <div className="text-sm">{requestStatusLabels[status]}</div>
+ <div className="text-sm">{labels.requestStatus[status]}</div>
</div>
<div className="ml-auto font-mono text-muted-foreground text-xs tracking-tight">
{value}
@@ -782,12 +780,15 @@ export function StatusBarEvent({
from,
to,
type,
+ isAggregated,
}: {
name: string;
from?: Date | null;
to?: Date | null;
type: StatusEventType;
+ isAggregated?: boolean;
}) {
+ const labels = useStatusBlocksLabels();
if (!from) return null;
const status =
@@ -810,9 +811,9 @@ export function StatusBarEvent({
</div>
</div>
<div className="mt-1 text-muted-foreground text-xs">
- {formatDateRange(from, to ?? undefined)}{" "}
+ {labels.formatDateRange(from, to ?? undefined)}{" "}
<span className="ml-1.5 font-mono text-muted-foreground/70">
- {formatDuration({ from, to, name, type })}
+ {formatDuration({ from, to, name, type, isAggregated, labels })}
</span>
</div>
</div>
@@ -823,28 +824,27 @@ StatusBarEvent.displayName = "StatusBarEvent";
/**
* formatDuration - Internal helper for formatting event durations
*
- * Formats the duration of an event based on start/end dates and event name:
+ * Formats the duration of an event based on start/end dates:
* - No start date: returns null
* - No end date: returns "ongoing"
- * - Multiple incidents (detected by "Downtime (" in name): returns "across {duration}"
+ * - Aggregated incidents (isAggregated): returns "across {duration}"
* - Zero seconds duration: returns null (hides duration)
* - Otherwise: returns formatted duration (e.g., "2 hours", "3 days")
*
- * @param from - Event start date
- * @param to - Event end date
- * @param name - Event name (used to detect multiple incident aggregations)
* @returns Formatted duration string or null
*/
const formatDuration = ({
from,
to,
- name,
-}: React.ComponentProps<typeof StatusBarEvent>) => {
+ isAggregated,
+ labels,
+}: React.ComponentProps<typeof StatusBarEvent> & {
+ labels: ReturnType<typeof useStatusBlocksLabels>;
+}) => {
if (!from) return null;
- if (!to) return "ongoing";
+ if (!to) return labels.ongoing;
const duration = formatDistanceStrict(from, to);
- const isMultipleIncidents = name.includes("Downtime (");
- if (isMultipleIncidents) return `across ${duration}`;
+ if (isAggregated) return labels.durationAcross(duration);
if (duration === "0 seconds") return null;
return duration;
};
diff --git a/packages/ui/src/components/blocks/status-blank.tsx b/packages/ui/src/components/blocks/status-blank.tsx
index fd2b00e6e..398b673a7 100644
--- a/packages/ui/src/components/blocks/status-blank.tsx
+++ b/packages/ui/src/components/blocks/status-blank.tsx
@@ -1,3 +1,6 @@
+"use client";
+
+import { useStatusBlocksLabels } from "@openstatus/ui/components/blocks/status-i18n";
import { cn } from "@openstatus/ui/lib/utils";
// ============================================================================
@@ -432,8 +435,8 @@ export function StatusBlankOverlay({
* effect with the front card at full opacity and back cards progressively
* faded and scaled down.
*
- * @param title - The empty state heading (default: "No reports found")
- * @param description - The empty state description (default: "No reports found for this status page.")
+ * @param title - The empty state heading (defaults to `labels.noReports` from the i18n provider)
+ * @param description - The empty state description (defaults to `labels.noReportsDescription` from the i18n provider)
*
* @example
* ```tsx
@@ -446,13 +449,16 @@ export function StatusBlankOverlay({
* @see StatusBlankReport - For the underlying report visualization
*/
export function StatusBlankEvents({
- title = "No reports found",
- description = "No reports found for this status page.",
+ title,
+ description,
+ action,
...props
}: React.ComponentProps<typeof StatusBlankContainer> & {
title?: string;
description?: string;
+ action?: React.ReactNode;
}) {
+ const labels = useStatusBlocksLabels();
return (
<StatusBlankContainer {...props}>
<div className="relative mt-8 flex w-full flex-col items-center justify-center">
@@ -461,9 +467,12 @@ export function StatusBlankEvents({
<StatusBlankReport />
</div>
<StatusBlankContent>
- <StatusBlankTitle>{title}</StatusBlankTitle>
- <StatusBlankDescription>{description}</StatusBlankDescription>
+ <StatusBlankTitle>{title ?? labels.noReports}</StatusBlankTitle>
+ <StatusBlankDescription>
+ {description ?? labels.noReportsDescription}
+ </StatusBlankDescription>
</StatusBlankContent>
+ {action}
</StatusBlankContainer>
);
}
@@ -480,8 +489,8 @@ export function StatusBlankEvents({
* effect with the front card at full opacity and back cards progressively
* faded and scaled down.
*
- * @param title - The empty state heading (default: "No public monitors")
- * @param description - The empty state description (default: "No public monitors have been added to this page.")
+ * @param title - The empty state heading (defaults to `labels.noPublicMonitors` from the i18n provider)
+ * @param description - The empty state description (defaults to `labels.noPublicMonitorsDescription` from the i18n provider)
*
* @example
* ```tsx
@@ -494,13 +503,16 @@ export function StatusBlankEvents({
* @see StatusBlankMonitor - For the underlying monitor visualization
*/
export function StatusBlankMonitors({
- title = "No public monitors",
- description = "No public monitors have been added to this page.",
+ title,
+ description,
+ action,
...props
}: React.ComponentProps<typeof StatusBlankContainer> & {
title?: string;
description?: string;
+ action?: React.ReactNode;
}) {
+ const labels = useStatusBlocksLabels();
return (
<StatusBlankContainer {...props}>
<div className="relative mt-8 flex w-full flex-col items-center justify-center">
@@ -509,9 +521,40 @@ export function StatusBlankMonitors({
<StatusBlankMonitor />
</div>
<StatusBlankContent>
- <StatusBlankTitle>{title}</StatusBlankTitle>
- <StatusBlankDescription>{description}</StatusBlankDescription>
+ <StatusBlankTitle>{title ?? labels.noPublicMonitors}</StatusBlankTitle>
+ <StatusBlankDescription>
+ {description ?? labels.noPublicMonitorsDescription}
+ </StatusBlankDescription>
</StatusBlankContent>
+ {action}
</StatusBlankContainer>
);
}
+
+/**
+ * StatusBlankAction - Styled wrapper for empty-state CTAs.
+ *
+ * Applies border + hover chrome around any actionable child (link, button).
+ * Pass a bare `<Link>` or `<button>` — this component owns the look. Consumers
+ * of `StatusBlankEvents`/`StatusBlankMonitors`/`StatusFeed.emptyAction` must
+ * wrap their action in this themselves; the parents render the action raw to
+ * avoid doubling chrome on already-styled controls.
+ */
+export function StatusBlankAction({
+ children,
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="status-blank-action"
+ className={cn(
+ "mt-2 inline-flex items-center justify-center rounded-md border border-border/70 px-3 py-1.5 font-mono text-muted-foreground text-sm hover:border-border hover:text-foreground [&>a]:no-underline [&>a]:text-inherit",
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ </div>
+ );
+}
diff --git a/packages/ui/src/components/blocks/status-component.tsx b/packages/ui/src/components/blocks/status-component.tsx
index d3961dae9..d2c8407ae 100644
--- a/packages/ui/src/components/blocks/status-component.tsx
+++ b/packages/ui/src/components/blocks/status-component.tsx
@@ -17,7 +17,7 @@ import type {
StatusBarData,
StatusType,
} from "@openstatus/ui/components/blocks/status.types";
-import { systemStatusLabels } from "@openstatus/ui/components/blocks/status.utils";
+import { useStatusBlocksLabels } from "@openstatus/ui/components/blocks/status-i18n";
// ============================================================================
// Layout Components
@@ -410,6 +410,7 @@ export function StatusComponentFooter({
data: StatusBarData[];
isLoading?: boolean;
}) {
+ const labels = useStatusBlocksLabels();
return (
<div
data-slot="status-component-footer"
@@ -427,7 +428,7 @@ export function StatusComponentFooter({
"-"
)}
</div>
- <div>today</div>
+ <div>{labels.today}</div>
</div>
);
}
@@ -540,6 +541,7 @@ export function StatusComponentStatus({
className,
...props
}: React.ComponentProps<"div">) {
+ const labels = useStatusBlocksLabels();
return (
<div
data-slot="status-component-status"
@@ -554,16 +556,16 @@ export function StatusComponentStatus({
{...props}
>
<span className="hidden group-data-[variant=success]/component:block">
- {systemStatusLabels.success.short}
+ {labels.systemStatus.success.short}
</span>
<span className="hidden group-data-[variant=degraded]/component:block">
- {systemStatusLabels.degraded.short}
+ {labels.systemStatus.degraded.short}
</span>
<span className="hidden group-data-[variant=error]/component:block">
- {systemStatusLabels.error.short}
+ {labels.systemStatus.error.short}
</span>
<span className="hidden group-data-[variant=info]/component:block">
- {systemStatusLabels.info.short}
+ {labels.systemStatus.info.short}
</span>
</div>
);
diff --git a/packages/ui/src/components/blocks/status-events.tsx b/packages/ui/src/components/blocks/status-events.tsx
index 0e2b7eaed..eb916b3af 100644
--- a/packages/ui/src/components/blocks/status-events.tsx
+++ b/packages/ui/src/components/blocks/status-events.tsx
@@ -1,3 +1,6 @@
+"use client";
+
+import { Slot } from "@radix-ui/react-slot";
import { Badge } from "@openstatus/ui/components/ui/badge";
import { Separator } from "@openstatus/ui/components/ui/separator";
import {
@@ -9,14 +12,9 @@ import {
import { cn } from "@openstatus/ui/lib/utils";
import { formatDistanceStrict } from "date-fns";
import { Check } from "lucide-react";
-import {
- formatDateRange,
- incidentStatusLabels,
- formatDate,
- formatDateTime,
-} from "@openstatus/ui/components/blocks/status.utils";
import type { StatusReportUpdateType } from "@openstatus/ui/components/blocks/status.types";
import { StatusTimestamp } from "@openstatus/ui/components/blocks/status-timestamp";
+import { useStatusBlocksLabels } from "@openstatus/ui/components/blocks/status-i18n";
// ============================================================================
// Container Components
@@ -186,6 +184,7 @@ export function StatusEventTitleCheck({
children,
...props
}: React.ComponentProps<"div">) {
+ const labels = useStatusBlocksLabels();
return (
<div
data-slot="status-event-title-check"
@@ -194,13 +193,13 @@ export function StatusEventTitleCheck({
>
<TooltipProvider>
<Tooltip>
- <TooltipTrigger aria-label="Report resolved">
+ <TooltipTrigger aria-label={labels.reportResolved}>
<div className="rounded-full border border-success/20 bg-success/10 p-0.5 text-success">
<Check className="size-3 shrink-0" aria-hidden="true" />
</div>
</TooltipTrigger>
<TooltipContent>
- <p>Report resolved</p>
+ <p>{labels.reportResolved}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
@@ -297,6 +296,7 @@ export function StatusEventDate({
}: React.ComponentProps<"div"> & {
date: Date;
}) {
+ const labels = useStatusBlocksLabels();
const isFuture = date > new Date();
const distance = formatDistanceStrict(date, new Date(), { addSuffix: true });
return (
@@ -306,7 +306,7 @@ export function StatusEventDate({
{...props}
>
<div className="font-medium text-foreground">
- {formatDate(date, { month: "short" })}
+ {labels.formatDateShort(date)}
</div>{" "}
<Badge
data-slot="status-event-date-badge"
@@ -419,12 +419,15 @@ export function StatusEventTimelineReport({
updates,
withDot = true,
maxUpdates,
+ renderMessage,
...props
}: React.ComponentProps<"div"> & {
updates: StatusReportUpdate[];
withDot?: boolean;
maxUpdates?: number;
+ renderMessage?: (message: string) => React.ReactNode;
}) {
+ const labels = useStatusBlocksLabels();
const sortedUpdates = [...updates].sort(
(a, b) => b.date.getTime() - a.date.getTime(),
);
@@ -450,12 +453,12 @@ export function StatusEventTimelineReport({
const duration = formatDistanceStrict(startedAt, updateDate);
if (duration !== "0 seconds" && update.status === "resolved") {
- durationText = `(in ${duration})`;
+ durationText = labels.durationIn(duration);
}
} else {
const lastUpdateDate = new Date(displayedUpdates[index - 1].date);
const timeFromLast = formatDistanceStrict(updateDate, lastUpdateDate);
- durationText = `(${timeFromLast} earlier)`;
+ durationText = labels.durationEarlier(timeFromLast);
}
return (
@@ -466,6 +469,7 @@ export function StatusEventTimelineReport({
withSeparator={index !== displayedUpdates.length - 1}
withDot={withDot}
isLast={index === displayedUpdates.length - 1}
+ renderMessage={renderMessage}
/>
);
})}
@@ -512,13 +516,16 @@ export function StatusEventTimelineReportUpdate({
withSeparator = true,
withDot = true,
isLast = false,
+ renderMessage,
}: {
report: StatusReportUpdate;
withSeparator?: boolean;
duration?: string;
withDot?: boolean;
isLast?: boolean;
+ renderMessage?: (message: string) => React.ReactNode;
}) {
+ const labels = useStatusBlocksLabels();
return (
<div
data-slot="status-event-timeline-report-update"
@@ -537,11 +544,11 @@ export function StatusEventTimelineReportUpdate({
) : null}
<div className={cn(isLast ? "mb-0" : "mb-2")}>
<StatusEventTimelineTitle>
- <span>{incidentStatusLabels[report.status]}</span>{" "}
+ <span>{labels.incidentStatus[report.status]}</span>{" "}
<span className="text-muted-foreground/70">·</span>{" "}
<span className="font-mono text-muted-foreground text-xs">
<StatusTimestamp date={report.date} variant="rich" asChild>
- <span>{formatDateTime(report.date)}</span>
+ <span>{labels.formatDateTime(report.date)}</span>
</StatusTimestamp>
</span>{" "}
{duration ? (
@@ -553,8 +560,9 @@ export function StatusEventTimelineReportUpdate({
<StatusEventTimelineMessage>
{report.message.trim() === "" ? (
<span className="text-muted-foreground/70">-</span>
+ ) : renderMessage ? (
+ renderMessage(report.message)
) : (
- // NOTE: App should wrap this with ProcessMessage if needed
<span>{report.message}</span>
)}
</StatusEventTimelineMessage>
@@ -604,14 +612,18 @@ interface StatusMaintenanceUpdate {
export function StatusEventTimelineMaintenance({
maintenance,
withDot = true,
+ renderMessage,
}: {
maintenance: StatusMaintenanceUpdate;
withDot?: boolean;
+ renderMessage?: (message: string) => React.ReactNode;
}) {
+ const labels = useStatusBlocksLabels();
const duration = formatDistanceStrict(maintenance.from, maintenance.to);
- const range = formatDateRange(maintenance.from, maintenance.to);
- // NOTE: because formatDateRange is sure to return a range, we can split it into two dates
- const [from, to] = range.split(" - ");
+ const { from, to } = labels.formatDateRangeParts(
+ maintenance.from,
+ maintenance.to,
+ );
return (
<div
data-slot="status-event-timeline-maintenance"
@@ -643,13 +655,15 @@ export function StatusEventTimelineMaintenance({
</span>{" "}
{duration ? (
<span className="font-mono text-muted-foreground/70 text-xs">
- (for {duration})
+ {labels.durationFor(duration)}
</span>
) : null}
</StatusEventTimelineTitle>
<StatusEventTimelineMessage>
{maintenance.message.trim() === "" ? (
<span className="text-muted-foreground/70">-</span>
+ ) : renderMessage ? (
+ renderMessage(maintenance.message)
) : (
maintenance.message
)}
@@ -677,16 +691,18 @@ export function StatusEventTimelineMaintenance({
export function StatusEventTimelineTitle({
className,
children,
+ asChild,
...props
-}: React.ComponentProps<"div">) {
+}: React.ComponentProps<"div"> & { asChild?: boolean }) {
+ const Comp = asChild ? Slot : "div";
return (
- <div
+ <Comp
data-slot="status-event-timeline-title"
className={cn("font-medium text-foreground text-sm", className)}
{...props}
>
{children}
- </div>
+ </Comp>
);
}
diff --git a/packages/ui/src/components/blocks/status-feed.tsx b/packages/ui/src/components/blocks/status-feed.tsx
index 86e50af15..0db31a628 100644
--- a/packages/ui/src/components/blocks/status-feed.tsx
+++ b/packages/ui/src/components/blocks/status-feed.tsx
@@ -1,12 +1,6 @@
"use client";
import { useMemo } from "react";
-import {
- StatusBlankContainer,
- StatusBlankContent,
- StatusBlankDescription,
- StatusBlankReport,
- StatusBlankTitle,
-} from "@openstatus/ui/components/blocks/status-blank";
+import { StatusBlankEvents } from "@openstatus/ui/components/blocks/status-blank";
import {
StatusEvent,
StatusEventAffected,
@@ -19,6 +13,7 @@ import {
StatusEventTimelineReport,
StatusEventTitle,
} from "@openstatus/ui/components/blocks/status-events";
+import { useStatusBlocksLabels } from "@openstatus/ui/components/blocks/status-i18n";
import type {
StatusReport,
Maintenance,
@@ -169,11 +164,27 @@ function isMaintenance(
export function StatusFeed({
statusReports = [],
maintenances = [],
+ footer,
+ emptyAction,
+ renderReportMessage,
+ renderMaintenanceMessage,
+ renderEvent,
...props
}: React.ComponentProps<"div"> & {
statusReports?: StatusReport[];
maintenances?: Maintenance[];
+ footer?: React.ReactNode;
+ emptyAction?: React.ReactNode;
+ renderReportMessage?: (message: string) => React.ReactNode;
+ renderMaintenanceMessage?: (message: string) => React.ReactNode;
+ renderEvent?: (
+ event:
+ | { type: "report"; data: StatusReport }
+ | { type: "maintenance"; data: Maintenance },
+ children: React.ReactNode,
+ ) => React.ReactNode;
}) {
+ const labels = useStatusBlocksLabels();
// Memoize the unified events array to prevent flicker on re-renders
const unifiedEvents = useMemo<UnifiedEvent[]>(() => {
return [
@@ -201,35 +212,24 @@ export function StatusFeed({
if (unifiedEvents.length === 0) {
return (
- <StatusBlankContainer>
- <div className="relative mt-8 flex w-full flex-col items-center justify-center">
- <StatusBlankReport className="-top-16 absolute scale-60 opacity-50" />
- <StatusBlankReport className="-top-8 absolute scale-80 opacity-80" />
- <StatusBlankReport />
- </div>
- <StatusBlankContent>
- <StatusBlankTitle>No recent notifications</StatusBlankTitle>
- <StatusBlankDescription>
- There have been no reports within the last 7 days.
- </StatusBlankDescription>
- </StatusBlankContent>
- </StatusBlankContainer>
+ <StatusBlankEvents
+ title={labels.noRecentNotifications}
+ description={labels.noRecentNotificationsDescription}
+ action={emptyAction}
+ />
);
}
return (
- <StatusEventGroup data-slot="status-feed" {...props}>
- {unifiedEvents.map((event) => {
- // Use stable key to prevent flicker
- const key = `${event.type}-${event.id}`;
+ <>
+ <StatusEventGroup data-slot="status-feed" {...props}>
+ {unifiedEvents.map((event) => {
+ // Use stable key to prevent flicker
+ const key = `${event.type}-${event.id}`;
- if (isStatusReport(event)) {
- const report = event.data;
- return (
- <StatusEvent key={key}>
- <StatusEventAside>
- <StatusEventDate date={event.startDate} />
- </StatusEventAside>
+ if (isStatusReport(event)) {
+ const report = event.data;
+ const node = (
<StatusEventContent>
<StatusEventTitle>{report.title}</StatusEventTitle>
{report.affected.length > 0 && (
@@ -241,19 +241,27 @@ export function StatusFeed({
))}
</StatusEventAffected>
)}
- <StatusEventTimelineReport updates={report.updates} />
+ <StatusEventTimelineReport
+ updates={report.updates}
+ renderMessage={renderReportMessage}
+ />
</StatusEventContent>
- </StatusEvent>
- );
- }
+ );
+ return (
+ <StatusEvent key={key}>
+ <StatusEventAside>
+ <StatusEventDate date={event.startDate} />
+ </StatusEventAside>
+ {renderEvent
+ ? renderEvent({ type: "report", data: report }, node)
+ : node}
+ </StatusEvent>
+ );
+ }
- if (isMaintenance(event)) {
- const maintenance = event.data;
- return (
- <StatusEvent key={key}>
- <StatusEventAside>
- <StatusEventDate date={event.startDate} />
- </StatusEventAside>
+ if (isMaintenance(event)) {
+ const maintenance = event.data;
+ const node = (
<StatusEventContent>
<StatusEventTitle>{maintenance.title}</StatusEventTitle>
{maintenance.affected.length > 0 && (
@@ -272,14 +280,26 @@ export function StatusFeed({
from: maintenance.from,
to: maintenance.to,
}}
+ renderMessage={renderMaintenanceMessage}
/>
</StatusEventContent>
- </StatusEvent>
- );
- }
- return null;
- })}
- </StatusEventGroup>
+ );
+ return (
+ <StatusEvent key={key}>
+ <StatusEventAside>
+ <StatusEventDate date={event.startDate} />
+ </StatusEventAside>
+ {renderEvent
+ ? renderEvent({ type: "maintenance", data: maintenance }, node)
+ : node}
+ </StatusEvent>
+ );
+ }
+ return null;
+ })}
+ </StatusEventGroup>
+ {footer}
+ </>
);
}
StatusFeed.displayName = "StatusFeed";
diff --git a/packages/ui/src/components/blocks/status-i18n.tsx b/packages/ui/src/components/blocks/status-i18n.tsx
new file mode 100644
index 000000000..5cf82a6b9
--- /dev/null
+++ b/packages/ui/src/components/blocks/status-i18n.tsx
@@ -0,0 +1,94 @@
+"use client";
+
+import { createContext, useContext } from "react";
+import { defaultStatusBlocksLabels } from "@openstatus/ui/components/blocks/status.utils";
+import type {
+ StatusReportUpdateType,
+ StatusType,
+ ThemeValue,
+} from "@openstatus/ui/components/blocks/status.types";
+
+/**
+ * Labels and locale-aware formatters consumed by block components.
+ *
+ * Blocks read this via `useStatusBlocksLabels()`. When no provider is mounted,
+ * the hook returns `defaultStatusBlocksLabels` (English, "en-US" formatting).
+ * Apps wanting localized copy should mount `StatusBlocksI18nProvider` and
+ * supply translated strings + locale-aware formatters.
+ */
+export type StatusBlocksLabels = {
+ systemStatus: Record<StatusType, { long: string; short: string }>;
+ incidentStatus: Record<StatusReportUpdateType, string>;
+ requestStatus: Record<StatusType, string>;
+
+ today: string;
+ ongoing: string;
+ reportResolved: string;
+ noRecentNotifications: string;
+ noRecentNotificationsDescription: string;
+ noReports: string;
+ noReportsDescription: string;
+ noPublicMonitors: string;
+ noPublicMonitorsDescription: string;
+
+ themeNames: Record<ThemeValue, string>;
+ ariaToggleTheme: string;
+
+ subscribe: string;
+ subscribeRssDescription: string;
+ subscribeAtomDescription: string;
+ subscribeJsonDescription: string;
+ subscribeSlackDescription: string;
+ subscribeSshDescription: string;
+ linkCopiedToClipboard: string;
+ ariaCopyLink: string;
+
+ poweredBy: string;
+ getInTouch: string;
+
+ ariaStatusTracker: string;
+ ariaDayStatus: (n: number) => string;
+ clickAgainToUnpin: string;
+
+ durationIn: (s: string) => string;
+ durationEarlier: (s: string) => string;
+ durationFor: (s: string) => string;
+ durationAcross: (s: string) => string;
+
+ formatDate: (d: Date) => string;
+ formatDateShort: (d: Date) => string;
+ formatDateTime: (d: Date) => string;
+ formatDateRange: (from?: Date, to?: Date) => string;
+ /**
+ * Returns the start/end of a closed range as separate strings, so callers
+ * can render each side independently (e.g. wrap each in a hovercard)
+ * without re-parsing the joined output of `formatDateRange`.
+ *
+ * Implementations should collapse same-day ranges (date on `from`, time
+ * only on `to`) the same way `formatDateRange` does.
+ *
+ * Closed ranges only — both `from` and `to` are required. For open-ended
+ * cases (`Since …` / `Until …` / `All time`) use `formatDateRange`.
+ */
+ formatDateRangeParts: (from: Date, to: Date) => { from: string; to: string };
+};
+
+const StatusBlocksLabelsContext = createContext<StatusBlocksLabels | null>(null);
+
+export function StatusBlocksI18nProvider({
+ value,
+ children,
+}: {
+ value: StatusBlocksLabels;
+ children: React.ReactNode;
+}) {
+ return (
+ <StatusBlocksLabelsContext.Provider value={value}>
+ {children}
+ </StatusBlocksLabelsContext.Provider>
+ );
+}
+
+export function useStatusBlocksLabels(): StatusBlocksLabels {
+ return useContext(StatusBlocksLabelsContext) ?? defaultStatusBlocksLabels;
+}
diff --git a/packages/ui/src/components/blocks/status-locale-switcher.tsx b/packages/ui/src/components/blocks/status-locale-switcher.tsx
new file mode 100644
index 000000000..17ce9552e
--- /dev/null
+++ b/packages/ui/src/components/blocks/status-locale-switcher.tsx
@@ -0,0 +1,102 @@
+"use client";
+
+import { Button } from "@openstatus/ui/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@openstatus/ui/components/ui/dropdown-menu";
+import { Skeleton } from "@openstatus/ui/components/ui/skeleton";
+import { cn } from "@openstatus/ui/lib/utils";
+
+export type StatusLocaleOption = {
+ /** Locale code, e.g. "en", "fr". Rendered uppercase as the trigger label. */
+ value: string;
+ /** Human-readable label shown in the dropdown row. Caller decides language. */
+ label: string;
+};
+
+/**
+ * StatusLocaleSwitcher — agnostic locale picker.
+ *
+ * Pure presentation: caller owns `value`, `onValueChange`, and label resolution.
+ * No `next-intl`, no router, no locale detection. Renders nothing when
+ * `locales.length <= 1` so callers can mount it unconditionally.
+ */
+export function StatusLocaleSwitcher({
+ value,
+ onValueChange,
+ locales,
+ disabled,
+ className,
+ ...props
+}: Omit<
+ React.ComponentProps<typeof DropdownMenuTrigger>,
+ "value" | "onValueChange"
+> & {
+ value: string;
+ onValueChange: (value: string) => void;
+ locales: StatusLocaleOption[];
+ disabled?: boolean;
+}) {
+ if (locales.length <= 1) return null;
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger className={cn(className)} asChild {...props}>
+ <Button
+ data-slot="status-locale-switcher"
+ variant="ghost"
+ size="icon"
+ disabled={disabled}
+ className="font-mono uppercase"
+ >
+ {value}
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" alignOffset={-4}>
+ <DropdownMenuGroup>
+ {locales.map((locale) => (
+ <DropdownMenuItem
+ data-slot="status-locale-switcher-item"
+ key={locale.value}
+ onClick={() => onValueChange(locale.value)}
+ >
+ {locale.label}{" "}
+ <span
+ className={cn(
+ "ml-auto font-mono uppercase",
+ locale.value === value
+ ? "text-foreground"
+ : "text-muted-foreground",
+ )}
+ >
+ {locale.value}
+ </span>
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+}
+
+/**
+ * StatusLocaleSwitcherSkeleton — same footprint as the trigger button.
+ * Render while the active locale isn't known yet (e.g. before next-intl
+ * hydrates) so the surrounding layout doesn't shift.
+ */
+export function StatusLocaleSwitcherSkeleton({
+ className,
+ ...props
+}: React.ComponentProps<typeof Skeleton>) {
+ return (
+ <Skeleton
+ data-slot="status-locale-switcher-skeleton"
+ className={cn("size-9", className)}
+ {...props}
+ />
+ );
+}
diff --git a/packages/ui/src/components/blocks/status-page-footer.tsx b/packages/ui/src/components/blocks/status-page-footer.tsx
new file mode 100644
index 000000000..1f535d82e
--- /dev/null
+++ b/packages/ui/src/components/blocks/status-page-footer.tsx
@@ -0,0 +1,82 @@
+"use client";
+
+import { useStatusBlocksLabels } from "@openstatus/ui/components/blocks/status-i18n";
+import { cn } from "@openstatus/ui/lib/utils";
+
+/**
+ * StatusPageFooter — presentation-only footer chrome.
+ *
+ * Compose with `StatusPageFooterContent`, `StatusPagePoweredBy`, and
+ * `StatusPageFooterActions`. Embed / white-label gating, locale + theme
+ * switchers, and the tRPC fetch all stay in the wrapping app.
+ */
+export function StatusPageFooter({
+ className,
+ ...props
+}: React.ComponentProps<"footer">) {
+ return (
+ <footer
+ data-slot="status-page-footer"
+ className={cn(className)}
+ {...props}
+ />
+ );
+}
+
+export function StatusPageFooterContent({
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="status-page-footer-content"
+ className={cn(
+ "mx-auto flex max-w-2xl items-center justify-between gap-4 px-3 py-2",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+/**
+ * StatusPagePoweredBy — "powered by …" line. The link element (with href,
+ * target, utm params, app-specific Link wrapper, etc.) is supplied as
+ * children so the block stays routing-agnostic.
+ */
+export function StatusPagePoweredBy({
+ children,
+ className,
+ ...props
+}: React.ComponentProps<"p">) {
+ const labels = useStatusBlocksLabels();
+ return (
+ <p
+ data-slot="status-page-powered-by"
+ className={cn(
+ "font-mono text-muted-foreground text-xs leading-none sm:text-sm",
+ className,
+ )}
+ {...props}
+ >
+ {labels.poweredBy} {children}
+ </p>
+ );
+}
+
+/**
+ * StatusPageFooterActions — right-side cluster (last-updated, locale,
+ * theme). Pass actions as children; the block is layout-only.
+ */
+export function StatusPageFooterActions({
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="status-page-footer-actions"
+ className={cn("flex items-center gap-2", className)}
+ {...props}
+ />
+ );
+}
diff --git a/packages/ui/src/components/blocks/status-page-get-in-touch.tsx b/packages/ui/src/components/blocks/status-page-get-in-touch.tsx
new file mode 100644
index 000000000..98d1a53c3
--- /dev/null
+++ b/packages/ui/src/components/blocks/status-page-get-in-touch.tsx
@@ -0,0 +1,72 @@
+"use client";
+
+import { useStatusBlocksLabels } from "@openstatus/ui/components/blocks/status-i18n";
+import { Button } from "@openstatus/ui/components/ui/button";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@openstatus/ui/components/ui/tooltip";
+import { cn } from "@openstatus/ui/lib/utils";
+
+/**
+ * StatusPageGetInTouchIcon — ghost icon button with tooltip chrome.
+ *
+ * Pass the link element (with href + target + icon + sr-only label) as
+ * children; the block layers Button styling, asChild Slot, and the tooltip.
+ * Wraps in its own TooltipProvider so it's safe to mount anywhere.
+ */
+export function StatusPageGetInTouchIcon({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof Button>) {
+ const labels = useStatusBlocksLabels();
+ return (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ data-slot="status-page-get-in-touch-icon"
+ variant="ghost"
+ size="icon"
+ type="button"
+ className={cn("size-8", className)}
+ asChild
+ {...props}
+ >
+ {children}
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>{labels.getInTouch}</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ );
+}
+
+/**
+ * StatusPageGetInTouchButton — outlined text-label button.
+ *
+ * Pass the link element (with href + target) as children; the block layers
+ * Button styling and asChild Slot. Default label is `labels.getInTouch` —
+ * the caller's link content overrides it if they pass children with text.
+ */
+export function StatusPageGetInTouchButton({
+ className,
+ ...props
+}: React.ComponentProps<typeof Button>) {
+ return (
+ <Button
+ data-slot="status-page-get-in-touch-button"
+ variant="outline"
+ size="sm"
+ type="button"
+ className={className}
+ asChild
+ {...props}
+ />
+ );
+}
diff --git a/packages/ui/src/components/blocks/status-page-header.tsx b/packages/ui/src/components/blocks/status-page-header.tsx
new file mode 100644
index 000000000..e1cca065c
--- /dev/null
+++ b/packages/ui/src/components/blocks/status-page-header.tsx
@@ -0,0 +1,177 @@
+"use client";
+
+import { Button } from "@openstatus/ui/components/ui/button";
+import { cn } from "@openstatus/ui/lib/utils";
+
+/**
+ * StatusPageHeader — presentation-only header chrome.
+ *
+ * Compose with `StatusPageHeaderContent`, `StatusPageHeaderBrand`,
+ * `StatusPageHeaderNav` (+ `Item`), and `StatusPageHeaderActions`. Embed
+ * gating, route-aware active state, mobile menu shell, brand link target,
+ * and tRPC fetch all stay in the wrapping app.
+ */
+export function StatusPageHeader({
+ className,
+ ...props
+}: React.ComponentProps<"header">) {
+ return (
+ <header
+ data-slot="status-page-header"
+ className={cn(className)}
+ {...props}
+ />
+ );
+}
+
+export function StatusPageHeaderContent({
+ className,
+ ...props
+}: React.ComponentProps<"nav">) {
+ return (
+ <nav
+ data-slot="status-page-header-content"
+ className={cn(
+ "mx-auto flex max-w-2xl items-center justify-between gap-3 px-3 py-2",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+/**
+ * StatusPageHeaderBrand — left-side fixed-width slot. Pass the brand button
+ * (with link target) as children.
+ */
+export function StatusPageHeaderBrand({
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="status-page-header-brand"
+ className={cn("flex w-[150px] shrink-0", className)}
+ {...props}
+ />
+ );
+}
+
+/**
+ * StatusPageHeaderBrandButton — outlined size-8 icon button that hosts the
+ * brand link. Pass the actual link element as children via `asChild`.
+ */
+export function StatusPageHeaderBrandButton({
+ className,
+ ...props
+}: React.ComponentProps<typeof Button>) {
+ return (
+ <Button
+ data-slot="status-page-header-brand-button"
+ variant="outline"
+ size="icon"
+ className={cn("size-8 overflow-hidden", className)}
+ asChild
+ {...props}
+ />
+ );
+}
+
+/**
+ * StatusPageHeaderBrandFallback — letter-from-title typography used when no
+ * page icon is present. Renders the first character of up to two words,
+ * uppercased.
+ */
+export function StatusPageHeaderBrandFallback({
+ title,
+ className,
+ ...props
+}: Omit<React.ComponentProps<"div">, "children"> & { title?: string }) {
+ const initials =
+ (title ?? "")
+ .trim()
+ .split(/\s+/)
+ .filter(Boolean)
+ .map((word) => word.charAt(0))
+ .slice(0, 2)
+ .join("")
+ .toUpperCase() || "?";
+ return (
+ <div
+ data-slot="status-page-header-brand-fallback"
+ className={cn(
+ "flex size-8 items-center justify-center font-mono",
+ className,
+ )}
+ {...props}
+ >
+ {initials}
+ </div>
+ );
+}
+
+/**
+ * StatusPageHeaderNav — desktop nav list. Compose with
+ * `StatusPageHeaderNavItem` children.
+ */
+export function StatusPageHeaderNav({
+ className,
+ ...props
+}: React.ComponentProps<"ul">) {
+ return (
+ <ul
+ data-slot="status-page-header-nav"
+ className={cn("flex flex-row gap-0.5", className)}
+ {...props}
+ />
+ );
+}
+
+/**
+ * StatusPageHeaderNavItem — single nav entry. Pass the link element via
+ * `asChild`; the block renders the Button chrome and active styling.
+ */
+export function StatusPageHeaderNavItem({
+ isActive,
+ className,
+ ...props
+}: React.ComponentProps<typeof Button> & { isActive?: boolean }) {
+ return (
+ <li data-slot="status-page-header-nav-item">
+ <Button
+ data-slot="status-page-header-nav-item-button"
+ data-active={isActive ? "true" : undefined}
+ variant={isActive ? "secondary" : "ghost"}
+ size="sm"
+ asChild
+ className={cn(
+ "border",
+ isActive ? "border-input" : "border-transparent",
+ className,
+ )}
+ {...props}
+ />
+ </li>
+ );
+}
+
+/**
+ * StatusPageHeaderActions — right-side fixed-width cluster (subscribe,
+ * contact, mobile-menu trigger). Pass actions as children; the block is
+ * layout-only.
+ */
+export function StatusPageHeaderActions({
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="status-page-header-actions"
+ className={cn(
+ "flex min-w-[150px] items-center justify-end gap-2",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
diff --git a/packages/ui/src/components/blocks/status-page-shell.tsx b/packages/ui/src/components/blocks/status-page-shell.tsx
new file mode 100644
index 000000000..6572ea97a
--- /dev/null
+++ b/packages/ui/src/components/blocks/status-page-shell.tsx
@@ -0,0 +1,49 @@
+import { cn } from "@openstatus/ui/lib/utils";
+
+/**
+ * StatusPageShell — outer chrome wrapper around `<header>`, `<main>`, and
+ * `<footer>`.
+ *
+ * Bare structural `<div>` with sensible defaults (full-height column with
+ * gap). Routing-agnostic: it knows nothing about embed mode. Apps that
+ * support embedding wrap this with their own provider that toggles
+ * `group/embed` + `data-embed` / `data-hide-*` attributes from above.
+ *
+ * Override `min-h-screen` via `className` (e.g. `min-h-0`) when mounting
+ * inside a constrained container like a dashboard preview card.
+ */
+export function StatusPageShell({
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="status-page-shell"
+ className={cn("flex min-h-screen flex-col gap-4", className)}
+ {...props}
+ />
+ );
+}
+
+/**
+ * StatusPageMain — inner `<main>` content column.
+ *
+ * Centers content at `max-w-2xl` with the canonical padding and column
+ * layout. Routing- and embed-agnostic: callers that support an embed mode
+ * layer their own `group-data-*` classes via `className`.
+ */
+export function StatusPageMain({
+ className,
+ ...props
+}: React.ComponentProps<"main">) {
+ return (
+ <main
+ data-slot="status-page-main"
+ className={cn(
+ "mx-auto flex w-full max-w-2xl flex-1 flex-col px-3 py-2",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
diff --git a/packages/ui/src/components/blocks/status-theme-switcher.tsx b/packages/ui/src/components/blocks/status-theme-switcher.tsx
new file mode 100644
index 000000000..e8decc4a4
--- /dev/null
+++ b/packages/ui/src/components/blocks/status-theme-switcher.tsx
@@ -0,0 +1,102 @@
+"use client";
+
+import { useStatusBlocksLabels } from "@openstatus/ui/components/blocks/status-i18n";
+import {
+ THEME_VALUES,
+ type ThemeValue,
+} from "@openstatus/ui/components/blocks/status.types";
+import { Button } from "@openstatus/ui/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@openstatus/ui/components/ui/dropdown-menu";
+import { Skeleton } from "@openstatus/ui/components/ui/skeleton";
+import { cn } from "@openstatus/ui/lib/utils";
+import { Laptop, Moon, Sun } from "lucide-react";
+
+export type { ThemeValue };
+
+function ThemeIcon({
+ value,
+ className,
+}: {
+ value: ThemeValue;
+ className?: string;
+}) {
+ const Icon = value === "light" ? Sun : value === "dark" ? Moon : Laptop;
+ return <Icon className={cn("h-4 w-4", className)} />;
+}
+
+/**
+ * StatusThemeSwitcher — agnostic light/dark/system switcher.
+ *
+ * Pure presentation: caller owns the value and onValueChange wiring (next-themes,
+ * form state, etc.). The block does no hydration handling — render a Skeleton
+ * yourself before the active theme is known.
+ */
+export function StatusThemeSwitcher({
+ value,
+ onValueChange,
+ className,
+ ...props
+}: Omit<
+ React.ComponentProps<typeof DropdownMenuTrigger>,
+ "value" | "onValueChange"
+> & {
+ value: ThemeValue;
+ onValueChange: (value: ThemeValue) => void;
+}) {
+ const labels = useStatusBlocksLabels();
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild className={className} {...props}>
+ <Button data-slot="status-theme-switcher" variant="ghost" size="icon">
+ <ThemeIcon value={value} />
+ <span className="sr-only">{labels.ariaToggleTheme}</span>
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" alignOffset={-4}>
+ {THEME_VALUES.map((v) => {
+ const isActive = v === value;
+ return (
+ <DropdownMenuItem
+ data-slot="status-theme-switcher-item"
+ key={v}
+ onClick={() => onValueChange(v)}
+ >
+ <span>{labels.themeNames[v]}</span>
+ <span className="ml-auto">
+ <ThemeIcon
+ value={v}
+ className={
+ isActive ? "text-foreground" : "text-muted-foreground"
+ }
+ />
+ </span>
+ </DropdownMenuItem>
+ );
+ })}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+}
+
+/**
+ * StatusThemeSwitcherSkeleton — same footprint as the trigger button.
+ * Render while the active theme isn't known yet (e.g. before next-themes
+ * hydrates) so the surrounding layout doesn't shift.
+ */
+export function StatusThemeSwitcherSkeleton({
+ className,
+ ...props
+}: React.ComponentProps<typeof Skeleton>) {
+ return (
+ <Skeleton
+ data-slot="status-theme-switcher-skeleton"
+ className={cn("size-9", className)}
+ {...props}
+ />
+ );
+}
diff --git a/packages/ui/src/components/blocks/status-updates.tsx b/packages/ui/src/components/blocks/status-updates.tsx
new file mode 100644
index 000000000..65ebe1e8f
--- /dev/null
+++ b/packages/ui/src/components/blocks/status-updates.tsx
@@ -0,0 +1,188 @@
+"use client";
+
+import { useStatusBlocksLabels } from "@openstatus/ui/components/blocks/status-i18n";
+import { Button } from "@openstatus/ui/components/ui/button";
+import { Input } from "@openstatus/ui/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@openstatus/ui/components/ui/popover";
+import { Separator } from "@openstatus/ui/components/ui/separator";
+import { useCopyToClipboard } from "@openstatus/ui/hooks/use-copy-to-clipboard";
+import { cn } from "@openstatus/ui/lib/utils";
+import { Check, Copy } from "lucide-react";
+
+/**
+ * StatusUpdates — popover root for "Get updates" controls.
+ *
+ * Flat exports. Compose `StatusUpdatesTrigger` + `StatusUpdatesContent` and
+ * pick whichever channel children apply (`StatusUpdatesRss`,
+ * `StatusUpdatesJson`, `StatusUpdatesSlack`, `StatusUpdatesSsh`, or your own
+ * email form). The block does not enforce a tab structure — callers wrap
+ * children with `Tabs` themselves if needed.
+ */
+export function StatusUpdates({
+ children,
+ ...props
+}: React.ComponentProps<typeof Popover>) {
+ return <Popover {...props}>{children}</Popover>;
+}
+
+export function StatusUpdatesTrigger({
+ children,
+ className,
+ ...props
+}: React.ComponentProps<typeof Button>) {
+ const labels = useStatusBlocksLabels();
+ return (
+ <PopoverTrigger asChild>
+ <Button
+ data-slot="status-updates-trigger"
+ size="sm"
+ variant="outline"
+ className={cn(className)}
+ {...props}
+ >
+ {children ?? labels.subscribe}
+ </Button>
+ </PopoverTrigger>
+ );
+}
+
+export function StatusUpdatesContent({
+ className,
+ ...props
+}: React.ComponentProps<typeof PopoverContent>) {
+ return (
+ <PopoverContent
+ data-slot="status-updates-content"
+ align="end"
+ className={cn("w-80 overflow-hidden p-0", className)}
+ {...props}
+ />
+ );
+}
+
+/**
+ * StatusUpdatesSection — single channel description + content slot.
+ * Use to compose custom channels; the built-in `StatusUpdatesRss`/`Json`/
+ * `Slack`/`Ssh` children render this internally.
+ */
+export function StatusUpdatesSection({
+ description,
+ children,
+ className,
+ ...props
+}: React.ComponentProps<"div"> & {
+ description?: React.ReactNode;
+}) {
+ return (
+ <div
+ data-slot="status-updates-section"
+ className={cn("flex flex-col gap-2 px-2 py-2", className)}
+ {...props}
+ >
+ {description ? <div className="text-sm">{description}</div> : null}
+ {children}
+ </div>
+ );
+}
+
+export function StatusUpdatesCopyInput({
+ value,
+ className,
+ onClick,
+ ...props
+}: Omit<React.ComponentProps<typeof Input>, "value"> & { value: string }) {
+ const labels = useStatusBlocksLabels();
+ const { copy, isCopied } = useCopyToClipboard();
+ return (
+ <div
+ data-slot="status-updates-copy-input"
+ className={cn("relative w-full", className)}
+ >
+ <Input
+ data-slot="status-updates-copy-input-field"
+ value={value}
+ readOnly
+ onClick={(e) => {
+ copy(value, {
+ successMessage: labels.linkCopiedToClipboard,
+ withToast: true,
+ });
+ onClick?.(e);
+ }}
+ {...props}
+ />
+ <Button
+ data-slot="status-updates-copy-input-button"
+ type="button"
+ variant="outline"
+ size="icon"
+ onClick={() =>
+ copy(value, {
+ successMessage: labels.linkCopiedToClipboard,
+ withToast: true,
+ })
+ }
+ className="-translate-y-1/2 absolute top-1/2 right-2 size-6"
+ >
+ {isCopied ? <Check /> : <Copy />}
+ <span className="sr-only">{labels.ariaCopyLink}</span>
+ </Button>
+ </div>
+ );
+}
+
+export function StatusUpdatesRss({
+ rssUrl,
+ atomUrl,
+}: {
+ rssUrl: string;
+ atomUrl?: string;
+}) {
+ const labels = useStatusBlocksLabels();
+ return (
+ <>
+ <StatusUpdatesSection description={labels.subscribeRssDescription}>
+ <StatusUpdatesCopyInput value={rssUrl} />
+ </StatusUpdatesSection>
+ {atomUrl ? (
+ <>
+ <Separator />
+ <StatusUpdatesSection description={labels.subscribeAtomDescription}>
+ <StatusUpdatesCopyInput value={atomUrl} />
+ </StatusUpdatesSection>
+ </>
+ ) : null}
+ </>
+ );
+}
+
+export function StatusUpdatesJson({ url }: { url: string }) {
+ const labels = useStatusBlocksLabels();
+ return (
+ <StatusUpdatesSection description={labels.subscribeJsonDescription}>
+ <StatusUpdatesCopyInput value={url} />
+ </StatusUpdatesSection>
+ );
+}
+
+export function StatusUpdatesSlack({ rssUrl }: { rssUrl: string }) {
+ const labels = useStatusBlocksLabels();
+ return (
+ <StatusUpdatesSection description={labels.subscribeSlackDescription}>
+ <StatusUpdatesCopyInput value={`/feed subscribe ${rssUrl}`} />
+ </StatusUpdatesSection>
+ );
+}
+
+export function StatusUpdatesSsh({ command }: { command: string }) {
+ const labels = useStatusBlocksLabels();
+ return (
+ <StatusUpdatesSection description={labels.subscribeSshDescription}>
+ <StatusUpdatesCopyInput value={command} />
+ </StatusUpdatesSection>
+ );
+}
diff --git a/packages/ui/src/components/blocks/status.types.ts b/packages/ui/src/components/blocks/status.types.ts
index f4c247a4c..54a11d8c5 100644
--- a/packages/ui/src/components/blocks/status.types.ts
+++ b/packages/ui/src/components/blocks/status.types.ts
@@ -2,6 +2,9 @@ export type StatusType = "success" | "degraded" | "error" | "info" | "empty";
export type StatusEventType = "incident" | "report" | "maintenance";
export type StatusReportUpdateType = "investigating" | "identified" | "monitoring" | "resolved"
+export const THEME_VALUES = ["light", "dark", "system"] as const;
+export type ThemeValue = (typeof THEME_VALUES)[number];
+
export interface StatusReportUpdate {
date: Date;
message: string;
@@ -46,5 +49,6 @@ export type StatusBarData = {
type: StatusEventType;
from: Date | null;
to: Date | null;
+ isAggregated?: boolean;
}[];
}
\ No newline at end of file
diff --git a/packages/ui/src/components/blocks/status.utils.ts b/packages/ui/src/components/blocks/status.utils.ts
index ddee1ac7b..e08a76519 100644
--- a/packages/ui/src/components/blocks/status.utils.ts
+++ b/packages/ui/src/components/blocks/status.utils.ts
@@ -1,4 +1,5 @@
import { endOfDay, isSameDay, startOfDay } from "date-fns";
+import type { StatusBlocksLabels } from "@openstatus/ui/components/blocks/status-i18n";
/**
* Formats a date range in a human-readable format.
@@ -74,6 +75,21 @@ export function formatDate(
});
}
+/**
+ * Formats a date with abbreviated month (e.g. "Jan 15, 2024").
+ *
+ * @param date - The date to format
+ * @param locale - Locale string for formatting (default: "en-US")
+ * @returns A formatted date string with abbreviated month
+ */
+export function formatDateShort(date: Date, locale = "en-US") {
+ return date.toLocaleDateString(locale, {
+ year: "numeric",
+ month: "short",
+ day: "numeric",
+ });
+}
+
/**
* Formats a date with time, with locale support.
*
@@ -212,3 +228,69 @@ export const statusColors: Record<StatusType, string> = {
* @deprecated Use statusColors instead
*/
export const colors = statusColors;
+
+/**
+ * Default labels consumed by blocks when no StatusBlocksI18nProvider is mounted.
+ * Registry/web preview render with this set; the status-page app overrides via the provider.
+ */
+export const defaultStatusBlocksLabels = {
+ systemStatus: systemStatusLabels,
+ incidentStatus: incidentStatusLabels,
+ requestStatus: requestStatusLabels,
+
+ today: "Today",
+ ongoing: "Ongoing",
+ reportResolved: "Report resolved",
+ noRecentNotifications: "No recent notifications",
+ noRecentNotificationsDescription:
+ "There have been no reports within the last 7 days.",
+ noReports: "No reports",
+ noReportsDescription: "There are no reports to display.",
+ noPublicMonitors: "No public monitors",
+ noPublicMonitorsDescription: "There are no public monitors to display.",
+
+ themeNames: {
+ light: "Light",
+ dark: "Dark",
+ system: "System",
+ },
+ ariaToggleTheme: "Toggle theme",
+
+ subscribe: "Get updates",
+ subscribeRssDescription: "Get the RSS feed",
+ subscribeAtomDescription: "Get the Atom feed",
+ subscribeJsonDescription: "Get the JSON updates",
+ subscribeSlackDescription:
+ "For status updates in Slack, paste the text below into any channel.",
+ subscribeSshDescription: "Get status via SSH",
+ linkCopiedToClipboard: "Link copied to clipboard",
+ ariaCopyLink: "Copy Link",
+
+ poweredBy: "powered by",
+ getInTouch: "Get in touch",
+
+ ariaStatusTracker: "Status tracker",
+ ariaDayStatus: (n: number) => `Day ${n} status`,
+ clickAgainToUnpin: "Click again to unpin",
+
+ durationIn: (s: string) => `(in ${s})`,
+ durationEarlier: (s: string) => `(${s} earlier)`,
+ durationFor: (s: string) => `(for ${s})`,
+ durationAcross: (s: string) => `across ${s}`,
+
+ formatDate: (d: Date) => formatDate(d),
+ formatDateShort: (d: Date) => formatDateShort(d),
+ formatDateTime: (d: Date) => formatDateTime(d),
+ formatDateRange: (from?: Date, to?: Date) => formatDateRange(from, to),
+ formatDateRangeParts: (from: Date, to: Date) => {
+ if (isSameDay(from, to)) {
+ return { from: formatDateTime(from), to: formatTime(to) };
+ }
+ const isFromStartDay = startOfDay(from).getTime() === from.getTime();
+ const isToEndDay = endOfDay(to).getTime() === to.getTime();
+ if (isFromStartDay && isToEndDay) {
+ return { from: formatDate(from), to: formatDate(to) };
+ }
+ return { from: formatDateTime(from), to: formatDateTime(to) };
+ },
+} as const satisfies StatusBlocksLabels;