Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 44 additions & 12 deletions apps/wodsmith-start/src/components/cohost-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ const getNavigation = (
label: "Competition Setup",
items: [
...(permissions?.divisions
? [{ label: "Divisions", href: `${basePath}/divisions`, icon: Layers }]
? [
{
label: "Divisions",
href: `${basePath}/divisions`,
icon: Layers,
},
]
: []),
...(permissions?.editEvents
? [
Expand All @@ -98,13 +104,31 @@ const getNavigation = (
]
: []),
...(permissions?.locations
? [{ label: "Locations", href: `${basePath}/locations`, icon: MapPin }]
? [
{
label: "Locations",
href: `${basePath}/locations`,
icon: MapPin,
},
]
: []),
...(permissions?.scoringConfig
? [{ label: "Scoring", href: `${basePath}/scoring`, icon: Calculator }]
? [
{
label: "Scoring",
href: `${basePath}/scoring`,
icon: Calculator,
},
]
: []),
...(permissions?.viewRegistrations
? [{ label: "Registrations", href: `${basePath}/athletes`, icon: Users }]
? [
{
label: "Registrations",
href: `${basePath}/athletes`,
icon: Users,
},
]
: []),
...(permissions?.waivers
? [
Expand Down Expand Up @@ -189,7 +213,13 @@ const getNavigation = (
]
: []),
...(permissions?.sponsors
? [{ label: "Sponsors", href: `${basePath}/sponsors`, icon: Sparkles }]
? [
{
label: "Sponsors",
href: `${basePath}/sponsors`,
icon: Sparkles,
},
]
: []),
],
},
Expand All @@ -215,8 +245,9 @@ function NavMenuItem({ item, isActive }: { item: NavItem; isActive: boolean }) {
function CohostSidebarHeader({ competitionName }: { competitionName: string }) {
return (
<SidebarHeader className="border-b px-3 py-3 group-data-[collapsible=icon]:px-2 group-data-[collapsible=icon]:py-3 group-data-[collapsible=icon]:justify-center">
{/* @lat: [[architecture#Route Groups#compete]] */}
<Link
to="/compete"
to="/"
className="flex items-center gap-2 min-w-0 group-data-[collapsible=icon]:hidden"
>
<img
Expand All @@ -238,10 +269,8 @@ function CohostSidebarHeader({ competitionName }: { competitionName: string }) {
</span>
</div>
</Link>
<Link
to="/compete"
className="hidden group-data-[collapsible=icon]:block"
>
{/* @lat: [[architecture#Route Groups#compete]] */}
<Link to="/" className="hidden group-data-[collapsible=icon]:block">
<img
src="/wodsmith-logo-no-text.png"
alt="wodsmith compete"
Expand Down Expand Up @@ -334,15 +363,18 @@ export function CohostSidebar({
<Menu className="h-5 w-5" />
</SidebarTrigger>
<div className="flex items-center gap-2 min-w-0">
<Link to="/compete" className="flex items-center gap-2 shrink-0">
{/* @lat: [[architecture#Route Groups#compete]] */}
<Link to="/" className="flex items-center gap-2 shrink-0">
<img
src="/wodsmith-logo-no-text.png"
alt="wodsmith compete"
width={24}
height={24}
/>
</Link>
<span className="truncate text-sm font-medium">{competitionName}</span>
<span className="truncate text-sm font-medium">
{competitionName}
</span>
</div>
</header>
<div className="h-14 md:hidden" />
Expand Down
9 changes: 8 additions & 1 deletion apps/wodsmith-start/src/components/compete-breadcrumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ interface BreadcrumbSegment {
href?: string
}

// @lat: [[architecture#Route Groups#compete]]
const COMPETITION_DISCOVERY_PATH = "/"

/**
* Route segment to human-readable label mapping
*/
Expand Down Expand Up @@ -128,9 +131,13 @@ export function CompeteBreadcrumb({

// Don't add href for the last segment (current page)
const isLast = i === pathSegments.length - 1
const href =
segment === "compete" && currentPath === "/compete"
? COMPETITION_DISCOVERY_PATH
: currentPath
segments.push({
label,
href: isLast ? undefined : currentPath,
href: isLast ? undefined : href,
})
}

Expand Down
36 changes: 21 additions & 15 deletions apps/wodsmith-start/src/components/compete-mobile-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default function CompeteMobileNav({
const [open, setOpen] = useState(false)
const router = useRouterState()
const pathname = router.location.pathname
const showCompetitionsLink = pathname !== "/"

const isProfileIncomplete =
missingProfileFields &&
Expand All @@ -95,9 +96,10 @@ export default function CompeteMobileNav({
<SheetContent side="left" background="sidebar">
<SheetTitle className="sr-only">Navigation Menu</SheetTitle>
<nav className="grid gap-6 font-medium text-lg">
{/* @lat: [[architecture#Route Groups#compete]] */}
{!shouldHideBrand(pathname) && (
<Link
to="/compete"
to="/"
className="mb-4 flex items-center gap-2 font-semibold text-lg"
onClick={handleLinkClick}
>
Expand Down Expand Up @@ -125,13 +127,15 @@ export default function CompeteMobileNav({
)}
{session?.user ? (
<>
<Link
to="/compete"
className="hover:text-primary"
onClick={handleLinkClick}
>
Events
</Link>
{showCompetitionsLink && (
<Link
to="/"
className="hover:text-primary"
onClick={handleLinkClick}
>
Competitions
</Link>
)}
{canOrganize && (
<a
href="/compete/organizer"
Expand Down Expand Up @@ -199,13 +203,15 @@ export default function CompeteMobileNav({
</>
) : (
<>
<Link
to="/compete"
className="hover:text-primary"
onClick={handleLinkClick}
>
Events
</Link>
{showCompetitionsLink && (
<Link
to="/"
className="hover:text-primary"
onClick={handleLinkClick}
>
Competitions
</Link>
)}
<a
href="/sign-in"
className="hover:text-primary"
Expand Down
3 changes: 2 additions & 1 deletion apps/wodsmith-start/src/components/compete-nav-brand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Link } from "@tanstack/react-router"

export function CompeteNavBrand() {
return (
<Link to="/compete" className="flex items-center gap-2">
// @lat: [[architecture#Route Groups#compete]]
<Link to="/" className="flex items-center gap-2">
Comment thread
coderabbitai[bot] marked this conversation as resolved.
<img
src="/wodsmith-logo-no-text.png"
alt="wodsmith compete"
Expand Down
47 changes: 27 additions & 20 deletions apps/wodsmith-start/src/components/compete-nav.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client"

import { Link } from "@tanstack/react-router"
import { Link, useRouterState } from "@tanstack/react-router"
import { User } from "lucide-react"
import CompeteMobileNav from "@/components/compete-mobile-nav"
import { CompeteNavBrand } from "@/components/compete-nav-brand"
Expand All @@ -17,23 +17,32 @@ export default function CompeteNav({ session, canOrganize }: CompeteNavProps) {
// For now, we don't have these other features implemented in wodsmith-start
const pendingInvitations: never[] = []
const missingProfileFields = null
const pathname = useRouterState({
select: (state) => state.location.pathname,
})
const showCompetitionsLink = pathname !== "/"

return (
<header className="border-black border-b-2 bg-background dark:border-dark-border dark:bg-dark-background">
<div className="container mx-auto flex items-center p-4">
<CompeteNavBrand />
<nav className="ml-auto hidden items-center gap-4 md:flex">
{/* @lat: [[architecture#Route Groups#compete]] */}
{session?.user ? (
<>
<Link
to="/compete"
className="font-bold text-foreground uppercase hover:underline dark:text-dark-foreground"
>
Events
</Link>
{showCompetitionsLink && (
<Link
to="/"
className="font-bold text-foreground uppercase hover:underline dark:text-dark-foreground"
>
Competitions
</Link>
)}
{canOrganize && (
<>
<div className="h-6 border-black border-l-2 dark:border-dark-border" />
{showCompetitionsLink && (
<div className="h-6 border-black border-l-2 dark:border-dark-border" />
)}
<Link
to="/compete/organizer"
className="flex items-center gap-1 font-bold text-foreground uppercase hover:underline dark:text-dark-foreground"
Expand All @@ -54,24 +63,22 @@ export default function CompeteNav({ session, canOrganize }: CompeteNavProps) {
</>
) : (
<div className="flex items-center gap-2">
<Link
to="/compete"
className="font-bold text-foreground uppercase hover:underline dark:text-dark-foreground"
>
Events
</Link>
{showCompetitionsLink && (
<Link
to="/"
className="font-bold text-foreground uppercase hover:underline dark:text-dark-foreground"
>
Competitions
</Link>
)}
<Link
to="/sign-in"
search={{ redirect: "/compete" }}
search={{ redirect: "/" }}
className="btn-outline"
>
Login
</Link>
<Link
to="/sign-up"
search={{ redirect: "/compete" }}
className="btn"
>
<Link to="/sign-up" search={{ redirect: "/" }} className="btn">
Sign Up
</Link>
<DarkModeToggle />
Expand Down
12 changes: 6 additions & 6 deletions apps/wodsmith-start/src/components/competition-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,9 @@ function NavMenuItem({ item, isActive }: { item: NavItem; isActive: boolean }) {
function CompetitionSidebarHeader() {
return (
<SidebarHeader className="h-14 flex-row items-center border-b px-3 group-data-[collapsible=icon]:px-2 group-data-[collapsible=icon]:justify-center">
{/* @lat: [[architecture#Route Groups#compete]] */}
<Link
to="/compete"
to="/"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
className="flex items-center gap-2 min-w-0 group-data-[collapsible=icon]:hidden"
>
<img
Expand All @@ -225,10 +226,8 @@ function CompetitionSidebarHeader() {
</span>
</h1>
</Link>
<Link
to="/compete"
className="hidden group-data-[collapsible=icon]:block"
>
{/* @lat: [[architecture#Route Groups#compete]] */}
<Link to="/" className="hidden group-data-[collapsible=icon]:block">
<img
src="/wodsmith-logo-no-text.png"
alt="wodsmith compete"
Expand Down Expand Up @@ -316,7 +315,8 @@ export function CompetitionSidebar({
<SidebarTrigger className="-ml-1">
<Menu className="h-5 w-5" />
</SidebarTrigger>
<Link to="/compete" className="flex items-center gap-2">
{/* @lat: [[architecture#Route Groups#compete]] */}
<Link to="/" className="flex items-center gap-2">
<img
src="/wodsmith-logo-no-text.png"
alt="wodsmith compete"
Expand Down
3 changes: 2 additions & 1 deletion apps/wodsmith-start/src/components/landing/final-cta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export function FinalCTA({ session }: FinalCTAProps) {
className="border-background/20 text-background hover:bg-background/10 dark:border-border dark:text-foreground dark:hover:bg-secondary"
asChild
>
<Link to="/compete">Browse Competitions</Link>
{/* @lat: [[architecture#Route Groups#compete]] */}
<Link to="/">Browse Competitions</Link>
</Button>
</div>

Expand Down
3 changes: 2 additions & 1 deletion apps/wodsmith-start/src/components/landing/two-audiences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ export function TwoAudiences({ session }: TwoAudiencesProps) {

<div className="mt-auto pt-6 border-t border-border">
<Button variant="outline" className="w-full" asChild>
<Link to="/compete">
{/* @lat: [[architecture#Route Groups#compete]] */}
<Link to="/">
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Browse Competitions
<ArrowRight className="ml-2 h-4 w-4" />
</Link>
Expand Down
12 changes: 8 additions & 4 deletions apps/wodsmith-start/src/components/nav/main-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ export default function MainNav({
session?.user
? hasWorkoutTracking
? "/workouts"
: "/compete"
: "/"
: // @lat: [[architecture#Route Groups#compete]]
"/"
: // @lat: [[architecture#Route Groups#compete]]
"/"
}
className="flex items-center gap-2"
>
Expand Down Expand Up @@ -85,8 +87,9 @@ export default function MainNav({
</a>
</>
)}
{/* @lat: [[architecture#Route Groups#compete]] */}
<a
href="/compete"
href="/"
className="font-bold text-foreground uppercase hover:underline dark:text-dark-foreground"
>
Compete
Expand All @@ -111,8 +114,9 @@ export default function MainNav({
</>
) : (
<div className="flex items-center gap-2">
{/* @lat: [[architecture#Route Groups#compete]] */}
<a
href="/compete"
href="/"
className="font-bold text-foreground uppercase hover:underline dark:text-dark-foreground"
>
Compete
Expand Down
Loading
Loading