diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx
index 2738dd9..94432a8 100644
--- a/apps/web/src/App.tsx
+++ b/apps/web/src/App.tsx
@@ -1,4 +1,4 @@
-import { Navigate, Outlet, Route, Routes, useSearchParams } from 'react-router';
+import { Navigate, Outlet, Route, Routes, useLocation, useSearchParams } from 'react-router';
import Layout from './Layout';
import ProtectedRoute from './components/ProtectedRoute';
@@ -7,11 +7,11 @@ import { useAuth } from './contexts/AuthContext';
import { AuthProvider } from './contexts/AuthProvider';
import { KeysProvider } from './contexts/KeysContext';
import { ThemeProvider } from './contexts/ThemeContext';
+import { Account } from './pages/Account';
import { IndexPage } from './pages/Index';
import Links from './pages/Links';
import Login from './pages/Login';
import NotFound from './pages/NotFound';
-import Plan from './pages/Plan';
import Push from './pages/Push';
import { ResetPassword } from './pages/ResetPassword';
import { ViewPush } from './pages/ViewPush';
@@ -50,6 +50,18 @@ function ImagePageOrHome() {
);
}
+/**
+ * `/plan`, the Plan page's address before it became the first section of Account. Stripe's
+ * checkout returns here with `?checkout=complete` and its portal returns here
+ * (functions/src/stripe-functions.ts, `planPageUrl`, and the portal's configuration), so the
+ * query goes along: the plan section reads it to confirm a subscription on arrival. Kept
+ * for old bookmarks once those point at `/account` too.
+ */
+function PlanRedirect() {
+ const { search } = useLocation();
+ return ;
+}
+
function App() {
return (
@@ -75,7 +87,8 @@ function App() {
}>
} />
} />
- } />
+ } />
+ } />
} />
diff --git a/apps/web/src/Layout.tsx b/apps/web/src/Layout.tsx
index 2e88360..bf5efe9 100644
--- a/apps/web/src/Layout.tsx
+++ b/apps/web/src/Layout.tsx
@@ -56,9 +56,10 @@ export default function Layout({ children }: LayoutProps) {
{isMenuOpen && (
- {/* Above Logout, where the Android, iOS and macOS menus have it. It leads to the
- public page, which asks for the password before anything goes. */}
-
+ {/* The plan, the device id and deleting the account are all on the Account page,
+ so the menu has one way in rather than an item for each. Deleting is a link
+ from there to the public page, which asks for the password before anything goes. */}
+
)}
diff --git a/apps/web/src/components/Nav.tsx b/apps/web/src/components/Nav.tsx
index c14e0e9..5370f9b 100644
--- a/apps/web/src/components/Nav.tsx
+++ b/apps/web/src/components/Nav.tsx
@@ -1,8 +1,6 @@
import { useEffect, useRef, useState } from 'react';
import { Link, useLocation } from 'react-router';
-import { PLAN_PAGE_LINKED } from '@/config/plan';
-
import styles from './Nav.module.css';
export default function Nav() {
@@ -19,6 +17,10 @@ export default function Nav() {
width: offsetWidth,
left: offsetLeft,
});
+ } else {
+ // A page with no item here (Account, the static pages while signed in): the
+ // slider shrinks away where it stood, rather than staying lit on the page left behind.
+ setSliderStyle((was) => ({ width: 0, left: was.left + was.width / 2 }));
}
}, [currentPath]);
@@ -37,11 +39,6 @@ export default function Nav() {
Links
- {PLAN_PAGE_LINKED && (
-
- Plan
-
- )}
);
}
diff --git a/apps/web/src/pages/Plan.module.css b/apps/web/src/components/PlanSection.module.css
similarity index 64%
rename from apps/web/src/pages/Plan.module.css
rename to apps/web/src/components/PlanSection.module.css
index ecbd029..9019790 100644
--- a/apps/web/src/pages/Plan.module.css
+++ b/apps/web/src/components/PlanSection.module.css
@@ -1,21 +1,11 @@
-.page {
- max-width: 560px;
-}
-
-.section {
- margin: 2rem 0;
- display: flex;
- flex-direction: column;
- gap: 0.75rem;
-}
+/* The section's own layout comes from the page, through `className`, so the plan is spaced
+ like the sections around it from one place. Only what is the plan's alone is here. */
-/* The gap spaces a section's contents; the global margins on p, h2 and ul would add to it */
-.section > * {
- margin: 0;
-}
-
-.section h2 {
- font-size: 1.25rem;
+/* This month and Pro are parts of the plan, under its heading, so they sit a step down and
+ a little apart from what comes before them rather than starting sections of their own. */
+.plan h3 {
+ font-size: 1rem;
+ margin-top: 0.75rem;
}
.row {
@@ -75,8 +65,3 @@
.meterFillFull {
background: var(--color-error);
}
-
-/* A device id is 22 characters with no spaces, which would otherwise push a narrow screen sideways */
-.deviceId {
- overflow-wrap: anywhere;
-}
diff --git a/apps/web/src/pages/Plan.tsx b/apps/web/src/components/PlanSection.tsx
similarity index 65%
rename from apps/web/src/pages/Plan.tsx
rename to apps/web/src/components/PlanSection.tsx
index 4a818d4..9d1aa88 100644
--- a/apps/web/src/pages/Plan.tsx
+++ b/apps/web/src/components/PlanSection.tsx
@@ -1,15 +1,14 @@
+import clsx from 'clsx';
import { useEffect, useRef, useState } from 'react';
-import { Helmet } from 'react-helmet';
import { Link, useNavigate, useSearchParams } from 'react-router';
import Button from '@/components/Button';
import { LIMITS, formatMb } from '@/config/plan';
import { usePlan } from '@/hooks/usePlan';
import { errorText } from '@/services/callable';
-import { deviceId } from '@/services/keyStore';
import { PlanReport, planApi } from '@/services/plan';
-import styles from './Plan.module.css';
+import styles from './PlanSection.module.css';
/** How often, and how many times, the plan is read back from Stripe after a checkout; see `settleCheckout`. */
const CHECKOUT_SETTLE_WAIT_MS = 1500;
@@ -62,17 +61,21 @@ export function describePlan(plan: PlanReport): { title: string; sentence: strin
}
/**
- * The account's plan: where it stands, this month's usage against its limits, and the
- * two things that change it: subscribing, and managing the subscription in Stripe's
- * portal. The checkout is Stripe's own page, reached by redirect from a session the
- * server made; Stripe sends the person back here with `?checkout=complete` once paid,
- * and the plan is then read back from Stripe at once rather than waiting on the
- * webhook, so the page says "Pro" on arrival.
+ * The account's plan, as the first section of the Account page: where it stands, this
+ * month's usage against its limits, and the two things that change it: subscribing, and
+ * managing the subscription in Stripe's portal. The checkout is Stripe's own page, reached
+ * by redirect from a session the server made; Stripe sends the person back with
+ * `?checkout=complete` once paid, and the plan is then read back from Stripe at once
+ * rather than waiting on the webhook, so the page says "Pro" on arrival.
*
- * Not linked from the navigation until launch (`PLAN_PAGE_LINKED`): production runs on
- * the Stripe sandbox's keys until then, and a test card here would give anyone Pro.
+ * Stripe still sends people back to `/plan`, which was this section's own page before it
+ * moved here; that address now redirects to `/account` with its query (App.tsx), so the
+ * checkout's return lands here either way.
+ *
+ * Shown only while `PLAN_SHOWN` is on: production ran on the Stripe sandbox's keys
+ * until launch, and a test card here would give anyone Pro.
*/
-export default function Plan() {
+export function PlanSection({ className }: { className?: string }) {
const { plan, error: readError, refresh, setPlan } = usePlan();
const [busy, setBusy] = useState<'checkout' | 'settling' | 'portal' | 'payment' | null>(null);
const [error, setError] = useState(null);
@@ -95,7 +98,7 @@ export default function Plan() {
useEffect(() => {
if (settled.current || params.get('checkout') !== 'complete') return;
settled.current = true;
- void navigate('/plan', { replace: true });
+ void navigate('/account', { replace: true });
setBusy('settling');
void settleCheckout()
.then((found) =>
@@ -179,11 +182,8 @@ export default function Plan() {
if (!plan) {
return (
-
)}
- {/* Nothing in it depends on the plan, so it shows while the plan is read or cannot be.
- Keyed, so that React keeps the one section when the plan arrives rather than
- mounting another, which would read the device id again and blink its line. */}
-
-
-
- Before tax, charged by Stripe. Cancel any time.
-
- )}
- {hasCustomer && (
-
-
+ )}
+ {error && (
+
+ {error}
-
+ )}
+ {notice && (
+
+ {notice}
+
+ )}
+
+
This month
+
+
+
+ Files up to {formatMb(limits.fileBytes)}, kept for {limits.keepDays} days from the moment they are pushed; a
+ file already pushed keeps the retention it was pushed with. The month starts on the day you{' '}
+ {plan.tier === 'pro' ? 'subscribed' : 'signed up'}.
+
{plan.tier === 'free' && (
-
-
Pro
+ <>
+
Pro
{LIMITS.pro.url.toLocaleString()} URL pushes a month, up from {LIMITS.free.url}
@@ -296,45 +284,7 @@ export default function Plan() {
${plan.priceUsd} a year. Refunds, cancelling and receipts are explained on the{' '}
support page.
-
- )}
-
-
-
- );
-}
-
-/**
- * The "Encrypted" line (docs/e2ee.md, Saying so): that the pushes are encrypted, this
- * device's id, and where to read what that means. On the Plan page because the web app has
- * no settings page and this is the page about the account. The id is what this install
- * puts on its pushes in place of the device's model name, so showing it lets someone see
- * all the server is told about the device. IndexedDB can refuse (a private window in
- * some browsers), and the line then goes without the id rather than not at all.
- */
-function Encrypted() {
- const [id, setId] = useState(null);
- useEffect(() => {
- let current = true;
- deviceId()
- .then((made) => current && setId(made))
- .catch((error) => console.error('Could not read the device id:', error));
- return () => {
- current = false;
- };
- }, []);
-
- return (
-
-
Encrypted
-
- Your pushes are encrypted on your devices with a key made from your password, and only they can read them.{' '}
- How it works.
-
- {id && (
-
- This device: {id}
-
+ >
)}
);
diff --git a/apps/web/src/config/plan.ts b/apps/web/src/config/plan.ts
index bac856a..c62c76b 100644
--- a/apps/web/src/config/plan.ts
+++ b/apps/web/src/config/plan.ts
@@ -2,7 +2,7 @@
* The plan, as the pages describe it (docs/billing.md at the repository root). The
* numbers the functions enforce and report are in `functions/src/plan.ts` and
* the rules carry them too; these are what the front page quotes before anyone has
- * signed in, and the Plan page reads its own from `getPlan`. The copies are changed
+ * signed in, and the Account page's plan reads its own from `getPlan`. The copies are changed
* together.
*/
@@ -24,12 +24,13 @@ export const LIMITS: Record<'free' | 'pro', TierLimits> = {
};
/**
- * Whether the Plan page is reachable from the navigation. On since launch (2026-10-25),
- * when production moved to the live Stripe account. Turn it off only together with a
- * move back to sandbox keys: on sandbox keys, anyone who reached the page could
- * subscribe with a test card and get Pro. The route exists either way.
+ * Whether the web app shows the plan: its section on the Account page, the Push page's link
+ * to it when a push is refused for the month's limit, and Support's link to it. On since
+ * launch (2026-10-25), when production moved to the live Stripe account. Turn it off only
+ * together with a move back to sandbox keys: on sandbox keys, anyone who saw the plan could
+ * subscribe with a test card and get Pro. The rest of the Account page shows either way.
*/
-export const PLAN_PAGE_LINKED = true;
+export const PLAN_SHOWN = true;
export const SUPPORT_EMAIL = 'hello@pushthat.link';
diff --git a/apps/web/src/pages/Account.module.css b/apps/web/src/pages/Account.module.css
new file mode 100644
index 0000000..34f5860
--- /dev/null
+++ b/apps/web/src/pages/Account.module.css
@@ -0,0 +1,35 @@
+.page {
+ max-width: 560px;
+}
+
+.section {
+ margin: 2rem 0;
+ display: flex;
+ flex-direction: column;
+ gap: 0.75rem;
+}
+
+/* The gap spaces a section's contents; the global margins on p, headings and lists would add to it */
+.section > * {
+ margin: 0;
+}
+
+.section h2 {
+ font-size: 1.25rem;
+}
+
+.muted {
+ opacity: 0.7;
+ font-size: 0.9rem;
+}
+
+.danger {
+ color: var(--color-error);
+}
+
+/* An email address, or a device id (22 characters), has no spaces to break at, and a long
+ one would push a narrow screen sideways */
+.email,
+.deviceId {
+ overflow-wrap: anywhere;
+}
diff --git a/apps/web/src/pages/Account.tsx b/apps/web/src/pages/Account.tsx
new file mode 100644
index 0000000..f6d1d94
--- /dev/null
+++ b/apps/web/src/pages/Account.tsx
@@ -0,0 +1,92 @@
+import { useEffect, useState } from 'react';
+import { Helmet } from 'react-helmet';
+import { Link } from 'react-router';
+
+import { PlanSection } from '@/components/PlanSection';
+import { PLAN_SHOWN } from '@/config/plan';
+import { useAuth } from '@/contexts/AuthContext';
+import { deviceId } from '@/services/keyStore';
+
+import styles from './Account.module.css';
+
+/**
+ * Account, `/account`: the menu's way into everything about the account. The plan, who is
+ * signed in, the "Encrypted" line, and the way to delete the account.
+ *
+ * The plan comes first because it is what most people open this page for, and it is all
+ * here rather than a line linking to a page of its own: Account was four short sections, one
+ * of them a link to the page with the substance, which was a click that bought nothing.
+ *
+ * One page, rather than a settings layout with the plan and deletion as tabs, because
+ * deletion cannot move into one: `/delete-account` is public (it is the address given to
+ * Google Play, read by people with no account), so this page links out to it.
+ */
+export function Account() {
+ const { user } = useAuth();
+
+ return (
+
+
+ Account
+
+
Account
+
+ {PLAN_SHOWN && }
+
+
+
Email
+
{user?.email}
+
+
+
+
+
+
Delete account
+
+ Deletes the account and everything pushed from it, at once and for good. The next page says exactly what goes
+ and asks for your password first.
+
+
+
+ Delete account
+
+
+
+
+ );
+}
+
+/**
+ * The "Encrypted" line (docs/e2ee.md, Saying so): that the pushes are encrypted, this
+ * device's id, and where to read what that means. The id is what this install puts on its
+ * pushes in place of the device's model name, so showing it lets someone see all the
+ * server is told about the device. IndexedDB can refuse (a private window in some
+ * browsers), and the line then goes without the id rather than not at all.
+ */
+function Encrypted() {
+ const [id, setId] = useState(null);
+ useEffect(() => {
+ let current = true;
+ deviceId()
+ .then((made) => current && setId(made))
+ .catch((error) => console.error('Could not read the device id:', error));
+ return () => {
+ current = false;
+ };
+ }, []);
+
+ return (
+
+
Encrypted
+
+ Your pushes are encrypted on your devices with a key made from your password, and only they can read them.{' '}
+ How it works.
+
- Choose Delete account. On the website and in the extension this opens this page: use the{' '}
- form below.
+ Choose Delete account. On the website and in the extension, choose Account{' '}
+ and then Delete account, which opens this page: use the form below.
In the Android, iPhone and Mac apps, enter your password to confirm, and press Delete account
diff --git a/apps/web/src/pages/Push.module.css b/apps/web/src/pages/Push.module.css
index cf170f1..2398c5b 100644
--- a/apps/web/src/pages/Push.module.css
+++ b/apps/web/src/pages/Push.module.css
@@ -32,6 +32,13 @@
border: 1px solid #fecaca;
}
+/* The site's link color is its pink, which is hard to read on this pale red box */
+.error a {
+ color: inherit;
+ font-weight: 600;
+ text-decoration: underline;
+}
+
.divider {
display: flex;
align-items: center;
diff --git a/apps/web/src/pages/Push.tsx b/apps/web/src/pages/Push.tsx
index c124cdd..ee8a4fe 100644
--- a/apps/web/src/pages/Push.tsx
+++ b/apps/web/src/pages/Push.tsx
@@ -1,9 +1,10 @@
import { getFirestore } from 'firebase/firestore';
import { getStorage } from 'firebase/storage';
import { useState } from 'react';
+import { Link } from 'react-router';
import Button from '@/components/Button';
-import { LIMITS, formatMb } from '@/config/plan';
+import { LIMITS, PLAN_SHOWN, formatMb } from '@/config/plan';
import { usePlan } from '@/hooks/usePlan';
import { KEYS_UNAVAILABLE, usePushKeys } from '@/hooks/usePushKeys';
import {
@@ -12,7 +13,7 @@ import {
atLimit,
isRulesRefusal,
limitMessage,
- refusalMessage,
+ refusalReason,
} from '@/services/pushRefusal';
import {
PushTooLongError,
@@ -30,7 +31,12 @@ export default function Push() {
const [file, setFile] = useState(null);
const [isSubmitting, setIsSubmitting] = useState(false);
const [isUploadSubmitting, setIsUploadSubmitting] = useState(false);
- const [error, setError] = useState(null);
+ // The message and whether it is the month's limit, which is followed by a link to the
+ // plan: hitting the limit is when someone on Free is most ready to upgrade, and the only
+ // way to the plan otherwise is the menu. One piece of state, so the link cannot stay under
+ // a later, unrelated error: the link and file forms submit independently and share it.
+ const [error, setError] = useState<{ message: string; atLimit: boolean } | null>(null);
+ const fail = (message: string, atLimit = false) => setError({ message, atLimit });
const { plan, refresh: refreshPlan } = usePlan();
const { keys } = usePushKeys();
@@ -40,7 +46,7 @@ export default function Push() {
if (!url) return;
if (!keys) {
- setError(KEYS_UNAVAILABLE);
+ fail(KEYS_UNAVAILABLE);
return;
}
@@ -50,7 +56,7 @@ export default function Push() {
// Read once per mount, so a new period or a subscription in another tab is not seen
// until it is read again; a refusal here asks for the read, so the next try is right.
void refreshPlan();
- setError(limitMessage(plan, 'url'));
+ fail(limitMessage(plan, 'url'), true);
return;
}
@@ -61,7 +67,7 @@ export default function Push() {
try {
new URL(url);
} catch (error) {
- setError('Invalid URL');
+ fail('Invalid URL');
setIsSubmitting(false);
return;
}
@@ -79,15 +85,18 @@ export default function Push() {
console.error('Error saving link:', error);
// The limit reached on another device, a key a reset replaced, or a push this copy of
// PushThat cannot make (pushRefusal.ts); the plan read again stops the next try here.
- setError(
- isRulesRefusal(error)
- ? await refusalMessage(plan, 'url', refreshPlan, () => keyIsStale(getFirestore(), keys))
- : error instanceof PushUnconfirmedError
+ if (isRulesRefusal(error)) {
+ const refusal = await refusalReason(plan, 'url', refreshPlan, () => keyIsStale(getFirestore(), keys));
+ fail(refusal.message, refusal.atLimit);
+ } else {
+ fail(
+ error instanceof PushUnconfirmedError
? UNCONFIRMED_MESSAGE
: error instanceof PushTooLongError
? TOO_LONG_LINK_MESSAGE
: 'Failed to save link. Please try again.'
- );
+ );
+ }
} finally {
setIsSubmitting(false);
}
@@ -99,7 +108,7 @@ export default function Push() {
if (!file) return;
if (!keys) {
- setError(KEYS_UNAVAILABLE);
+ fail(KEYS_UNAVAILABLE);
return;
}
@@ -110,7 +119,7 @@ export default function Push() {
// `>=`, as the Storage rule has it: a file of exactly the limit is refused there. The
// rule measures the encrypted object, a few bytes a megabyte larger than the file.
if (encryptedSize(file.size) >= limits.fileBytes) {
- setError(
+ fail(
`File size must be under ${formatMb(limits.fileBytes)}${plan?.tier === 'free' ? ` on the free plan (${formatMb(LIMITS.pro.fileBytes)} on Pro)` : ''}.`
);
return;
@@ -120,7 +129,7 @@ export default function Push() {
// nothing to ever delete them. Refused here first, with the plan already in hand.
if (plan && atLimit(plan, 'file')) {
void refreshPlan();
- setError(limitMessage(plan, 'file'));
+ fail(limitMessage(plan, 'file'), true);
return;
}
@@ -139,15 +148,18 @@ export default function Push() {
if (fileInput) fileInput.value = '';
} catch (error) {
console.error('Error saving file:', error);
- setError(
- isRulesRefusal(error)
- ? await refusalMessage(plan, 'file', refreshPlan, () => keyIsStale(getFirestore(), keys))
- : error instanceof PushUnconfirmedError
+ if (isRulesRefusal(error)) {
+ const refusal = await refusalReason(plan, 'file', refreshPlan, () => keyIsStale(getFirestore(), keys));
+ fail(refusal.message, refusal.atLimit);
+ } else {
+ fail(
+ error instanceof PushUnconfirmedError
? UNCONFIRMED_MESSAGE
: error instanceof PushTooLongError
? 'That file name is too long to push.'
: 'Failed to upload file. Please try again.'
- );
+ );
+ }
} finally {
setIsUploadSubmitting(false);
}
@@ -161,7 +173,17 @@ export default function Push() {
return (