Remove the donation popup and the Support broke links
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5ef800e618
commit
0d399b77c3
3 files changed
+1
-62
No files matched your search
@@ -1,12 +1,11 @@
|
|||||||
import { ChevronRight, Sparkles } from "lucide-react";
|
import { ChevronRight, Sparkles } from "lucide-react";
|
||||||
import { DonateLink } from "@/components/Donate";
|
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
const PAGES = [
|
const PAGES = [
|
||||||
{ href: "/debt", label: "Debt", what: "What you owe, what you're paying and what it costs." },
|
{ href: "/debt", label: "Debt", what: "What you owe, what you're paying and what it costs." },
|
||||||
];
|
];
|
||||||
|
|
||||||
// What isn't in the main menu: Debt, connecting your AI and supporting broke.
|
// What isn't in the main menu: Debt and connecting your AI.
|
||||||
export default function More() {
|
export default function More() {
|
||||||
return (
|
return (
|
||||||
<div className="max-w-2xl space-y-4">
|
<div className="max-w-2xl space-y-4">
|
||||||
@@ -23,8 +22,6 @@ export default function More() {
|
|||||||
<span className="flex-1 font-medium">Connect your AI</span>
|
<span className="flex-1 font-medium">Connect your AI</span>
|
||||||
<ChevronRight size={18} className="text-muted shrink-0" />
|
<ChevronRight size={18} className="text-muted shrink-0" />
|
||||||
</Link>
|
</Link>
|
||||||
{/* The sidebar has this link too; on a phone, More is the only place. */}
|
|
||||||
<DonateLink className="card-link flex items-center gap-3 px-6 py-4 font-medium [&_svg]:text-muted" />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { Heart } from "lucide-react";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import { Modal } from "@/components/Modal";
|
|
||||||
|
|
||||||
export const DONATE_URL = "https://buy.stripe.com/5kQ6oHgXWc1T33CbNt5Vu05";
|
|
||||||
const USED = "broke.minutesUsed", ASKED = "broke.donateAsked";
|
|
||||||
const ASK_AFTER = 120; // minutes with broke open and on screen
|
|
||||||
|
|
||||||
const read = (k: string) => { try { return localStorage.getItem(k); } catch { return null; } };
|
|
||||||
const write = (k: string, v: string) => { try { localStorage.setItem(k, v); } catch { /* private window: just don't count */ } };
|
|
||||||
|
|
||||||
export function DonateLink({ className = "" }: { className?: string }) {
|
|
||||||
return (
|
|
||||||
<a href={DONATE_URL} target="_blank" rel="noopener noreferrer" className={className}>
|
|
||||||
<Heart size={18} strokeWidth={1.6} className="shrink-0" />
|
|
||||||
<span className="flex-1 text-left">Support broke</span>
|
|
||||||
</a>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Asks once, after about two hours of use: minutes count only while a broke tab is open and visible, in this browser.
|
|
||||||
export function DonatePrompt() {
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
useEffect(() => {
|
|
||||||
if (read(ASKED)) return;
|
|
||||||
const tick = setInterval(() => {
|
|
||||||
if (document.visibilityState !== "visible") return;
|
|
||||||
const used = Number(read(USED) ?? 0) + 1;
|
|
||||||
write(USED, String(used));
|
|
||||||
if (used < ASK_AFTER || read(ASKED)) return;
|
|
||||||
write(ASKED, new Date().toISOString());
|
|
||||||
setOpen(true);
|
|
||||||
clearInterval(tick);
|
|
||||||
}, 60_000);
|
|
||||||
return () => clearInterval(tick);
|
|
||||||
}, []);
|
|
||||||
if (!open) return null;
|
|
||||||
return (
|
|
||||||
<Modal label="Support broke" onClose={() => setOpen(false)}>
|
|
||||||
<div className="space-y-4">
|
|
||||||
<Heart size={22} strokeWidth={1.6} className="text-muted" />
|
|
||||||
<div className="space-y-1.5">
|
|
||||||
<h2 className="text-lg font-semibold">Finding broke useful?</h2>
|
|
||||||
<p className="text-sm text-muted">broke is free and open source. If it's saved you money, you can chip in to keep it going. This is the only time it asks.</p>
|
|
||||||
</div>
|
|
||||||
<div className="flex gap-3">
|
|
||||||
<a href={DONATE_URL} target="_blank" rel="noopener noreferrer" onClick={() => setOpen(false)} className="btn-primary" data-autofocus>Donate</a>
|
|
||||||
<button className="btn" onClick={() => setOpen(false)}>Not now</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,6 @@ import { usePathname, useRouter } from "next/navigation";
|
|||||||
import { Suspense, useEffect, useState } from "react";
|
import { Suspense, useEffect, useState } from "react";
|
||||||
import { useAssistant } from "@/components/Assistant";
|
import { useAssistant } from "@/components/Assistant";
|
||||||
import { BookmarkButton, SavedList } from "@/components/Bookmarks";
|
import { BookmarkButton, SavedList } from "@/components/Bookmarks";
|
||||||
import { DonateLink, DonatePrompt } from "@/components/Donate";
|
|
||||||
|
|
||||||
// Spending holds Budgets and Recurring as tabs, Plan holds Optimize, Bonuses and Cards, More holds the rest. Every page keeps its own URL.
|
// Spending holds Budgets and Recurring as tabs, Plan holds Optimize, Bonuses and Cards, More holds the rest. Every page keeps its own URL.
|
||||||
type Icon = ComponentType<{ size?: number; strokeWidth?: number }>;
|
type Icon = ComponentType<{ size?: number; strokeWidth?: number }>;
|
||||||
@@ -61,10 +60,8 @@ export function Nav() {
|
|||||||
<MessageCircle size={18} strokeWidth={1.6} />
|
<MessageCircle size={18} strokeWidth={1.6} />
|
||||||
<span className="flex-1 text-left">Ask broke ai</span>
|
<span className="flex-1 text-left">Ask broke ai</span>
|
||||||
</button>
|
</button>
|
||||||
<DonateLink className="flex items-center gap-3 px-3 py-2 rounded-xl text-[14px] whitespace-nowrap text-ink/70 hover:text-ink hover:bg-canvas/60" />
|
|
||||||
<Suspense><SavedList /></Suspense>
|
<Suspense><SavedList /></Suspense>
|
||||||
</nav>
|
</nav>
|
||||||
<DonatePrompt />
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user