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.

Update toggle.tsx

Steven Tey1d6de482d1ff
diff --git a/components/stats/toggle.tsx b/components/stats/toggle.tsx
index 9c13e6daf2..4cf75c6bc1 100644
--- a/components/stats/toggle.tsx
+++ b/components/stats/toggle.tsx
@@ -22,7 +22,8 @@ export default function Toggle({ atModalTop }: { atModalTop?: boolean }) {
const { slug: projectSlug } = router.query as { slug?: string };
const { basePath, domain, interval, key } = useContext(StatsContext);
- const { setShowAddProjectModal } = useContext(ModalContext);
+ const { setShowAddProjectModal, setShowUpgradePlanModal } =
+ useContext(ModalContext);
const atTop = useScroll(80) || atModalTop;
const [openDatePopover, setOpenDatePopover] = useState(false);
@@ -71,14 +72,14 @@ export default function Toggle({ atModalTop }: { atModalTop?: boolean }) {
cta={
projectSlug ? "Upgrade to Pro" : "Create Project"
}
- {...(projectSlug
- ? { href: `/${projectSlug}/settings/billing` }
- : {
- onClick: () => {
- setShowAddProjectModal(true);
- setOpenDatePopover(false);
- },
- })}
+ onClick={() => {
+ setOpenDatePopover(false);
+ if (projectSlug) {
+ setShowUpgradePlanModal(true);
+ } else {
+ setShowAddProjectModal(true);
+ }
+ }}
/>
}
>