User feedback: still ugly, the 1xbet navigation was never actually reproduced. Now follows its structure: - thin utility bar on top (country picker, Connexion + Inscription) above the main bar (logo, nav) - horizontal icon strip of the country's lotteries under the header, with the active one underlined in gold - compact promo banner instead of a full-height hero, so results stay above the fold - right rail in the bet-slip position: top-5 leaderboard and army stats Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
"use client"
|
|
|
|
import { useTransition } from "react"
|
|
import { useRouter } from "next/navigation"
|
|
import { Check, ChevronDown } from "lucide-react"
|
|
import { COUNTRIES, countryTheme } from "@/lib/countries"
|
|
import { setCountryAction } from "@/app/actions"
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuLabel,
|
|
DropdownMenuSeparator,
|
|
DropdownMenuTrigger,
|
|
} from "@/components/ui/dropdown-menu"
|
|
import { cn } from "@/lib/utils"
|
|
import { Flag } from "@/components/flag"
|
|
|
|
export function CountrySwitcher({ active, compact }: { active: string; compact?: boolean }) {
|
|
const router = useRouter()
|
|
const [pending, startTransition] = useTransition()
|
|
const current = countryTheme(active)
|
|
|
|
function choose(code: string) {
|
|
if (code === active) return
|
|
startTransition(async () => {
|
|
await setCountryAction(code)
|
|
router.refresh()
|
|
})
|
|
}
|
|
|
|
return (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger
|
|
aria-label={`Pays : ${current.name}. Changer de pays`}
|
|
className={cn(
|
|
"flex items-center gap-2 rounded border font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",
|
|
compact
|
|
? "h-7 border-transparent px-2 text-xs hover:bg-panel-hover"
|
|
: "h-9 border-gold/30 bg-card/70 px-3 text-sm hover:border-gold/60",
|
|
pending && "opacity-60"
|
|
)}
|
|
>
|
|
<Flag code={current.code} />
|
|
<span className="hidden sm:inline">{current.name}</span>
|
|
<ChevronDown className="h-3.5 w-3.5 text-muted-foreground" />
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="end" className="w-56">
|
|
<DropdownMenuLabel className="text-xs text-muted-foreground">Choisir un pays</DropdownMenuLabel>
|
|
<DropdownMenuSeparator />
|
|
{COUNTRIES.map((c) => (
|
|
<DropdownMenuItem key={c.code} onSelect={() => choose(c.code)} className="gap-2.5">
|
|
<Flag code={c.code} />
|
|
<span className="flex-1">{c.name}</span>
|
|
{c.code === active && <Check className="h-4 w-4 text-gold" />}
|
|
</DropdownMenuItem>
|
|
))}
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
)
|
|
}
|