From 8579ec36cac7adc9456b85e470f4520b1a36cc9c Mon Sep 17 00:00:00 2001 From: yohlo Date: Thu, 2 Oct 2025 14:49:29 -0500 Subject: [PATCH] bug fixes, new fonts, etc --- src/app/routes/__root.tsx | 12 +++- src/components/typeahead.tsx | 26 +++---- .../admin/components/award-badges.tsx | 69 +++++++++++-------- .../badges/components/badge-showcase.tsx | 16 ++--- src/features/core/components/header.tsx | 7 +- src/features/login/components/layout.tsx | 2 +- .../players/components/profile/header.tsx | 4 +- src/features/teams/components/team-card.tsx | 7 +- .../components/team-form/song-search.tsx | 6 +- .../teams/components/team-profile/header.tsx | 2 +- .../tournaments/components/profile/header.tsx | 2 +- .../components/tournament-card.tsx | 7 +- .../enroll-team/team-selection-view.tsx | 3 +- .../components/upcoming-tournament/index.tsx | 8 +-- src/lib/mantine/mantine-provider.tsx | 2 + src/lib/pocketbase/client.ts | 21 +++--- 16 files changed, 111 insertions(+), 83 deletions(-) diff --git a/src/app/routes/__root.tsx b/src/app/routes/__root.tsx index 64ce625..2e35e40 100644 --- a/src/app/routes/__root.tsx +++ b/src/app/routes/__root.tsx @@ -63,7 +63,17 @@ export const Route = createRootRouteWithContext<{ { rel: 'stylesheet', href: mantineCssUrl }, { rel: 'stylesheet', href: mantineCarouselCssUrl }, { rel: 'stylesheet', href: mantineDatesCssUrl }, - { rel: 'stylesheet', href: mantineTiptapCssUrl } + { rel: 'stylesheet', href: mantineTiptapCssUrl }, + { rel: "preconnect", href: "https://fonts.googleapis.com" }, + { + rel: "preconnect", + href: "https://fonts.gstatic.com", + crossOrigin: "anonymous", + }, + { + rel: "stylesheet", + href: "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=League+Spartan:wght@100..900&display=swap", + } ], }), errorComponent: (props) => { diff --git a/src/components/typeahead.tsx b/src/components/typeahead.tsx index 1843057..5d096c6 100644 --- a/src/components/typeahead.tsx +++ b/src/components/typeahead.tsx @@ -16,6 +16,7 @@ export interface TypeaheadProps { debounceMs?: number; disabled?: boolean; initialValue?: string; + maxHeight?: number | string; } const Typeahead = ({ @@ -26,7 +27,8 @@ const Typeahead = ({ placeholder = "Search...", debounceMs = 300, disabled = false, - initialValue = "" + initialValue = "", + maxHeight = 200, }: TypeaheadProps) => { const [searchQuery, setSearchQuery] = useState(initialValue); const [searchResults, setSearchResults] = useState[]>([]); @@ -36,13 +38,7 @@ const Typeahead = ({ const containerRef = useRef(null); const inputRef = useRef(null); - const debouncedSearch = useDebouncedCallback(async (query: string) => { - if (!query.trim()) { - setSearchResults([]); - setIsOpen(false); - return; - } - + const performSearch = async (query: string) => { setIsLoading(true); try { const results = await searchFn(query); @@ -56,7 +52,9 @@ const Typeahead = ({ } finally { setIsLoading(false); } - }, debounceMs); + }; + + const debouncedSearch = useDebouncedCallback(performSearch, debounceMs); const handleSearchChange = (value: string) => { setSearchQuery(value); @@ -114,8 +112,12 @@ const Typeahead = ({ value={searchQuery} onChange={(event) => handleSearchChange(event.currentTarget.value)} onKeyDown={handleKeyDown} - onFocus={() => { - if (searchResults.length > 0) setIsOpen(true); + onFocus={async () => { + if (searchResults.length > 0) { + setIsOpen(true); + return; + } + await performSearch(searchQuery); }} placeholder={placeholder} rightSection={isLoading ? : null} @@ -133,7 +135,7 @@ const Typeahead = ({ left: 0, right: 0, zIndex: 9999, - maxHeight: '160px', + maxHeight, overflowY: 'auto', WebkitOverflowScrolling: 'touch', touchAction: 'pan-y', diff --git a/src/features/admin/components/award-badges.tsx b/src/features/admin/components/award-badges.tsx index 421ed4b..f3d69be 100644 --- a/src/features/admin/components/award-badges.tsx +++ b/src/features/admin/components/award-badges.tsx @@ -1,5 +1,5 @@ import { useState } from "react"; -import { Box, Card, Text, Select, Button, Group, Stack } from "@mantine/core"; +import { Box, Card, Text, Select, Button, Group, Stack, Badge, Divider } from "@mantine/core"; import { awardManualBadge } from "@/features/badges/server"; import { useAllBadges } from "@/features/badges/queries"; import toast from "@/lib/sonner"; @@ -27,10 +27,14 @@ const AwardBadges = () => { }, }); - toast.success("Badge awarded successfully"); + const selectedPlayer = players.find((p) => p.id === selectedPlayerId); + const playerName = selectedPlayer + ? `${selectedPlayer.first_name} ${selectedPlayer.last_name}` + : "Player"; + + toast.success(`Badge awarded to ${playerName}`); setSelectedPlayerId(null); - setSelectedBadgeId(null); } catch (error) { toast.error("Failed to award badge"); } finally { @@ -48,48 +52,59 @@ const AwardBadges = () => { label: badge.name, })); + const selectedBadge = manualBadges.find((b) => b.id === selectedBadgeId); + return ( - + Award Manual Badge - - Select a player and a manual badge to award - - - - + {selectedBadgeId && ( + <> + + + +