Skip to content

Commit 888dce6

Browse files
Merge pull request #128 from CodeForPhilly/fix/home-start-project-cta
fix(web): route anonymous "Start a Project" CTA to login
2 parents 3fc540c + c7567a3 commit 888dce6

4 files changed

Lines changed: 99 additions & 5 deletions

File tree

‎apps/web/src/screens/Home.tsx‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ export function Home() {
131131
<p className="text-sm text-muted-foreground">Sponsor an event</p>
132132
</Link>
133133
<Link
134-
to={person ? '/projects/create' : 'https://codeforphilly.gitbook.io/projects/creating-new-partnerships/first-steps'}
135-
target={person ? undefined : '_blank'}
136-
rel={person ? undefined : 'noopener noreferrer'}
134+
to={person ? '/projects/create' : '/login?return=/projects/create'}
137135
className="block rounded-lg border border-border bg-card p-6 hover:shadow-md transition-shadow"
138136
>
139137
<h3 className="text-lg font-semibold mb-1">Start a Project</h3>

‎apps/web/tests/Home.test.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,15 @@ describe('Home', () => {
6666
expect(screen.getByRole('heading', { name: 'Sponsor' })).toBeInTheDocument();
6767
expect(screen.getByRole('heading', { name: 'Start a Project' })).toBeInTheDocument();
6868
});
69+
70+
it('routes the anonymous "Start a Project" card through login, not the dead GitBook URL', async () => {
71+
renderScreen(
72+
<AuthProvider>
73+
<Home />
74+
</AuthProvider>,
75+
);
76+
77+
const card = screen.getByRole('link', { name: /Start a Project/i });
78+
expect(card).toHaveAttribute('href', '/login?return=/projects/create');
79+
});
6980
});

‎plans/home-start-project-cta.md‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
status: done
3+
depends: []
4+
specs:
5+
- specs/screens/home.md
6+
issues: []
7+
pr: 128
8+
---
9+
10+
# Plan: fix the home "Start a Project" CTA for logged-out visitors
11+
12+
## Scope
13+
14+
Leadership-team feedback (Kat + Travis, #0-leadership-team, June 2026, with
15+
mobile screenshots) reported the home page's "Start a Project" card landing on
16+
a dead page — `codeforphilly.gitbook.io/.../first-steps` now returns "Content
17+
owner not found". The reported "works on laptop, not phone" symptom was really
18+
**logged-in vs logged-out**, not responsive: the card branches on `person`, and
19+
the anonymous branch pointed at the legacy GitBook URL.
20+
21+
What ships:
22+
23+
- **Spec fix first.** `specs/screens/home.md` prescribed the GitBook URL for the
24+
anonymous case — the spec was wrong, so it leads. Anonymous now routes through
25+
`/login?return=/projects/create`, matching the already-correct Volunteer
26+
screen convention (`volunteer.md:52`).
27+
- **Code fix.** `Home.tsx` anonymous branch → `/login?return=/projects/create`;
28+
both branches are now in-app routes, so the `target="_blank"`/`rel` props drop
29+
away (no more external navigation through react-router `<Link>`).
30+
31+
## Implements
32+
33+
- [home.md](../specs/screens/home.md) — Get-involved card table + Authorization
34+
table: anonymous "Start a Project" routes through `/login?return=/projects/create`.
35+
36+
## Approach
37+
38+
### 1. Spec change (specops, source of truth first)
39+
40+
`specs/screens/home.md` — Get-involved card link cell and the Authorization
41+
row both updated so the anonymous case is `/login?return=/projects/create`
42+
instead of the external GitBook URL.
43+
44+
### 2. SPA: `apps/web/src/screens/Home.tsx`
45+
46+
`to={person ? '/projects/create' : '/login?return=/projects/create'}` and
47+
remove the now-dead `target`/`rel` conditionals. Mirrors `Volunteer.tsx`.
48+
49+
## Validation
50+
51+
- [x] Spec updated: anonymous "Start a Project" → `/login?return=/projects/create`.
52+
- [x] `Home.tsx` anonymous branch routes in-app; no external GitBook URL remains.
53+
- [x] `target="_blank"`/`rel` props removed (both branches internal).
54+
- [x] Browser test: logged-out home → "Start a Project" → `/login?return=/projects/create`
55+
renders the real sign-in page; GitHub link carries `return=%2Fprojects%2Fcreate`.
56+
- [x] `npm run type-check && npm run lint && npm test` clean (web 74/74, shared 75/75).
57+
58+
## Risks
59+
60+
- Low. One-line behavior change on a well-trodden auth-redirect path already
61+
used by the Volunteer screen. `/login` honors `return` already.
62+
63+
## Notes
64+
65+
- The reported "works on laptop, not phone" was a misdiagnosis by the reporters:
66+
the card never branched on viewport, only on auth state (`person`). They were
67+
signed in on desktop, signed out on mobile. Worth remembering when triaging
68+
future "mobile-only" reports against this SPA — check auth state first.
69+
- The footer's "Start a Project" link (`AppFooter.tsx`) always points at
70+
`/projects/create` unconditionally; for an anon user that hits the route's own
71+
auth guard rather than the friendly login redirect. Left as-is — out of scope,
72+
and the route guard handles it — but noted in case we want footer parity later.
73+
74+
## Follow-ups
75+
76+
Separately surfaced in the same Slack thread, **not** part of this plan's scope
77+
(distinct features, not deferrals of this work):
78+
79+
- **Issue:** admin can edit but not delete users (project "Danger Zone" has
80+
delete; users don't) — parity gap reported by Travis.
81+
- **Issue:** legacy image fallback — serve old-site images for users/projects
82+
(relates to the `codeforphilly-data-snapshot` work, #115).
83+
84+
These are unrelated to the CTA fix and should be filed/triaged on their own; the
85+
CTA scope here is **None** outstanding.

‎specs/screens/home.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Three side-by-side cards (current site has these; they translate cleanly):
5252
| Card | Heading | Body | Link |
5353
| ---- | ------- | ---- | ---- |
5454
| Sponsor | "Sponsor" | "Sponsor an event" | `/sponsor` |
55-
| Start a Project | "Start a Project" | "Start or get help on a project" | external GitBook URL from current site, or `/projects/create` for signed-in users |
55+
| Start a Project | "Start a Project" | "Start or get help on a project" | `/projects/create` for signed-in users, else `/login?return=/projects/create` |
5656
| Volunteer | "Volunteer" | "Join our projects" | `/volunteer` |
5757

5858
### 4. Activity stream
@@ -101,7 +101,7 @@ Three side-by-side cards (current site has these; they translate cleanly):
101101
| ------- | --------- | ---- |
102102
| Hero CTA | "Volunteer" | "Browse Projects" |
103103
| Featured projects | visible | visible |
104-
| Get involved | visible | visible — "Start a Project" link changes to in-app `/projects/create` form |
104+
| Get involved | visible — "Start a Project" routes through `/login?return=/projects/create` | visible — "Start a Project" links to the in-app `/projects/create` form |
105105
| Activity stream | visible | visible |
106106
| Help-wanted rail | visible | visible — "Express interest" CTA on each card (deferred polish; v1 just links to project page) |
107107

0 commit comments

Comments
 (0)