Skip to content

Commit a24e5d2

Browse files
Merge pull request #154 from heyoub/fix/site-check-153
fix(web): reorder header, pad mobile sheet, repoint dead GitBook links
2 parents 2d4fabd + 684ca34 commit a24e5d2

16 files changed

Lines changed: 561 additions & 145 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export function AppFooter() {
200200
Copyright © Code for Philly {FOUNDED_YEAR}–{CURRENT_YEAR}
201201
</p>
202202
<a
203-
href="https://github.com/CodeForPhilly/codeforphilly-rewrite"
203+
href="https://github.com/CodeForPhilly/codeforphilly-ng"
204204
target="_blank"
205205
rel="noopener noreferrer"
206206
className="hover:text-foreground transition-colors"

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

Lines changed: 102 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState } from 'react';
2-
import { Link, NavLink } from 'react-router';
2+
import { Link, NavLink, useLocation } from 'react-router';
33
import { Button } from '@/components/ui/button';
44
import {
55
DropdownMenu,
@@ -8,11 +8,21 @@ import {
88
DropdownMenuSeparator,
99
DropdownMenuTrigger,
1010
} from '@/components/ui/dropdown-menu';
11-
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet';
11+
import {
12+
Sheet,
13+
SheetContent,
14+
SheetDescription,
15+
SheetHeader,
16+
SheetTitle,
17+
SheetTrigger,
18+
} from '@/components/ui/sheet';
1219
import { Separator } from '@/components/ui/separator';
1320
import { SearchBox } from '@/components/SearchBox';
21+
import { GitHubIcon } from '@/components/icons/GitHubIcon';
1422
import { useAuth } from '@/hooks/useAuth';
1523

24+
const GITHUB_URL = 'https://github.com/CodeForPhilly';
25+
1626
function ChevronDownIcon() {
1727
return (
1828
<svg
@@ -60,7 +70,7 @@ function AuthControls({ mobile = false }: { mobile?: boolean }) {
6070
return (
6171
<div
6272
className={`h-8 ${mobile ? 'w-full' : 'w-20'} bg-muted animate-pulse rounded`}
63-
aria-label="Loading auth state"
73+
aria-hidden="true"
6474
/>
6575
);
6676
}
@@ -143,12 +153,8 @@ function AboutDropdown() {
143153
return (
144154
<DropdownMenu>
145155
<DropdownMenuTrigger asChild>
146-
<Button
147-
variant="ghost"
148-
size="sm"
149-
className="flex items-center gap-1"
150-
aria-label="About menu"
151-
>
156+
{/* No aria-label: the visible "About" text is the accessible name. */}
157+
<Button variant="ghost" size="sm" className="flex items-center gap-1">
152158
About <ChevronDownIcon />
153159
</Button>
154160
</DropdownMenuTrigger>
@@ -181,8 +187,34 @@ const navLinkClass = ({ isActive }: { isActive: boolean }) =>
181187
isActive ? 'text-primary' : 'text-muted-foreground'
182188
}`;
183189

190+
function GitHubLink() {
191+
return (
192+
// Desktop-only: between md and lg the header has no room for it (the
193+
// utility cluster would push "Help Wanted" onto two lines); the mobile
194+
// sheet carries its own GitHub row.
195+
<Button asChild variant="ghost" size="icon-sm" className="hidden lg:inline-flex">
196+
<a
197+
href={GITHUB_URL}
198+
target="_blank"
199+
rel="noopener noreferrer"
200+
aria-label="Code for Philly on GitHub"
201+
>
202+
<GitHubIcon />
203+
</a>
204+
</Button>
205+
);
206+
}
207+
184208
export function AppHeader() {
185-
const [mobileOpen, setMobileOpen] = useState(false);
209+
const location = useLocation();
210+
// The sheet is open only for the location it was opened at, so any
211+
// client-side navigation — a NavLink or Enter in the inline search —
212+
// closes it without per-item onClick closers. Derived during render
213+
// rather than synced in an effect (react-hooks/set-state-in-effect).
214+
const [openedAtKey, setOpenedAtKey] = useState<string | null>(null);
215+
const mobileOpen = openedAtKey === location.key;
216+
const setMobileOpen = (open: boolean) =>
217+
setOpenedAtKey(open ? location.key : null);
186218

187219
return (
188220
<header className="sticky top-0 z-40 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 shadow-sm print:hidden">
@@ -201,135 +233,125 @@ export function AppHeader() {
201233
/>
202234
</Link>
203235

204-
{/* Desktop nav */}
236+
{/* Desktop content cluster. The parent gap is the only source of
237+
spacing between children — no per-child margins. */}
205238
<nav
206239
aria-label="Primary navigation"
207-
className="hidden md:flex items-center gap-1 ml-4 flex-1"
240+
className="hidden md:flex items-center gap-2 ml-4 flex-1"
208241
>
209242
<NavLink to="/projects" className={navLinkClass}>
210243
Projects
211244
</NavLink>
212-
<NavLink
213-
to="/help-wanted"
214-
className={({ isActive }) => navLinkClass({ isActive }) + ' ml-1'}
215-
>
245+
<NavLink to="/help-wanted" className={navLinkClass}>
216246
Help Wanted
217247
</NavLink>
218-
<NavLink
219-
to="/members"
220-
className={({ isActive }) => navLinkClass({ isActive }) + ' ml-1'}
221-
>
248+
<NavLink to="/members" className={navLinkClass}>
222249
Members
223250
</NavLink>
224-
<Button asChild size="sm" className="ml-1 bg-green-600 hover:bg-green-700 text-white">
225-
<NavLink to="/volunteer">Volunteer</NavLink>
226-
</Button>
227-
<div className="ml-1">
228-
<AboutDropdown />
229-
</div>
251+
<AboutDropdown />
230252
</nav>
231253

232-
{/* Desktop: search + auth */}
233-
<div className="hidden md:flex items-center gap-2 ml-auto">
254+
{/* Desktop utility cluster: GitHub, search, auth, then the Volunteer
255+
CTA pinned rightmost (specs/behaviors/app-shell.md). */}
256+
<nav
257+
aria-label="Utility"
258+
className="hidden md:flex items-center gap-2 ml-auto"
259+
>
260+
<GitHubLink />
234261
<SearchBox />
235262
<AuthControls />
236-
</div>
263+
<Button
264+
asChild
265+
size="sm"
266+
className="bg-green-600 hover:bg-green-700 text-white"
267+
>
268+
<NavLink to="/volunteer">Volunteer</NavLink>
269+
</Button>
270+
</nav>
237271

238272
{/* Mobile: auth + hamburger */}
239273
<div className="flex md:hidden items-center gap-2 ml-auto">
240274
<AuthControls />
241275
<Sheet open={mobileOpen} onOpenChange={setMobileOpen}>
242276
<SheetTrigger asChild>
277+
{/* No aria-expanded here — Radix's Dialog.Trigger supplies it. */}
243278
<Button
244279
variant="ghost"
245280
size="sm"
246281
aria-label="Open navigation menu"
247-
aria-expanded={mobileOpen}
248282
>
249283
<MenuIcon />
250284
</Button>
251285
</SheetTrigger>
252-
<SheetContent side="right" className="w-72 flex flex-col gap-4 pt-8">
286+
<SheetContent side="right">
287+
{/* SheetHeader/SheetTitle carry the panel's own padding and give
288+
the underlying Radix dialog its accessible name; the
289+
visually-hidden description satisfies aria-describedby. */}
290+
<SheetHeader className="pb-0">
291+
<SheetTitle>Menu</SheetTitle>
292+
<SheetDescription className="sr-only">
293+
Site navigation
294+
</SheetDescription>
295+
</SheetHeader>
296+
{/* min-h-0 + overflow-y-auto so the list stays reachable on
297+
short viewports instead of overflowing the panel. */}
253298
<nav
254299
aria-label="Mobile navigation"
255-
className="flex flex-col gap-2"
300+
className="flex flex-col gap-2 px-4 min-h-0 overflow-y-auto"
256301
>
257-
<NavLink
258-
to="/projects"
259-
className={navLinkClass}
260-
onClick={() => setMobileOpen(false)}
261-
>
302+
<NavLink to="/projects" className={navLinkClass}>
262303
Projects
263304
</NavLink>
264-
<NavLink
265-
to="/help-wanted"
266-
className={navLinkClass}
267-
onClick={() => setMobileOpen(false)}
268-
>
305+
<NavLink to="/help-wanted" className={navLinkClass}>
269306
Help Wanted
270307
</NavLink>
271-
<NavLink
272-
to="/members"
273-
className={navLinkClass}
274-
onClick={() => setMobileOpen(false)}
275-
>
308+
<NavLink to="/members" className={navLinkClass}>
276309
Members
277310
</NavLink>
278-
<NavLink
279-
to="/volunteer"
280-
className={navLinkClass}
281-
onClick={() => setMobileOpen(false)}
282-
>
283-
Volunteer
284-
</NavLink>
285311
<Separator />
286312
<p className="text-xs text-muted-foreground font-medium uppercase tracking-wide">
287313
About
288314
</p>
289-
<NavLink
290-
to="/pages/mission"
291-
className={navLinkClass}
292-
onClick={() => setMobileOpen(false)}
293-
>
315+
<NavLink to="/pages/mission" className={navLinkClass}>
294316
Mission
295317
</NavLink>
296-
<NavLink
297-
to="/pages/leadership"
298-
className={navLinkClass}
299-
onClick={() => setMobileOpen(false)}
300-
>
318+
<NavLink to="/pages/leadership" className={navLinkClass}>
301319
Leadership
302320
</NavLink>
303-
<NavLink
304-
to="/pages/code-of-conduct"
305-
className={navLinkClass}
306-
onClick={() => setMobileOpen(false)}
307-
>
321+
<NavLink to="/pages/code-of-conduct" className={navLinkClass}>
308322
Code of Conduct
309323
</NavLink>
310-
<NavLink
311-
to="/pages/hackathons"
312-
className={navLinkClass}
313-
onClick={() => setMobileOpen(false)}
314-
>
324+
<NavLink to="/pages/hackathons" className={navLinkClass}>
315325
Hackathons
316326
</NavLink>
317-
<NavLink
318-
to="/sponsor"
319-
className={navLinkClass}
320-
onClick={() => setMobileOpen(false)}
321-
>
327+
<NavLink to="/sponsor" className={navLinkClass}>
322328
Sponsor
323329
</NavLink>
324330
<a
325331
href="mailto:hello@codeforphilly.org"
326332
className="text-sm font-medium text-muted-foreground hover:text-primary"
333+
onClick={() => setMobileOpen(false)}
327334
>
328335
Contact
329336
</a>
337+
<Separator />
338+
<a
339+
href={GITHUB_URL}
340+
target="_blank"
341+
rel="noopener noreferrer"
342+
className="text-sm font-medium text-muted-foreground hover:text-primary"
343+
onClick={() => setMobileOpen(false)}
344+
>
345+
GitHub
346+
</a>
347+
<NavLink to="/volunteer" className={navLinkClass}>
348+
Volunteer
349+
</NavLink>
330350
</nav>
331351
<Separator />
332-
<SearchBox inline />
352+
<div className="px-4 pb-4">
353+
<SearchBox inline />
354+
</div>
333355
</SheetContent>
334356
</Sheet>
335357
</div>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function SearchBox({ inline = false }: SearchBoxProps) {
6666

6767
return (
6868
<div
69-
className={`relative ${inline ? 'w-full' : 'w-48 focus-within:w-72 transition-all duration-200'}`}
69+
className={`relative ${inline ? 'w-full' : 'w-24 lg:w-48 lg:focus-within:w-72 transition-all duration-200'}`}
7070
>
7171
<Input
7272
ref={inputRef}
@@ -88,7 +88,7 @@ export function SearchBox({ inline = false }: SearchBoxProps) {
8888
id="search-results-dropdown"
8989
role="listbox"
9090
aria-label="Search results"
91-
className="absolute top-full left-0 right-0 mt-1 bg-popover border border-border rounded-md shadow-lg z-50 py-1 max-h-[28rem] overflow-y-auto"
91+
className="absolute top-full right-0 min-w-72 mt-1 bg-popover border border-border rounded-md shadow-lg z-50 py-1 max-h-[28rem] overflow-y-auto"
9292
>
9393
{loading && results.length === 0 && (
9494
<p className="px-3 py-2 text-sm text-muted-foreground">Searching…</p>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/** GitHub mark, sized to sit inline with text and icon buttons. */
2+
export function GitHubIcon() {
3+
return (
4+
<svg
5+
xmlns="http://www.w3.org/2000/svg"
6+
width="18"
7+
height="18"
8+
viewBox="0 0 24 24"
9+
fill="currentColor"
10+
aria-hidden="true"
11+
>
12+
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
13+
</svg>
14+
);
15+
}

‎apps/web/src/pages/HomeStub.tsx‎

Lines changed: 0 additions & 29 deletions
This file was deleted.

‎apps/web/src/pages/LoginPlaceholder.tsx‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { Button } from '@/components/ui/button';
1111
import { Input } from '@/components/ui/input';
1212
import { Label } from '@/components/ui/label';
13+
import { GitHubIcon } from '@/components/icons/GitHubIcon';
1314
import { useAuth } from '@/hooks/useAuth';
1415
import { api, ApiError } from '@/lib/api';
1516

@@ -46,21 +47,6 @@ const ERROR_MESSAGES: Record<ErrorCode, React.ReactNode> = {
4647
),
4748
};
4849

49-
function GitHubIcon() {
50-
return (
51-
<svg
52-
xmlns="http://www.w3.org/2000/svg"
53-
width="18"
54-
height="18"
55-
viewBox="0 0 24 24"
56-
fill="currentColor"
57-
aria-hidden="true"
58-
>
59-
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
60-
</svg>
61-
);
62-
}
63-
6450
function WhyGitHub() {
6551
const [open, setOpen] = useState(false);
6652

0 commit comments

Comments
 (0)