| 148 | type Mode = "current" | "next"; |
| 149 | |
| 150 | function ModeSwitch(props: { readonly mode: Mode; readonly onChange: (mode: Mode) => void }) { |
| 151 | const option = (mode: Mode, label: string) => ( |
| 152 | // oxlint-disable-next-line react/forbid-elements |
| 153 | <button |
| 154 | key={mode} |
| 155 | type="button" |
| 156 | onClick={() => props.onChange(mode)} |
| 157 | className={cn( |
| 158 | "rounded-full px-2.5 py-1 text-xs font-medium transition-colors", |
| 159 | props.mode === mode |
| 160 | ? "bg-foreground text-background" |
| 161 | : "text-muted-foreground hover:text-foreground", |
| 162 | )} |
| 163 | > |
| 164 | {label} |
| 165 | </button> |
| 166 | ); |
| 167 | return ( |
| 168 | <div className="fixed bottom-4 right-4 z-50 flex items-center gap-0.5 rounded-full border border-border bg-card/95 p-1 shadow-lg backdrop-blur-sm"> |
| 169 | {option("current", "Current")} |
| 170 | {option("next", "Reworked")} |
| 171 | </div> |
| 172 | ); |
| 173 | } |
| 174 | |
| 175 | const modeFromHash = (): Mode => { |
| 176 | const hash = globalThis.location?.hash ?? ""; |