From 4ea506531a75b7316d850ce3df2c6fd0c6e64c02 Mon Sep 17 00:00:00 2001
From: Washington Pires <22279738+washingtonserip@users.noreply.github.com>
Date: Sat, 4 Jan 2025 12:34:02 -0300
Subject: [PATCH] feat: the new subscribe button (#1151)
* feat: create modal to email subscribe
* feat: include feed links in the subscribe button
* fix: closes modal on submition error
* fix: set status page url as feed home
* fix: fix links to feed items
* fix: fix lint issue on the subscribe button
* chore: apply format updates
* fix: apply more lint suggestions
* feat: RSS/Atom links available to everyone
* chore: open rss/atom links in a new tab
* ci: apply automated fixes
* refactor: replace popover components with dropdown menu
* fix: add missing props on the features page
---------
Co-authored-by: Washington <22279738+washingtonbr@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
---
.../(content)/features/status-page/page.tsx | 2 +-
.../[domain]/_components/header.tsx | 10 +-
.../[domain]/_components/subscribe-button.tsx | 145 +++++++++---------
.../[domain]/_components/subscribe-modal.tsx | 97 ++++++++++++
.../status-page/[domain]/feed/[type]/route.ts | 6 +-
5 files changed, 179 insertions(+), 81 deletions(-)
create mode 100644 apps/web/src/app/status-page/[domain]/_components/subscribe-modal.tsx
diff --git a/apps/web/src/app/(content)/features/status-page/page.tsx b/apps/web/src/app/(content)/features/status-page/page.tsx
index 3af7a105..3045b5e2 100644
--- a/apps/web/src/app/(content)/features/status-page/page.tsx
+++ b/apps/web/src/app/(content)/features/status-page/page.tsx
@@ -72,7 +72,7 @@ export default function FeaturePage() {
subTitle="Let your users subscribe to your status page, to automatically receive updates about the status of your services."
component={
-
+
}
col={1}
diff --git a/apps/web/src/app/status-page/[domain]/_components/header.tsx b/apps/web/src/app/status-page/[domain]/_components/header.tsx
index 1d5f79d2..0114503c 100644
--- a/apps/web/src/app/status-page/[domain]/_components/header.tsx
+++ b/apps/web/src/app/status-page/[domain]/_components/header.tsx
@@ -4,7 +4,6 @@ import Image from "next/image";
import { useSelectedLayoutSegment } from "next/navigation";
import type { PublicPage } from "@openstatus/db/src/schema";
-import { allPlans } from "@openstatus/db/src/schema/plan/config";
import type { WorkspacePlan } from "@openstatus/db/src/schema/workspaces/validation";
import { cn } from "@/lib/utils";
@@ -25,7 +24,6 @@ type Props = {
export function Header({ navigation, plan, page }: Props) {
const selectedSegment = useSelectedLayoutSegment();
- const isSubscribers = allPlans[plan].limits["status-subscribers"]; // FIXME: use the workspace.limits
return (
@@ -65,8 +63,12 @@ export function Header({ navigation, plan, page }: Props) {
-
- {isSubscribers ? : null}
+
+
diff --git a/apps/web/src/app/status-page/[domain]/_components/subscribe-button.tsx b/apps/web/src/app/status-page/[domain]/_components/subscribe-button.tsx
index 68cddd7b..395e1178 100644
--- a/apps/web/src/app/status-page/[domain]/_components/subscribe-button.tsx
+++ b/apps/web/src/app/status-page/[domain]/_components/subscribe-button.tsx
@@ -1,89 +1,88 @@
"use client";
-import { Mail } from "lucide-react";
-import { useFormStatus } from "react-dom";
+import { Bell, Mail, Rss } from "lucide-react";
+import { useState } from "react";
+import { allPlans } from "@openstatus/db/src/schema/plan/config";
+import type { WorkspacePlan } from "@openstatus/db/src/schema/workspaces/validation";
import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@openstatus/ui/src/components/popover";
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@openstatus/ui/src/components/dropdown-menu";
-import { LoadingAnimation } from "@/components/loading-animation";
-import { toast } from "@/lib/toast";
-import { wait } from "@/lib/utils";
import { Button } from "@openstatus/ui/src/components/button";
-import { Input } from "@openstatus/ui/src/components/input";
-import { Label } from "@openstatus/ui/src/components/label";
-import { handleSubscribe } from "./actions";
+import { getBaseUrl } from "../utils";
+import { SubscribeModal } from "./subscribe-modal";
interface Props {
+ plan: WorkspacePlan;
slug: string;
+ customDomain?: string;
isDemo?: boolean;
}
-export function SubscribeButton({ slug, isDemo = false }: Props) {
- return (
-
-
-
-
-
-
-
-
- Subscribe to updates
-
-
- Get email notifications whenever a report has been created or
- resolved.
-