1
1
import Link from 'next/link'
2
- import { useCallback , useContext , useEffect , useState } from 'react'
2
+ import { useCallback , useContext } from 'react'
3
3
4
4
import {
5
5
SunIcon ,
@@ -8,9 +8,10 @@ import {
8
8
TuringIcon ,
9
9
TrainIcon ,
10
10
RegularPlayIcon ,
11
+ ChessboardIcon ,
12
+ StarIcon ,
11
13
} from 'src/components/Icons/icons'
12
14
import { PlayType } from 'src/types'
13
- import { getPlayerStats } from 'src/api/home'
14
15
import { AuthContext , ModalContext } from 'src/contexts'
15
16
16
17
interface Props {
@@ -29,154 +30,147 @@ export const HomeHero: React.FC<Props> = ({ scrollHandler }: Props) => {
29
30
30
31
const { user, connectLichess } = useContext ( AuthContext )
31
32
32
- const [ stats , setStats ] = useState ( {
33
- regularRating : 1500 ,
34
- handRating : 1500 ,
35
- brainRating : 1500 ,
36
- trainRating : 1500 ,
37
- botNotRating : 1500 ,
38
- } )
39
- useEffect ( ( ) => {
40
- ; ( async ( ) => {
41
- setStats ( await getPlayerStats ( ) )
42
- } ) ( )
43
- } , [ ] )
44
-
45
- const profileContent = (
46
- < >
47
- < div className = "flex flex-row items-center gap-2" >
48
- < i className = "*:h-7 *:w-7 *:fill-primary" > { UserIcon } </ i >
49
- < p > { user ?. displayName || 'Guest' } </ p >
50
- </ div >
51
- { user ?. lichessId ? (
52
- < div className = "flex flex-row items-center gap-6" >
53
- { [
54
- [ 'Regular' , stats . regularRating || '...' ] ,
55
- [ 'Hand' , stats . handRating || '...' ] ,
56
- [ 'Brain' , stats . brainRating || '...' ] ,
57
- [ 'Puzzles' , stats . trainRating || '...' ] ,
58
- [ 'Bot/Not' , stats . botNotRating || '...' ] ,
59
- ] . map ( ( [ title , rating ] ) => (
60
- < div key = { title } className = "flex flex-col items-center gap-0.5" >
61
- < div className = "text-xs uppercase" > { title } </ div >
62
- < div className = "text-xl" > { rating } </ div >
63
- </ div >
64
- ) ) }
65
- </ div >
66
- ) : (
67
- < div className = "flex flex-col items-center justify-center" >
68
- < button
69
- className = "rounded-sm bg-[#629924] px-2 py-1 text-sm text-white transition duration-200 hover:bg-opacity-80"
70
- onClick = { ( ) => connectLichess ( ) }
71
- >
72
- Connect with Lichess
73
- </ button >
74
- < p className = "text-sm" > to save your stats and more!</ p >
75
- </ div >
76
- ) }
77
- </ >
78
- )
79
-
80
33
return (
81
- < div className = "relative flex flex-col items-center justify-center" >
82
- < BetaBlurb />
83
- < div className = "flex w-full max-w-[1200px] flex-col items-center justify-center gap-16 p-4 text-left md:flex-row" >
84
- < div className = "flex w-full flex-col items-start justify-center gap-2 md:w-[40%]" >
85
- < div className = "flex flex-col" >
86
- < h1 className = "text-4xl font-bold leading-relaxed " >
34
+ < div className = "relative flex flex-col items-center justify-center pb-16 pt-24 md:pb-28 md:pt-36 " >
35
+ { /* <BetaBlurb /> */ }
36
+ < div className = "flex w-full max-w-[1200px] flex-col items-center justify-center gap-16 p-4 text-left md:flex-row md:gap-20 " >
37
+ < div className = "flex w-full flex-col items-start justify-center gap-8 md:w-[40%]" >
38
+ < div className = "flex flex-col gap-4 " >
39
+ < h1 className = "text-4xl font-bold leading-tight md:text-5xl " >
87
40
A human-like chess engine
88
41
</ h1 >
89
- < p className = "text-2xl" >
42
+ < p className = "text-xl text-primary/80 md:text- 2xl" >
90
43
Maia is a neural network chess engine with a more human-like
91
44
style, trained from online human games.
92
45
</ p >
93
46
</ div >
94
- < button
95
- className = "flex items-center gap-4 rounded-sm bg-background-2 px-4 py-3 hover:bg-human-4/30"
96
- onClick = { scrollHandler }
97
- >
98
- < p > More about Maia</ p >
99
- < i className = "h-4" > { ArrowIcon } </ i >
100
- </ button >
47
+ < div className = "flex flex-col gap-4 sm:flex-row" >
48
+ < button
49
+ className = "flex items-center justify-center gap-2 rounded-md bg-human-3 px-6 py-3 text-white transition duration-200 hover:bg-opacity-90"
50
+ onClick = { scrollHandler }
51
+ >
52
+ < p > Learn More</ p >
53
+ < i className = "h-4" > { ArrowIcon } </ i >
54
+ </ button >
55
+ { ! user ?. lichessId && (
56
+ < button
57
+ className = "flex items-center justify-center gap-2 rounded-md border border-background-2 bg-background-1 px-6 py-3 transition duration-200 hover:bg-background-2"
58
+ onClick = { ( ) => connectLichess ( ) }
59
+ >
60
+ Connect with Lichess
61
+ </ button >
62
+ ) }
63
+ </ div >
101
64
</ div >
102
- < div className = "grid w-full flex-1 grid-cols-1 gap-5 pb-4 md:w-auto md:grid-cols-2" >
65
+
66
+ < div className = "grid w-full flex-1 grid-cols-1 gap-4 md:grid-cols-3" >
67
+ { /* All boxes in a single grid */ }
103
68
{ user ?. lichessId ? (
104
69
< button
105
70
onClick = { ( ) => startGame ( 'againstMaia' ) }
106
- className = "flex cursor-pointer select-none flex-col items-center justify-center gap-2 rounded-sm border-none bg-[#7095c7] py-6 text-center text-white transition duration-200 hover:bg-opacity-80 "
71
+ className = "flex h-full min-h-[140px] cursor-pointer select-none flex-col items-center justify-center gap-3 rounded-md border-none bg-background-2 p-4 text-center transition duration-200 hover:bg-human-4/20 "
107
72
>
108
- < i className = "w-12 " >
73
+ < i className = "w-10 " >
109
74
< RegularPlayIcon />
110
75
</ i >
111
76
< div className = "flex flex-col" >
112
- < h2 className = "text-xl font-bold" > Play Maia</ h2 >
113
- < p className = "text-xs" > Classic chess versus human-like Maia</ p >
77
+ < h2 className = "text-lg font-bold" > Play Maia</ h2 >
78
+ < p className = "h-10 text-xs" >
79
+ Play chess against the human-like Maia engine
80
+ </ p >
114
81
</ div >
115
82
</ button >
116
83
) : (
117
84
< a
118
85
href = "https://lichess.org/@/maia1"
119
86
target = "_blank"
120
87
rel = "noreferrer"
121
- className = "flex cursor-pointer select-none flex-col items-center justify-center gap-2 rounded-sm border-none bg-[#7095c7] py-6 text-center text-white transition duration-200 hover:bg-opacity-80 "
88
+ className = "flex h-full min-h-[140px] cursor-pointer select-none flex-col items-center justify-center gap-3 rounded-md border-none bg-background-2 p-4 text-center transition duration-200 hover:bg-human-4/20 "
122
89
>
123
- < i className = "w-12 " >
90
+ < i className = "w-10 " >
124
91
< RegularPlayIcon />
125
92
</ i >
126
93
< div className = "flex flex-col" >
127
- < h2 className = "text-xl font-bold" > Play Maia</ h2 >
128
- < p className = "text-xs" > Classic chess versus human-like Maia</ p >
94
+ < h2 className = "text-lg font-bold" > Play Maia</ h2 >
95
+ < p className = "h-10 text-xs" >
96
+ Play chess against the human-like Maia engine
97
+ </ p >
129
98
</ div >
130
99
</ a >
131
100
) }
101
+ < Link
102
+ href = "/analysis"
103
+ className = "flex h-full min-h-[140px] cursor-pointer select-none flex-col items-center justify-center gap-3 rounded-md border-none bg-background-2 p-4 text-center transition duration-200 hover:bg-human-4/20"
104
+ >
105
+ < i className = "w-10" >
106
+ < ChessboardIcon />
107
+ </ i >
108
+ < div className = "flex flex-col" >
109
+ < h2 className = "text-lg font-bold" > Analysis</ h2 >
110
+ < p className = "h-10 text-xs" >
111
+ Analyze games with Maia's human-like insights
112
+ </ p >
113
+ </ div >
114
+ </ Link >
115
+ < Link
116
+ href = "/train"
117
+ className = "flex h-full min-h-[140px] cursor-pointer select-none flex-col items-center justify-center gap-3 rounded-md border-none bg-background-2 p-4 text-center transition duration-200 hover:bg-human-4/20"
118
+ >
119
+ < i className = "w-10" >
120
+ < TrainIcon />
121
+ </ i >
122
+ < div className = "flex flex-col" >
123
+ < h2 className = "text-lg font-bold" > Train</ h2 >
124
+ < p className = "h-10 text-xs" >
125
+ Improve your skills with Maia's training puzzles
126
+ </ p >
127
+ </ div >
128
+ </ Link >
129
+
132
130
< button
133
131
onClick = { ( ) => startGame ( 'handAndBrain' ) }
134
- className = "flex cursor-pointer select-none flex-col items-center justify-center gap-2 rounded-sm border-none bg-[#6e879c] py-6 text-center text-white transition duration-200 hover:bg-opacity-80 "
132
+ className = "flex h-full min-h-[140px] cursor-pointer select-none flex-col items-center justify-center gap-3 rounded-md border-none bg-background-2 p-4 text-center transition duration-200 hover:bg-human-4/20 "
135
133
>
136
- < i className = "w-12 " >
134
+ < i className = "w-8 " >
137
135
< TuringIcon />
138
136
</ i >
139
137
< div className = "flex flex-col" >
140
- < h2 className = "text-xl font-bold" > Play Hand and Brain</ h2 >
141
- < p className = "text-xs" > A chess variant with Maia on your team</ p >
138
+ < h2 className = "text-base font-bold" > Hand & Brain</ h2 >
139
+ < p className = "h-10 text-xs" >
140
+ Play a collaborative chess variant with Maia
141
+ </ p >
142
142
</ div >
143
143
</ button >
144
+
144
145
< Link
145
- href = "/train "
146
- className = "flex cursor-pointer select-none flex-col items-center justify-center gap-2 rounded-sm border-none bg-[#958a6d] py-6 text-center text-white transition duration-200 hover:bg-opacity-80 "
146
+ href = "/openings "
147
+ className = "flex h-full min-h-[140px] cursor-pointer select-none flex-col items-center justify-center gap-3 rounded-md border-none bg-background-2 p-4 text-center transition duration-200 hover:bg-human-4/20 "
147
148
>
148
- < i className = "w-12 " >
149
- < TrainIcon />
149
+ < i className = "w-8 " >
150
+ < StarIcon />
150
151
</ i >
151
152
< div className = "flex flex-col" >
152
- < h2 className = "text-xl font-bold" > Train</ h2 >
153
- < p className = "text-xs" > Solve puzzles with Maia</ p >
153
+ < h2 className = "text-base font-bold" > Openings</ h2 >
154
+ < p className = "h-10 text-xs" >
155
+ Learn and practice chess openings with Maia
156
+ </ p >
154
157
</ div >
155
158
</ Link >
159
+
156
160
< Link
157
161
href = "/turing"
158
- className = "flex cursor-pointer select-none flex-col items-center justify-center gap-2 rounded-sm border-none bg-[#a3a6a1] py-6 text-center text-white transition duration-200 hover:bg-opacity-80 "
162
+ className = "flex h-full min-h-[140px] cursor-pointer select-none flex-col items-center justify-center gap-3 rounded-md border-none bg-background-2 p-4 text-center transition duration-200 hover:bg-human-4/20 "
159
163
>
160
- < i className = "w-12 " >
164
+ < i className = "w-8 " >
161
165
< TuringIcon />
162
166
</ i >
163
167
< div className = "flex flex-col" >
164
- < h2 className = "text-xl font-bold" > Bot-or-Not</ h2 >
165
- < p className = "text-xs" > Distinguish human from machine play</ p >
168
+ < h2 className = "text-base font-bold" > Bot-or-Not</ h2 >
169
+ < p className = "h-10 text-xs" >
170
+ Test your ability to distinguish human from AI play
171
+ </ p >
166
172
</ div >
167
173
</ Link >
168
- { user ?. lichessId ? (
169
- < Link
170
- href = "/profile"
171
- className = "flex w-full flex-col items-start justify-between gap-4 rounded-sm bg-background-2 px-6 py-4 transition duration-200 hover:bg-human-4/20 md:col-span-2 md:h-20 md:flex-row md:items-center md:gap-0 md:py-0"
172
- >
173
- { profileContent }
174
- </ Link >
175
- ) : (
176
- < div className = "flex w-full flex-row items-center justify-between rounded-sm bg-background-2 px-6 py-4 md:col-span-2 md:h-20 md:py-0" >
177
- { profileContent }
178
- </ div >
179
- ) }
180
174
</ div >
181
175
</ div >
182
176
</ div >
0 commit comments