Skip to content

Commit 3c08b99

Browse files
feat: improve navbar dropdowns + leaderboard tooltips
1 parent 784cee3 commit 3c08b99

4 files changed

Lines changed: 95 additions & 82 deletions

File tree

src/components/Common/Header.tsx

Lines changed: 70 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const Header: React.FC = () => {
7575

7676
const userInfo = user?.lichessId ? (
7777
<div
78-
className="relative flex items-center gap-2 rounded-full bg-background-1/50 px-3 py-1.5 transition-all duration-200 hover:bg-background-1"
78+
className="relative flex items-center gap-2 rounded-full border border-white/10 bg-[#171214] px-3 py-1.5 transition-all duration-200 hover:border-white/20"
7979
onMouseEnter={() => setShowProfileDropdown(true)}
8080
onMouseLeave={() => setShowProfileDropdown(false)}
8181
>
@@ -99,26 +99,28 @@ export const Header: React.FC = () => {
9999
animate={{ opacity: 1, y: 0 }}
100100
exit={{ opacity: 0, y: -10 }}
101101
transition={{ duration: 0.2 }}
102-
className="absolute bottom-[100%] left-0 z-50 w-full overflow-hidden rounded border border-white/10 bg-background-1 shadow-lg md:bottom-auto md:top-[100%]"
102+
className="absolute bottom-[100%] left-0 z-50 w-full overflow-hidden rounded-md border border-white/10 bg-[#171214] md:bottom-auto md:top-[100%]"
103103
>
104-
<Link
105-
href="/profile"
106-
className="flex w-full items-center justify-start px-3 py-2 text-sm hover:bg-background-2/60"
107-
>
108-
Profile
109-
</Link>
110-
<Link
111-
href="/settings"
112-
className="flex w-full items-center justify-start px-3 py-2 text-sm hover:bg-background-2/60"
113-
>
114-
Settings
115-
</Link>
116-
<button
117-
onClick={logout}
118-
className="flex w-full items-center justify-start px-3 py-2 text-sm hover:bg-background-2/60"
119-
>
120-
Logout
121-
</button>
104+
<div className="divide-y divide-white/5">
105+
<Link
106+
href="/profile"
107+
className="flex w-full items-center justify-start px-3 py-2 text-sm text-white/90 transition-colors hover:bg-[rgba(255,255,255,0.04)]"
108+
>
109+
Profile
110+
</Link>
111+
<Link
112+
href="/settings"
113+
className="flex w-full items-center justify-start px-3 py-2 text-sm text-white/90 transition-colors hover:bg-[rgba(255,255,255,0.04)]"
114+
>
115+
Settings
116+
</Link>
117+
<button
118+
onClick={logout}
119+
className="flex w-full items-center justify-start px-3 py-2 text-sm text-white/90 transition-colors hover:bg-[rgba(255,255,255,0.04)]"
120+
>
121+
Logout
122+
</button>
123+
</div>
122124
</motion.div>
123125
)}
124126
</AnimatePresence>
@@ -164,28 +166,30 @@ export const Header: React.FC = () => {
164166
animate={{ opacity: 1, y: 0 }}
165167
exit={{ opacity: 0, y: -10 }}
166168
transition={{ duration: 0.2 }}
167-
className="absolute left-0 top-[100%] z-30 w-48 overflow-hidden rounded border border-white/10 bg-background-1 shadow-lg"
169+
className="absolute left-0 top-[100%] z-30 w-48 overflow-hidden rounded-md border border-white/10 bg-[#171214]"
168170
>
169-
<button
170-
onClick={() => startGame('againstMaia')}
171-
className="flex w-full items-center justify-start px-3 py-2 text-sm hover:bg-background-2/60"
172-
>
173-
Play Maia
174-
</button>
175-
<button
176-
onClick={() => startGame('handAndBrain')}
177-
className="flex w-full items-center justify-start px-3 py-2 text-sm hover:bg-background-2/60"
178-
>
179-
Play Hand and Brain
180-
</button>
181-
<a
182-
className="flex w-full items-center justify-start px-3 py-2 text-sm hover:bg-background-2/60"
183-
href="https://lichess.org/@/maia1"
184-
target="_blank"
185-
rel="noreferrer"
186-
>
187-
Play Maia on Lichess
188-
</a>
171+
<div className="divide-y divide-white/5">
172+
<button
173+
onClick={() => startGame('againstMaia')}
174+
className="flex w-full items-center justify-start px-3 py-2 text-sm text-white/90 transition-colors hover:bg-[rgba(255,255,255,0.04)]"
175+
>
176+
Play Maia
177+
</button>
178+
<button
179+
onClick={() => startGame('handAndBrain')}
180+
className="flex w-full items-center justify-start px-3 py-2 text-sm text-white/90 transition-colors hover:bg-[rgba(255,255,255,0.04)]"
181+
>
182+
Play Hand and Brain
183+
</button>
184+
<a
185+
className="flex w-full items-center justify-start px-3 py-2 text-sm text-white/90 transition-colors hover:bg-[rgba(255,255,255,0.04)]"
186+
href="https://lichess.org/@/maia1"
187+
target="_blank"
188+
rel="noreferrer"
189+
>
190+
Play Maia on Lichess
191+
</a>
192+
</div>
189193
</motion.div>
190194
)}
191195
</AnimatePresence>
@@ -248,30 +252,32 @@ export const Header: React.FC = () => {
248252
animate={{ opacity: 1, y: 0 }}
249253
exit={{ opacity: 0, y: -10 }}
250254
transition={{ duration: 0.2 }}
251-
className="absolute left-0 top-[100%] z-30 w-32 overflow-hidden rounded border border-white/10 bg-background-1 shadow-lg"
255+
className="absolute left-0 top-[100%] z-30 w-32 overflow-hidden rounded-md border border-white/10 bg-[#171214]"
252256
>
253-
<Link
254-
href="/blog"
255-
className="flex w-full items-center justify-start px-3 py-2 text-sm hover:bg-background-2/60"
256-
>
257-
Blog
258-
</Link>
259-
<a
260-
target="_blank"
261-
rel="noreferrer"
262-
href="https://twitch.tv/maiachess"
263-
className="flex w-full items-center justify-start px-3 py-2 text-sm hover:bg-background-2/60"
264-
>
265-
Watch
266-
</a>
267-
<a
268-
target="_blank"
269-
rel="noreferrer"
270-
href="https://forms.gle/XYeoTJF4YgUu4Vq28"
271-
className="flex w-full items-center justify-start px-3 py-2 text-sm hover:bg-background-2/60"
272-
>
273-
Feedback
274-
</a>
257+
<div className="divide-y divide-white/5">
258+
<Link
259+
href="/blog"
260+
className="flex w-full items-center justify-start px-3 py-2 text-sm text-white/90 transition-colors hover:bg-[rgba(255,255,255,0.04)]"
261+
>
262+
Blog
263+
</Link>
264+
<a
265+
target="_blank"
266+
rel="noreferrer"
267+
href="https://twitch.tv/maiachess"
268+
className="flex w-full items-center justify-start px-3 py-2 text-sm text-white/90 transition-colors hover:bg-[rgba(255,255,255,0.04)]"
269+
>
270+
Watch
271+
</a>
272+
<a
273+
target="_blank"
274+
rel="noreferrer"
275+
href="https://forms.gle/XYeoTJF4YgUu4Vq28"
276+
className="flex w-full items-center justify-start px-3 py-2 text-sm text-white/90 transition-colors hover:bg-[rgba(255,255,255,0.04)]"
277+
>
278+
Feedback
279+
</a>
280+
</div>
275281
</motion.div>
276282
)}
277283
</AnimatePresence>

