Skip to content

Commit a08d024

Browse files
feat: make landing page more responsive + clean up code
1 parent c2164a9 commit a08d024

File tree

8 files changed

+40
-53
lines changed

8 files changed

+40
-53
lines changed

Diff for: src/components/Home/AboutMaia.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export const AboutMaia = () => {
100100
className="relative flex flex-col items-center justify-center bg-background-1 py-20 text-center"
101101
ref={projectRef}
102102
>
103-
<div className="flex max-w-3xl flex-col items-center justify-center">
103+
<div className="flex max-w-3xl flex-col items-center justify-center px-4 md:px-0">
104104
<h3 className="text-xs font-bold uppercase tracking-wide">
105105
Human-AI Collaboration for Chess
106106
</h3>
@@ -161,7 +161,7 @@ export const AboutMaia = () => {
161161
<div className="m-auto box-border w-auto px-4 md:w-2/3">
162162
<h3 className="text-center text-xl font-bold uppercase">Team</h3>
163163
</div>
164-
<div className="mx-auto grid max-w-[1200px] grid-cols-1 gap-x-2 gap-y-12 px-4 text-center sm:grid-cols-2 md:grid-cols-4">
164+
<div className="mx-auto grid max-w-[1200px] grid-cols-2 gap-x-2 gap-y-8 px-4 text-center sm:grid-cols-2 md:grid-cols-4 md:gap-y-12">
165165
{teamMembers.map((member, index) => (
166166
<TeamMember key={member.name} {...member} index={index} />
167167
))}
@@ -176,7 +176,7 @@ export const AboutMaia = () => {
176176
<h3 className="text-center text-xl font-bold uppercase">
177177
Acknowledgments
178178
</h3>
179-
<p className="max-w-4xl text-center text-primary/90">
179+
<p className="max-w-4xl px-4 text-center text-primary/90">
180180
Many thanks to Lichess.org for providing the human games that we
181181
trained on and hosting our Maia models that you can play against.
182182
Ashton Anderson was supported in part by an NSERC grant, a Microsoft

Diff for: src/components/Home/HomeHero.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const FeatureCard: React.FC<FeatureCardProps> = ({
100100
{title}
101101
</motion.h2>
102102
<motion.p
103-
className="h-10 text-xs"
103+
className="text-xs"
104104
initial={{ opacity: 0 }}
105105
animate={{ opacity: 1 }}
106106
transition={{
@@ -128,10 +128,10 @@ export const HomeHero: React.FC<Props> = ({ scrollHandler }: Props) => {
128128
)
129129

130130
return (
131-
<div className="relative flex flex-col items-center justify-center overflow-hidden pb-16 pt-24 md:pb-28 md:pt-36">
132-
<div className="z-10 flex w-full max-w-[1200px] flex-col items-center justify-center gap-16 p-4 text-left md:flex-row md:gap-20">
133-
<div className="flex w-full flex-col items-start justify-center gap-8 md:w-[40%]">
134-
<div className="flex flex-col gap-4">
131+
<div className="relative flex flex-col items-center justify-center overflow-hidden pb-12 pt-16 md:pb-28 md:pt-36">
132+
<div className="z-10 flex w-full max-w-[1200px] flex-col items-center justify-center gap-10 p-4 text-left md:flex-row md:gap-20">
133+
<div className="flex w-full flex-col items-start justify-center gap-6 md:w-[40%] md:gap-8">
134+
<div className="flex flex-col gap-3 md:gap-4">
135135
<motion.h1
136136
className="text-4xl font-bold leading-tight md:text-5xl"
137137
initial={{ opacity: 0, y: -20 }}

Diff for: src/components/Home/Sections/AdditionalFeaturesSection.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ const FeatureCard = ({
9797

9898
const SectionHeader = () => {
9999
return (
100-
<div className="mb-14 max-w-3xl text-left">
100+
<div className="mb-8 max-w-3xl text-left md:mb-14">
101101
<div className="mb-2 inline-block rounded-full bg-human-3/10 px-4 py-1 text-sm font-medium text-human-3">
102102
More Features
103103
</div>
104-
<h2 className="mb-4 text-3xl font-bold md:text-4xl lg:text-5xl">
104+
<h2 className="mb-3 text-2xl font-bold md:mb-4 md:text-3xl md:text-4xl lg:text-5xl">
105105
Explore other ways to use Maia
106106
</h2>
107-
<p className="max-w-2xl text-lg text-primary/80">
107+
<p className="max-w-2xl text-base text-primary/80 md:text-lg">
108108
Maia offers a range of innovative tools to help you understand human
109109
chess and improve your skills
110110
</p>
@@ -162,13 +162,13 @@ export const AdditionalFeaturesSection = ({
162162
return (
163163
<section
164164
id={id}
165-
className="relative w-full flex-col items-center overflow-hidden bg-background-1 py-16"
165+
className="relative w-full flex-col items-center overflow-hidden bg-background-1 py-10 md:py-16"
166166
ref={ref}
167167
>
168-
<div className="mx-auto flex w-full max-w-[90%] flex-col px-4">
168+
<div className="mx-auto flex w-full max-w-[95%] flex-col px-2 md:max-w-[90%] md:px-4">
169169
<SectionHeader />
170170
<motion.div
171-
className="grid gap-6 md:grid-cols-3"
171+
className="grid gap-4 md:grid-cols-3 md:gap-6"
172172
variants={animationVariants.container}
173173
initial="hidden"
174174
animate={inView ? 'visible' : 'hidden'}

Diff for: src/components/Home/Sections/AnalysisSection.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ export const AnalysisSection = ({ id }: AnalysisSectionProps) => {
6363
return (
6464
<section
6565
id={id}
66-
className="relative flex w-full flex-col items-center justify-center overflow-hidden bg-background-1 py-8"
66+
className="relative flex w-full flex-col items-center justify-center overflow-hidden bg-background-1 py-6 md:py-8"
6767
ref={ref}
6868
>
69-
<div className="mx-auto flex w-full max-w-[90%] flex-col-reverse items-center px-4 md:flex-row md:gap-8 lg:gap-12">
69+
<div className="mx-auto flex w-full max-w-[95%] flex-col-reverse items-center px-2 md:max-w-[90%] md:flex-row md:gap-8 md:px-4 lg:gap-12">
7070
<motion.div
71-
className="relative mt-6 w-full md:mt-0 md:w-1/2"
71+
className="relative mt-4 w-full md:mt-0 md:mt-6 md:w-1/2"
7272
initial={{ opacity: 0, y: 20 }}
7373
animate={inView ? { opacity: 1, y: 0 } : { opacity: 0, y: 20 }}
7474
transition={{ duration: 0.4, ease: 'easeOut' }}

Diff for: src/components/Home/Sections/PlaySection.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@ export const PlaySection = ({ id }: PlaySectionProps) => {
4747
return (
4848
<section
4949
id={id}
50-
className="relative flex min-h-[80vh] w-full flex-col items-center justify-center overflow-hidden bg-background-1 py-16"
50+
className="relative flex min-h-[80vh] w-full flex-col items-center justify-center overflow-hidden bg-background-1 py-10 md:py-16"
5151
ref={ref}
5252
>
53-
<div className="mx-auto flex w-full max-w-[90%] flex-col items-center px-4 md:flex-row md:gap-12 lg:gap-16">
54-
<div className="mb-10 w-full md:mb-0 md:w-1/2">
55-
<div className="mb-4 inline-block rounded-full bg-human-3/10 px-4 py-1 text-sm font-medium text-human-3">
53+
<div className="mx-auto flex w-full max-w-[95%] flex-col items-center px-2 md:max-w-[90%] md:flex-row md:gap-12 md:px-4 lg:gap-16">
54+
<div className="mb-6 w-full md:mb-0 md:mb-10 md:w-1/2">
55+
<div className="mb-3 inline-block rounded-full bg-human-3/10 px-4 py-1 text-sm font-medium text-human-3 md:mb-4">
5656
Play Against Maia
5757
</div>
58-
<h2 className="mb-6 max-w-2xl text-3xl font-bold md:text-4xl lg:text-5xl">
58+
<h2 className="mb-4 max-w-2xl text-2xl font-bold md:mb-6 md:text-3xl md:text-4xl lg:text-5xl">
5959
Experience human-like chess AI
6060
</h2>
61-
<p className="mb-4 max-w-2xl text-lg text-primary/80">
61+
<p className="mb-3 max-w-2xl text-base text-primary/80 md:mb-4 md:text-lg">
6262
Challenge Maia, a neural network trained to play like humans of
6363
different ratings. Unlike traditional engines that play the best
6464
moves, Maia predicts and plays what a human would do.
6565
</p>
66-
<p className="mb-4 max-w-2xl text-lg text-primary/80">
66+
<p className="mb-3 max-w-2xl text-base text-primary/80 md:mb-4 md:text-lg">
6767
By learning from thousands of human games, Maia understands and
6868
replicates human chess patterns and decision-making styles.
6969
</p>

Diff for: src/components/Home/Sections/TrainSection.tsx

+9-24
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ interface TrainSectionProps {
1111
id: string
1212
}
1313

14-
// Mock move data by rating for visualization
1514
interface MovesByRatingData {
1615
rating: number
1716
bestMove: number
1817
commonMistake: number
1918
otherMistake: number
2019
}
2120

22-
// Define the structure of a puzzle
2321
interface ChessPuzzle {
2422
id: string
2523
fen: string
@@ -29,7 +27,6 @@ interface ChessPuzzle {
2927
difficulty: 'Beginner' | 'Intermediate' | 'Advanced'
3028
skill: string
3129
theme: string
32-
// Moves data for visualization
3330
ratingData: MovesByRatingData[]
3431
movesMapping: {
3532
bestMove: string
@@ -39,7 +36,6 @@ interface ChessPuzzle {
3936
explanation: string
4037
}
4138

42-
// Sample puzzle positions with detailed data
4339
const PUZZLES: ChessPuzzle[] = [
4440
{
4541
id: 'puzzle1',
@@ -172,10 +168,8 @@ export const TrainSection = ({ id }: TrainSectionProps) => {
172168
const [currentPuzzle, setCurrentPuzzle] = useState(0)
173169
const [shapes, setShapes] = useState<DrawShape[]>([])
174170

175-
// State for tracking resizing
176171
const [windowSize, setWindowSize] = useState({ width: 0, height: 0 })
177172

178-
// Handle window resize
179173
useEffect(() => {
180174
const handleResize = () => {
181175
setWindowSize({
@@ -184,20 +178,16 @@ export const TrainSection = ({ id }: TrainSectionProps) => {
184178
})
185179
}
186180

187-
// Set initial size
188181
handleResize()
189182

190183
window.addEventListener('resize', handleResize)
191184
return () => window.removeEventListener('resize', handleResize)
192185
}, [])
193186

194-
// Reset states when puzzle changes
195187
useEffect(() => {
196-
// Show the best move for each puzzle automatically
197188
setShapes([PUZZLES[currentPuzzle].bestMove])
198189
}, [currentPuzzle])
199190

200-
// Auto-rotate puzzles every 8 seconds
201191
useEffect(() => {
202192
if (!inView) return
203193

@@ -210,10 +200,8 @@ export const TrainSection = ({ id }: TrainSectionProps) => {
210200
}
211201
}, [inView])
212202

213-
// Add an animated indicator when changing puzzles
214203
useEffect(() => {
215-
// Force updates to the chessboard when puzzle changes
216-
const timeouts = [100, 200, 300, 500, 700, 1000] // staggered timeouts for multiple redraws
204+
const timeouts = [100, 200, 300, 500, 700, 1000]
217205
const timeoutIds = timeouts.map((timeout) =>
218206
setTimeout(() => {
219207
setShapes([PUZZLES[currentPuzzle].bestMove])
@@ -227,30 +215,29 @@ export const TrainSection = ({ id }: TrainSectionProps) => {
227215

228216
const puzzle = PUZZLES[currentPuzzle]
229217

230-
// Create a stable key that changes only when necessary
231218
const stableKey = `board-${currentPuzzle}-${windowSize.width}-${windowSize.height}`
232219

233220
return (
234221
<section
235222
id={id}
236-
className="relative w-full flex-col items-center overflow-hidden py-16"
223+
className="relative w-full flex-col items-center overflow-hidden py-10 md:py-16"
237224
ref={ref}
238225
>
239-
<div className="z-10 mx-auto flex w-full max-w-[90%] flex-col items-center px-4 md:flex-row md:gap-12 lg:gap-16">
240-
<div className="mb-10 w-full md:mb-0 md:w-2/5">
241-
<div className="mb-4 inline-block rounded-full bg-human-3/10 px-4 py-1 text-sm font-medium text-human-3">
226+
<div className="z-10 mx-auto flex w-full max-w-[95%] flex-col items-center px-2 md:max-w-[90%] md:flex-row md:gap-12 md:px-4 lg:gap-16">
227+
<div className="mb-6 w-full md:mb-0 md:mb-10 md:w-2/5">
228+
<div className="mb-3 inline-block rounded-full bg-human-3/10 px-4 py-1 text-sm font-medium text-human-3 md:mb-4">
242229
Human-Centered Puzzles
243230
</div>
244-
<h2 className="mb-6 text-3xl font-bold md:text-4xl lg:text-5xl">
231+
<h2 className="mb-4 text-2xl font-bold md:mb-6 md:text-3xl md:text-4xl lg:text-5xl">
245232
Learn from real player tendencies
246233
</h2>
247-
<p className="mb-4 text-lg text-primary/80">
234+
<p className="mb-3 text-base text-primary/80 md:mb-4 md:text-lg">
248235
Unlike traditional puzzles based on computer analysis, our puzzles
249236
highlight positions where human players typically struggle. We
250237
identify tactical opportunities that are commonly missed at
251238
different rating levels.
252239
</p>
253-
<p className="mb-4 text-lg text-primary/80">
240+
<p className="mb-3 text-base text-primary/80 md:mb-4 md:text-lg">
254241
Each puzzle includes data showing how players of different ratings
255242
approach the position, making your training more targeted and
256243
effective.
@@ -363,14 +350,12 @@ export const TrainSection = ({ id }: TrainSectionProps) => {
363350
check: true,
364351
},
365352
animation: {
366-
duration: 0, // Disable piece animations to prevent positioning issues
353+
duration: 0,
367354
},
368355
}}
369356
/>
370357

371-
{/* Add CSS to fix positioning */}
372358
<style jsx global>{`
373-
/* Make container full size */
374359
.cg-wrap {
375360
width: 100% !important;
376361
height: 100% !important;

Diff for: src/components/Home/TeamMember.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const TeamMember = ({
4242
>
4343
<Image
4444
src={image}
45-
className="h-40 w-40 rounded-full"
45+
className="h-32 w-32 rounded-full md:h-40 md:w-40"
4646
alt={`Picture of ${name}`}
4747
/>
4848
<div className="flex flex-col">
@@ -51,16 +51,18 @@ export const TeamMember = ({
5151
target="_blank"
5252
rel="noreferrer"
5353
href={website}
54-
className="text-xl text-human-3 transition duration-200 hover:text-human-4"
54+
className="text-lg text-human-3 transition duration-200 hover:text-human-4 md:text-xl"
5555
>
5656
{name}
5757
</a>
5858
) : (
59-
<span className="text-xl text-primary">{name}</span>
59+
<span className="text-base text-primary md:text-xl">{name}</span>
6060
)}
61-
<p className="text-base text-primary">{institution}</p>
61+
<p className="text-sm text-primary md:text-base">{institution}</p>
6262
<div className="mt-1 flex flex-col gap-2">
63-
<p className="text-sm font-semibold text-primary">{role}</p>
63+
<p className="text-xs font-semibold text-primary md:text-sm">
64+
{role}
65+
</p>
6466
<div className="flex items-center justify-center space-x-2">
6567
{website && (
6668
<a

Diff for: src/components/Home/people/russell.jpg

-33.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)