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.

Add warning

Tim Wilsonc14e58dfde38
diff --git a/apps/web/ui/modals/link-builder/ab-testing-modal.tsx b/apps/web/ui/modals/link-builder/ab-testing-modal.tsx
index c4b486e3ae..53b09030a5 100644
--- a/apps/web/ui/modals/link-builder/ab-testing-modal.tsx
+++ b/apps/web/ui/modals/link-builder/ab-testing-modal.tsx
@@ -12,6 +12,7 @@ import {
Modal,
SimpleTooltipContent,
Tooltip,
+ TriangleWarning,
} from "@dub/ui";
import {
cn,
@@ -199,7 +200,7 @@ function ABTestingModal({
handleSubmit((data) => {
const currentTests = data.tests;
- if (!currentTests?.length) {
+ if (!currentTests || currentTests.length <= 1) {
setValueParent("tests", null, { shouldDirty: true });
setValueParent("testsCompleteAt", null, {
shouldDirty: true,
@@ -424,7 +425,17 @@ function ABTestingModal({
</div>
</div>
- <div className="mt-6 flex items-center justify-between">
+ {testsParent && (
+ <div className="mt-6 flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 p-4">
+ <TriangleWarning className="mt-0.5 size-4 shrink-0 text-amber-500" />
+ <p className="text-sm font-medium text-amber-900">
+ Changing the original A/B test settings will impact your future
+ analytics and event tracking.
+ </p>
+ </div>
+ )}
+
+ <div className="mt-4 flex items-center justify-between">
<div></div>
<div className="flex items-center gap-2">
<Button
@@ -441,7 +452,7 @@ function ABTestingModal({
type="submit"
variant="primary"
text={
- Array.isArray(testsParent) && testsParent.length > 0
+ Array.isArray(testsParent) && testsParent.length > 1
? "Save changes"
: "Start testing"
}
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index c3dea29b4a..12b7bb3d6d 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -172,6 +172,7 @@ export * from "./tag";
export * from "./tags";
export * from "./toggle2-fill";
export * from "./trash";
+export * from "./triangle-warning";
export * from "./tv";
export * from "./ui-card";
export * from "./user";
diff --git a/packages/ui/src/icons/nucleo/triangle-warning.tsx b/packages/ui/src/icons/nucleo/triangle-warning.tsx
new file mode 100644
index 0000000000..89c31846c2
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/triangle-warning.tsx
@@ -0,0 +1,40 @@
+import { SVGProps } from "react";
+
+export function TriangleWarning(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="M7.638,3.495L2.213,12.891c-.605,1.048,.151,2.359,1.362,2.359H14.425c1.211,0,1.967-1.31,1.362-2.359L10.362,3.495c-.605-1.048-2.119-1.048-2.724,0Z"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <path
+ d="M9,13.569c-.552,0-1-.449-1-1s.448-1,1-1,1,.449,1,1-.448,1-1,1Z"
+ fill="currentColor"
+ stroke="none"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="9"
+ x2="9"
+ y1="6.5"
+ y2="10"
+ />
+ </g>
+ </svg>
+ );
+}