Skip to content

Commit 75abde3

Browse files
fix(web): make Slack links leave the SPA for the /chat redirect
The footer "Slack", Volunteer "Open Slack", the events empty state, and the project "Chat Channel" / card "Chat" links were router links, so an in-app click showed the 404 page; only a new tab or refresh worked. They are plain anchors now, and a lint rule rejects router links to /chat, /calendar and /api/ so it doesn't come back. Fixes #230 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TGqwPjt3v4eMfiHpPmCKnR
1 parent 9b6182c commit 75abde3

6 files changed

Lines changed: 24 additions & 8 deletions

File tree

‎apps/web/src/components/AppFooter.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ export function AppFooter() {
177177
<h2 className="text-sm font-semibold text-foreground mb-3">Connect</h2>
178178
<ul className="space-y-2 text-sm text-muted-foreground mb-4">
179179
<li>
180-
<Link to="/chat" className="hover:text-foreground transition-colors">
180+
<a href="/chat" className="hover:text-foreground transition-colors">
181181
Slack
182-
</Link>
182+
</a>
183183
</li>
184184
</ul>
185185
<div className="flex items-center gap-3 flex-wrap">

‎apps/web/src/components/ProjectCard.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function ProjectCard({ project }: ProjectCardProps) {
7777
)}
7878
{project.links.chatChannel && (
7979
<Button asChild size="sm" variant="outline">
80-
<Link to={`/chat?channel=${encodeURIComponent(project.links.chatChannel)}`}>Chat</Link>
80+
<a href={`/chat?channel=${encodeURIComponent(project.links.chatChannel)}`}>Chat</a>
8181
</Button>
8282
)}
8383
{project.openHelpWantedCount > 0 && (

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ function UpcomingList({ isStaff }: { isStaff: boolean }) {
7474
<div className="py-12 text-center">
7575
<p className="text-muted-foreground">
7676
Nothing on the calendar yet.{' '}
77-
<Link to="/chat" className="text-primary hover:underline">
77+
<a href="/chat" className="text-primary hover:underline">
7878
Join the Slack
79-
</Link>{' '}
79+
</a>{' '}
8080
and watch #announcements — or check back soon.
8181
</p>
8282
{isStaff && (

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,9 @@ export function ProjectDetail({ anchor }: ProjectDetailProps = {}) {
485485
)}
486486
{project.links.chatChannel && (
487487
<Button asChild variant="outline">
488-
<Link to={`/chat?channel=${encodeURIComponent(project.links.chatChannel)}`}>
488+
<a href={`/chat?channel=${encodeURIComponent(project.links.chatChannel)}`}>
489489
Chat Channel
490-
</Link>
490+
</a>
491491
</Button>
492492
)}
493493
</div>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function Volunteer() {
5252
We coordinate everything in our Slack workspace.
5353
</p>
5454
<Button asChild variant="outline" size="sm">
55-
<Link to="/chat">Open Slack →</Link>
55+
<a href="/chat">Open Slack →</a>
5656
</Button>
5757
</div>
5858
<div className="rounded-lg border border-border bg-card p-5">

‎eslint.config.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ export default tseslint.config(
2525
languageOptions: { globals: { ...globals.browser } },
2626
rules: {
2727
...reactHooks.configs.recommended.rules,
28+
// Paths the server answers before the SPA (specs/screens/chat.md →
29+
// "Linking to it from the app"): a router <Link> never reaches them and
30+
// renders the SPA's 404 page. Use a plain <a href> for these.
31+
'no-restricted-syntax': [
32+
'error',
33+
{
34+
selector:
35+
"JSXAttribute[name.name='to'] > Literal[value=/^\\/(chat|calendar)(\\/|\\?|$)|^\\/api\\//]",
36+
message: 'Server-handled path: use <a href>, not a router link (specs/screens/chat.md).',
37+
},
38+
{
39+
selector:
40+
"JSXAttribute[name.name='to'] > JSXExpressionContainer > TemplateLiteral > TemplateElement:first-child[value.raw=/^\\/(chat|calendar)(\\/|\\?|$)|^\\/api\\//]",
41+
message: 'Server-handled path: use <a href>, not a router link (specs/screens/chat.md).',
42+
},
43+
],
2844
},
2945
},
3046
{

0 commit comments

Comments
 (0)