Skip to content

Commit e6384a6

Browse files
feat: overhaul opening book modal
1 parent 4e966f9 commit e6384a6

4 files changed

Lines changed: 293 additions & 295 deletions

File tree

src/components/Board/BoardController.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface Props {
1414
goToRootNode: () => void
1515
gameTree: GameTree
1616
setCurrentMove?: (move: [string, string] | null) => void
17+
disableFlip?: boolean
1718
}
1819

1920
export const BoardController: React.FC<Props> = ({
@@ -27,6 +28,7 @@ export const BoardController: React.FC<Props> = ({
2728
goToRootNode,
2829
gameTree,
2930
setCurrentMove,
31+
disableFlip = false,
3032
}: Props) => {
3133
const { width } = useWindowSize()
3234

@@ -97,7 +99,7 @@ export const BoardController: React.FC<Props> = ({
9799
if (hasPrevious) getFirst()
98100
break
99101
case 'f':
100-
toggleBoardOrientation()
102+
if (!disableFlip) toggleBoardOrientation()
101103
break
102104
default:
103105
}
@@ -119,7 +121,8 @@ export const BoardController: React.FC<Props> = ({
119121
return (
120122
<div className="flex w-full flex-row items-center gap-[1px] md:rounded">
121123
<button
122-
onClick={toggleBoardOrientation}
124+
onClick={disableFlip ? undefined : toggleBoardOrientation}
125+
disabled={disableFlip}
123126
className="flex h-7 flex-1 items-center justify-center bg-button-secondary transition duration-200 hover:bg-human-3 disabled:bg-button-secondary/40 md:rounded-sm"
124127
>
125128
{FlipIcon}

src/components/Openings/OpeningDrillSidebar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export const OpeningDrillSidebar: React.FC<Props> = ({
197197
goToNextNode={goToNextNode}
198198
goToPreviousNode={goToPreviousNode}
199199
goToRootNode={goToRootNode}
200+
disableFlip={true}
200201
/>
201202
</div>
202203
</div>

0 commit comments

Comments
 (0)