Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

`@dub/ui` updates

Tim Wilson3f55f714e5f5
diff --git a/packages/ui/src/dub-status-badge.tsx b/packages/ui/src/dub-status-badge.tsx
new file mode 100644
index 0000000000..8967ed0259
--- /dev/null
+++ b/packages/ui/src/dub-status-badge.tsx
@@ -0,0 +1,68 @@
+import { cn } from "@dub/utils";
+
+import { fetcher } from "@dub/utils";
+import Link from "next/link";
+import { useEffect, useState } from "react";
+import useSWR from "swr";
+
+export function DubStatusBadge({ className }: { className?: string }) {
+ const { data } = useSWR<{
+ ongoing_incidents: {
+ name: string;
+ current_worst_impact:
+ | "degraded_performance"
+ | "partial_outage"
+ | "full_outage";
+ }[];
+ }>("https://status.dub.co/api/v1/summary", fetcher);
+
+ const [color, setColor] = useState("bg-neutral-200");
+ const [status, setStatus] = useState("Loading status...");
+
+ useEffect(() => {
+ if (!data) return;
+ const { ongoing_incidents } = data;
+ if (ongoing_incidents.length > 0) {
+ const { current_worst_impact, name } = ongoing_incidents[0];
+ const color =
+ current_worst_impact === "degraded_performance"
+ ? "bg-yellow-500"
+ : "bg-red-500";
+ setStatus(name);
+ setColor(color);
+ } else {
+ setStatus("All systems operational");
+ setColor("bg-green-500");
+ }
+ }, [data]);
+
+ return (
+ <Link
+ href="https://status.dub.co"
+ target="_blank"
+ className={cn(
+ "group flex max-w-fit items-center gap-2 rounded-lg border border-neutral-200 bg-white py-2 pl-2 pr-2.5 transition-colors hover:bg-neutral-50 active:bg-neutral-100",
+ className,
+ )}
+ >
+ <div className="relative size-2">
+ <div
+ className={cn(
+ "absolute inset-0 m-auto size-2 animate-ping items-center justify-center rounded-full group-hover:animate-none",
+ color,
+ status === "Loading status..." && "animate-none",
+ )}
+ />
+ <div
+ className={cn(
+ "absolute inset-0 z-10 m-auto size-2 rounded-full",
+ color,
+ )}
+ />
+ </div>
+ <p className="text-xs font-medium leading-none text-neutral-600">
+ {status}
+ </p>
+ </Link>
+ );
+}
diff --git a/packages/ui/src/footer.tsx b/packages/ui/src/footer.tsx
index fe6bfb6360..888644b192 100644
--- a/packages/ui/src/footer.tsx
+++ b/packages/ui/src/footer.tsx
@@ -1,12 +1,11 @@
"use client";
-import { ALL_TOOLS, cn, createHref, fetcher } from "@dub/utils";
+import { ALL_TOOLS, cn, createHref } from "@dub/utils";
import Image from "next/image";
import Link from "next/link";
import { useParams } from "next/navigation";
-import { useEffect, useState } from "react";
-import useSWR from "swr";
import { COMPARE_PAGES, FEATURES_LIST, LEGAL_PAGES } from "./content";
+import { DubStatusBadge } from "./dub-status-badge";
import { Github, LinkedIn, ReferredVia, Twitter, YouTube } from "./icons";
import { MaxWidthWrapper } from "./max-width-wrapper";
import { NavWordmark } from "./nav-wordmark";
@@ -277,7 +276,7 @@ export function Footer({
{/* Bottom row (status, SOC2, copyright) */}
<div className="mt-12 grid grid-cols-1 items-center gap-8 sm:grid-cols-3">
- <StatusBadge />
+ <DubStatusBadge />
<Link
href={createHref("/blog/soc2", domain, {
utm_source: "Custom Domain",
@@ -303,62 +302,3 @@ export function Footer({
</MaxWidthWrapper>
);
}
-
-function StatusBadge() {
- const { data } = useSWR<{
- ongoing_incidents: {
- name: string;
- current_worst_impact:
- | "degraded_performance"
- | "partial_outage"
- | "full_outage";
- }[];
- }>("https://status.dub.co/api/v1/summary", fetcher);
-
- const [color, setColor] = useState("bg-neutral-200");
- const [status, setStatus] = useState("Loading status...");
-
- useEffect(() => {
- if (!data) return;
- const { ongoing_incidents } = data;
- if (ongoing_incidents.length > 0) {
- const { current_worst_impact, name } = ongoing_incidents[0];
- const color =
- current_worst_impact === "degraded_performance"
- ? "bg-yellow-500"
- : "bg-red-500";
- setStatus(name);
- setColor(color);
- } else {
- setStatus("All systems operational");
- setColor("bg-green-500");
- }
- }, [data]);
-
- return (
- <Link
- href="https://status.dub.co"
- target="_blank"
- className="group flex max-w-fit items-center gap-2 rounded-lg border border-neutral-200 bg-white py-2 pl-2 pr-2.5 transition-colors hover:bg-neutral-50 active:bg-neutral-100"
- >
- <div className="relative size-2">
- <div
- className={cn(
- "absolute inset-0 m-auto size-2 animate-ping items-center justify-center rounded-full group-hover:animate-none",
- color,
- status === "Loading status..." && "animate-none",
- )}
- />
- <div
- className={cn(
- "absolute inset-0 z-10 m-auto size-2 rounded-full",
- color,
- )}
- />
- </div>
- <p className="text-xs font-medium leading-none text-neutral-600">
- {status}
- </p>
- </Link>
- );
-}
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index 93ee87d798..a574ad8571 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -142,6 +142,7 @@ export * from "./mobile-phone";
export * from "./money-bill";
export * from "./money-bill2";
export * from "./money-bills2";
+export * from "./msgs";
export * from "./note";
export * from "./office-building";
export * from "./page2";
@@ -168,6 +169,7 @@ export * from "./shield-alert";
export * from "./shield-check";
export * from "./shield-keyhole";
export * from "./shield-slash";
+export * from "./shield-user";
export * from "./shuffle";
export * from "./sliders";
export * from "./sparkle3";
diff --git a/packages/ui/src/icons/nucleo/msgs.tsx b/packages/ui/src/icons/nucleo/msgs.tsx
new file mode 100644
index 0000000000..6a1e1e9277
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/msgs.tsx
@@ -0,0 +1,32 @@
+import { SVGProps } from "react";
+
+export function Msgs(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <path
+ d="M12.337,4.767c-1.095-1.806-3.074-3.017-5.34-3.017C3.547,1.75,.75,4.547,.75,7.998c0,1.136,.308,2.199,.839,3.117,.37,.695-.045,2.337-.839,3.13,1.077,.058,2.497-.428,3.13-.839,.421,.243,1.09,.566,1.964,.731,.112,.021,.232,.017,.346,.032"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <path
+ d="M12.75,7.246c2.485,0,4.5,2.015,4.5,4.5,0,.819-.222,1.584-.604,2.246-.267,.5,.033,1.683,.604,2.255-.776,.042-1.798-.309-2.255-.604-.303,.175-.785,.407-1.415,.527-.269,.051-.547,.078-.831,.078-2.486,0-4.5-2.015-4.5-4.5,0-2.486,2.015-4.5,4.5-4.5Z"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/icons/nucleo/shield-user.tsx b/packages/ui/src/icons/nucleo/shield-user.tsx
new file mode 100644
index 0000000000..9b753a8ea2
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/shield-user.tsx
@@ -0,0 +1,42 @@
+import { SVGProps } from "react";
+
+export function ShieldUser(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <circle
+ cx="9"
+ cy="7.25"
+ fill="none"
+ r="2"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <path
+ d="M5.192,14.522c.518-1.608,2.027-2.772,3.808-2.772s3.289,1.163,3.808,2.772"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <path
+ d="M9.305,1.845l5.25,1.68c.414,.133,.695,.518,.695,.952v6.52c0,3.03-4.684,4.748-5.942,5.155-.203,.066-.413,.066-.616,0-1.258-.407-5.942-2.125-5.942-5.155V4.478c0-.435,.281-.82,.695-.952l5.25-1.68c.198-.063,.411-.063,.61,0Z"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ </g>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsx
index 9e61a28e15..03fc87282e 100644
--- a/packages/ui/src/index.tsx
+++ b/packages/ui/src/index.tsx
@@ -12,6 +12,7 @@ export * from "./carousel";
export * from "./checkbox";
export * from "./combobox";
export * from "./date-picker";
+export * from "./dub-status-badge";
export * from "./empty-state";
export * from "./file-upload";
export * from "./filter";