src/components/Leaderboard/LeaderboardEntry.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export const LeaderboardEntry = ({
2929

3030
const entryKey = `${typeId}-${display_name}-${index}`
3131
const isPopupVisible = activePopup === entryKey
32-
const isCurrentUser = user?.lichessId?.toLowerCase() === display_name.toLowerCase()
32+
const isCurrentUser =
33+
user?.lichessId?.toLowerCase() === display_name.toLowerCase()
3334

3435
let ratingKey:
3536
| 'regularRating'
@@ -133,12 +134,8 @@ export const LeaderboardEntry = ({
133134

134135
return (
135136
<div
136-
className={`group relative flex w-full items-center justify-between px-3 py-1 text-sm transition-colors duration-200 ${
137-
isCurrentUser
138-
? 'bg-yellow-500/10 hover:bg-yellow-500/15'
139-
: index % 2 === 0
140-
? 'bg-transparent hover:bg-white/3'
141-
: 'bg-white/3 hover:bg-white/5'
137+
className={`group relative flex w-full items-center justify-between px-3 py-1 text-sm transition-colors duration-200 hover:bg-white/[3%] ${
138+
isCurrentUser ? 'bg-yellow-500/10 hover:bg-yellow-500/15' : ''
142139
}`}
143140
onMouseEnter={() => setHover(true)}
144141
onMouseLeave={() => setHover(false)}
@@ -156,8 +153,8 @@ export const LeaderboardEntry = ({
156153
</div>
157154
<p className="text-sm font-medium text-white/95">{elo}</p>
158155
{isPopupVisible && stats && (
159-
<div className="absolute left-0 top-[100%] z-50 flex w-full max-w-[24rem] flex-col overflow-hidden rounded border border-white/20 bg-black backdrop-blur-sm">
160-
<div className="flex w-full justify-between border-b border-white/10 bg-black/40 px-3 py-2">
156+
<div className="absolute left-0 top-[100%] z-50 flex w-full max-w-[24rem] flex-col overflow-hidden rounded border border-white/20 bg-[#171214]">
157+
<div className="flex w-full justify-between border-b border-white/10 bg-[#171214] px-3 py-2">
161158
<p className="text-sm text-white/95">
162159
<span className="font-bold">{display_name}</span>&apos;s {type}{' '}
163160
Statistics

src/components/Settings/ChessboardSettings.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,25 @@ export const ChessboardSettings: React.FC = () => {
7676
return (
7777
<div className="from-white/8 to-white/4 flex flex-col gap-4 rounded-lg border border-white/10 bg-gradient-to-br px-5 pb-0 pt-5 backdrop-blur-md transition-all duration-300">
7878
<div className="flex flex-col items-start justify-between">
79-
<h3 className="text-lg font-semibold text-white/95">Chessboard Theme</h3>
79+
<h3 className="text-lg font-semibold text-white/95">
80+
Chessboard Theme
81+
</h3>
8082
<p className="text-sm text-white/70">
81-
Choose your preferred chessboard style. Changes will apply to all chess boards across the platform.
83+
Choose your preferred chessboard style. Changes will apply to all
84+
chess boards across the platform.
8285
</p>
8386
</div>
8487

8588
<div className="flex flex-col gap-4">
8689
{/* Theme Grid */}
87-
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8">
90+
<div className="flex flex-row flex-wrap justify-around gap-3">
8891
{ALL_THEMES.map((theme) => (
8992
<label
9093
key={theme}
9194
className={`group relative flex cursor-pointer select-none items-center justify-center overflow-hidden rounded-md border p-2 text-white/90 backdrop-blur-md transition-all duration-300 ${
9295
settings.chessboardTheme === theme
9396
? 'border-red-500/40 bg-gradient-to-br from-red-500/15 to-red-500/5 shadow-white/5'
94-
: 'border-white/10 bg-gradient-to-br from-white/8 to-white/4 hover:border-white/20 hover:from-white/12 hover:to-white/6 hover:shadow-md hover:shadow-white/5 hover:-translate-y-0.5'
97+
: 'from-white/8 to-white/4 hover:from-white/12 hover:to-white/6 border-white/10 bg-gradient-to-br hover:-translate-y-0.5 hover:border-white/20 hover:shadow-md hover:shadow-white/5'
9598
}`}
9699
>
97100
<input
@@ -103,7 +106,7 @@ export const ChessboardSettings: React.FC = () => {
103106
className="sr-only"
104107
/>
105108
<div
106-
className={`theme-preview-${theme} aspect-square h-16 w-16 overflow-hidden rounded`}
109+
className={`theme-preview-${theme} aspect-square h-16 min-h-16 w-16 min-w-16 overflow-hidden rounded`}
107110
>
108111
<Chessground
109112
contained
@@ -120,9 +123,13 @@ export const ChessboardSettings: React.FC = () => {
120123

121124
<div className="-mx-5 mt-1 border-t border-white/10 px-5 py-4 text-white/80">
122125
<div className="flex items-start gap-2">
123-
<span className="material-symbols-outlined inline !text-base text-white/70">info</span>
126+
<span className="material-symbols-outlined inline !text-base text-white/70">
127+
info
128+
</span>
124129
<p className="text-sm">
125-
Theme changes take effect immediately and will be remembered across browser sessions. Preview shows how the board will appear in games.
130+
Theme changes take effect immediately and will be remembered
131+
across browser sessions. Preview shows how the board will appear
132+
in games.
126133
</p>
127134
</div>
128135
</div>

src/components/Settings/SettingsPage.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,14 @@ export const SettingsPage: React.FC = () => {
5454
{/* Header */}
5555
<motion.div variants={itemVariants} className="flex flex-col gap-2">
5656
<div className="flex items-center gap-3">
57-
<span className="material-symbols-outlined text-4xl text-white/90">settings</span>
57+
<span className="material-symbols-outlined text-4xl text-white/90">
58+
settings
59+
</span>
5860
<h1 className="text-3xl font-bold text-white">Settings</h1>
5961
</div>
6062
<p className="text-white/70">
61-
Customize your Maia Chess experience. Settings are saved locally in your browser.
63+
Customize your Maia Chess experience. Settings are saved locally in
64+
your browser.
6265
</p>
6366
</motion.div>
6467

0 commit comments

Comments
 (0)