@@ -33,20 +33,24 @@ const TOGGLEABLE_RULES: ToggleableRule[] = [
3333 } ,
3434 {
3535 key : 'relance' ,
36- label : 'Relance (Double 1) ' ,
36+ label : 'Relance' ,
3737 desc : 'Score 1•1 → le joueur peut relancer ses dés une fois' ,
3838 } ,
3939 {
4040 key : 'marchandSable' ,
4141 label : 'Marchand de sable' ,
42- desc : 'Score de 3 (1+2) → immunité contre les gorgées ce tour' ,
42+ desc : 'Score de 3 (1•2) → immunité contre les gorgées ce tour' ,
43+ } ,
44+ {
45+ key : 'legende' ,
46+ label : 'Légende' ,
47+ desc : 'Score de 11 (5•6) → tous les joueurs avec un dé à 5 ou 6 boivent 1 gorgée' ,
4348 } ,
4449] ;
4550
4651const DISABLED_RULES : DisabledRule [ ] = [
4752 { label : 'Jeton' , desc : 'Score de 7 → boit 1 gorgée' } ,
4853 { label : 'Jackpot' , desc : 'Trois joueurs à 7 → relance pour distribuer un pot' } ,
49- { label : 'Légende' , desc : 'Score de 11 (5+6) → joueurs avec dé à 5 ou 6 boivent' } ,
5054 { label : 'Démon' , desc : 'Trois joueurs à 6 → relance pour distribuer un pot' } ,
5155] ;
5256
@@ -59,6 +63,7 @@ const DEFAULT_RULES: RulesConfig = {
5963 double : true ,
6064 relance : false ,
6165 marchandSable : true ,
66+ legende : false ,
6267} ;
6368
6469// ---- Rules Config Dialog ----
@@ -95,55 +100,70 @@ function RulesConfigDialog({
95100
96101 < div className = "flex flex-col gap-5 px-5 py-4" >
97102 { /* Règles activables */ }
98- < div className = "flex flex-col gap-3 " >
103+ < div className = "flex flex-col gap-2 " >
99104 < p className = "text-xs font-semibold text-muted-foreground uppercase tracking-wide" >
100105 Règles optionnelles
101106 </ p >
102107 { TOGGLEABLE_RULES . map ( rule => (
103- < label key = { rule . key } className = "flex items-start gap-3 cursor-pointer select-none" >
104- < input
105- type = "checkbox"
106- checked = { rules [ rule . key ] }
107- onChange = { ( ) => onToggle ( rule . key ) }
108- className = "mt-0.5 accent-primary shrink-0 w-4 h-4"
109- />
110- < div >
108+ < button
109+ key = { rule . key }
110+ type = "button"
111+ onClick = { ( ) => onToggle ( rule . key ) }
112+ className = { `flex items-center gap-3 w-full text-left rounded-xl px-3 py-3 transition-colors select-none ${
113+ rules [ rule . key ]
114+ ? 'bg-primary/10 ring-1 ring-primary/30'
115+ : 'bg-muted/50 ring-1 ring-transparent'
116+ } `}
117+ >
118+ < div className = "flex-1 min-w-0" >
111119 < p className = "text-sm font-medium leading-tight" > { rule . label } </ p >
112120 < p className = "text-xs text-muted-foreground mt-0.5" > { rule . desc } </ p >
113121 </ div >
114- </ label >
122+ { /* Toggle switch */ }
123+ < div
124+ className = { `relative shrink-0 w-11 h-6 rounded-full transition-colors duration-200 ${
125+ rules [ rule . key ] ? 'bg-primary' : 'bg-foreground/20'
126+ } `}
127+ >
128+ < div
129+ className = { `absolute top-0.5 w-5 h-5 bg-white rounded-full shadow transition-transform duration-200 ${
130+ rules [ rule . key ] ? 'translate-x-5' : 'translate-x-0.5'
131+ } `}
132+ />
133+ </ div >
134+ </ button >
115135 ) ) }
116136 </ div >
117137
118138 < Separator />
119139
120140 { /* Règles désactivées */ }
121- < div className = "flex flex-col gap-3 " >
141+ < div className = "flex flex-col gap-2 " >
122142 < p className = "text-xs font-semibold text-muted-foreground uppercase tracking-wide" >
123143 Bientôt disponible
124144 </ p >
125- < div className = "flex flex-col gap-2" >
126- { DISABLED_RULES . map ( rule => (
127- < label
128- key = { rule . label }
129- className = "flex items-start gap-3 opacity-40 cursor-not-allowed select-none"
130- >
131- < input type = "checkbox" disabled className = "mt-0.5 shrink-0 w-4 h-4" />
132- < div >
133- < p className = "text-sm font-medium leading-tight" > { rule . label } </ p >
134- < p className = "text-xs text-muted-foreground mt-0.5" > { rule . desc } </ p >
135- </ div >
136- </ label >
137- ) ) }
138- < label className = "flex items-start gap-3 opacity-60 cursor-not-allowed select-none" >
139- < input type = "checkbox" disabled className = "mt-0.5 shrink-0 w-4 h-4" />
140- < div >
141- < p className = "text-sm font-medium leading-tight text-destructive" >
142- { HARD_RULE . label }
143- </ p >
144- < p className = "text-xs text-destructive/70 mt-0.5" > { HARD_RULE . desc } </ p >
145+ { DISABLED_RULES . map ( rule => (
146+ < div
147+ key = { rule . label }
148+ className = "flex items-center gap-3 rounded-xl px-3 py-3 bg-muted/30 opacity-40"
149+ >
150+ < div className = "flex-1 min-w-0" >
151+ < p className = "text-sm font-medium leading-tight" > { rule . label } </ p >
152+ < p className = "text-xs text-muted-foreground mt-0.5" > { rule . desc } </ p >
153+ </ div >
154+ < div className = "relative shrink-0 w-11 h-6 rounded-full bg-foreground/20" >
155+ < div className = "absolute top-0.5 translate-x-0.5 w-5 h-5 bg-white rounded-full shadow" />
145156 </ div >
146- </ label >
157+ </ div >
158+ ) ) }
159+ < div className = "flex items-center gap-3 rounded-xl px-3 py-3 bg-destructive/5 opacity-50" >
160+ < div className = "flex-1 min-w-0" >
161+ < p className = "text-sm font-medium leading-tight text-destructive" > { HARD_RULE . label } </ p >
162+ < p className = "text-xs text-destructive/70 mt-0.5" > { HARD_RULE . desc } </ p >
163+ </ div >
164+ < div className = "relative shrink-0 w-11 h-6 rounded-full bg-destructive/20" >
165+ < div className = "absolute top-0.5 translate-x-0.5 w-5 h-5 bg-white rounded-full shadow" />
166+ </ div >
147167 </ div >
148168 </ div >
149169 </ div >
0 commit comments