From 6e00db2119d0c2384a32030c235a91a7389dca4c Mon Sep 17 00:00:00 2001 From: Ashton Anderson Date: Thu, 3 Dec 2026 18:46:16 -0500 Subject: [PATCH] Drills: retry, skip the review, and a shuffled order From a player's feedback on Discord: - Retry: plays the same drill again from its start, during a drill, after it ends, and from its review. Replaces resetCurrentDrill, which nothing called and which started every drill from the opening position. - Skip review: the analysis notification's button stops the review and shows the drill's moves on the board, with Retry, Review (the analysis, if wanted after all) and Next Drill. Next Drill no longer runs the analysis first. A review left running stops when the drill is retried or left, and a drill is logged to the backend once. - Order: the queue is played in a shuffled order, each drill once before any comes again (src/lib/drillOrder.ts). It used to start at the same place every time, so a category of 600 endgames began with the same few. New events: drill_retried and drill_review_skipped. Co-Authored-By: Claude Opus 5.5 --- .../Analysis/AnalysisNotification.tsx | 27 +- .../Openings/DrillPerformanceModal.tsx | 22 ++ src/constants/materialSymbols.ts | 1 + .../useOpeningDrillController.ts | 249 ++++++++++-------- src/lib/analytics.ts | 27 ++ src/lib/drillOrder.test.ts | 24 ++ src/lib/drillOrder.ts | 23 ++ src/pages/openings/index.tsx | 60 +++-- 8 files changed, 300 insertions(+), 133 deletions(-) create mode 100644 src/lib/drillOrder.test.ts create mode 100644 src/lib/drillOrder.ts diff --git a/src/components/Analysis/AnalysisNotification.tsx b/src/components/Analysis/AnalysisNotification.tsx index d03e3f34..1a32ee9d 100644 --- a/src/components/Analysis/AnalysisNotification.tsx +++ b/src/components/Analysis/AnalysisNotification.tsx @@ -5,11 +5,15 @@ import { DeepAnalysisProgress } from 'src/types/analysis' interface Props { progress: DeepAnalysisProgress onCancel: () => void + // A word for the cancel button, shown beside it (the drills' "Skip + // review"); without one, just the close icon. + cancelLabel?: string } export const AnalysisNotification: React.FC = ({ progress, onCancel, + cancelLabel, }) => { const hasTotals = progress.totalMoves > 0 const progressPercentage = hasTotals @@ -47,13 +51,22 @@ export const AnalysisNotification: React.FC = ({ - + {cancelLabel ? ( + + ) : ( + + )}
diff --git a/src/components/Openings/DrillPerformanceModal.tsx b/src/components/Openings/DrillPerformanceModal.tsx index 2c7a56f5..8dea8d81 100644 --- a/src/components/Openings/DrillPerformanceModal.tsx +++ b/src/components/Openings/DrillPerformanceModal.tsx @@ -39,6 +39,7 @@ interface Props { performanceData: DrillPerformanceData onContinueAnalyzing: () => void onNextDrill: () => void + onRetry: () => void onReconfigureDrills: () => void } @@ -769,6 +770,7 @@ const DesktopLayout: React.FC<{ performanceData: DrillPerformanceData onContinueAnalyzing: () => void onNextDrill: () => void + onRetry: () => void onReconfigureDrills: () => void gameTree: GameTree openingEndNode: GameNode @@ -788,6 +790,7 @@ const DesktopLayout: React.FC<{ performanceData, onContinueAnalyzing, onNextDrill, + onRetry, onReconfigureDrills, gameTree, openingEndNode, @@ -1064,6 +1067,13 @@ const DesktopLayout: React.FC<{ {/* Action Buttons */}
+
) : null - const renderDrillActionButtons = (fullWidth = false) => ( -
+ // Two to a row; one left on its own takes the whole row. + const drillButtonClass = + 'min-w-[45%] flex-1 rounded-md px-3 py-2 text-sm font-medium transition-colors' + const quietDrillButtonClass = `${drillButtonClass} border border-glass-border bg-white/5 text-white/90 hover:bg-white/10` + + const retryDrillButton = ( + + ) + + const renderDrillActionButtons = () => ( +
{controller.isAwaitingExtensionDecision && !controller.showPerformanceModal && !controller.continueAnalyzingMode && ( @@ -1078,17 +1094,20 @@ const OpeningsPage: NextPage = () => { !controller.showPerformanceModal && ( )} + {!controller.showPerformanceModal && + !controller.continueAnalyzingMode && + retryDrillButton} {!controller.currentPerformanceData && !controller.showPerformanceModal && !controller.continueAnalyzingMode && ( @@ -1097,7 +1116,7 @@ const OpeningsPage: NextPage = () => { !controller.continueAnalyzingMode && ( @@ -1105,20 +1124,21 @@ const OpeningsPage: NextPage = () => {
) - const renderPostDrillAnalysisButtons = (fullWidth = false) => + // After the drill: its review (the analysis, if it was skipped), the same + // drill again, or the next. + const renderPostDrillAnalysisButtons = () => controller.continueAnalyzingMode ? ( -
- {controller.currentPerformanceData && ( - - )} +
+ {retryDrillButton} + @@ -1371,7 +1391,7 @@ const OpeningsPage: NextPage = () => {
{renderDrillProgress()} - {renderDrillActionButtons(true)} + {renderDrillActionButtons()}
@@ -1850,7 +1870,7 @@ const OpeningsPage: NextPage = () => { )} {/* Action Buttons */} - {renderPostDrillAnalysisButtons(true)} + {renderPostDrillAnalysisButtons()} {/* Analysis Components Stacked */}
@@ -2031,6 +2051,7 @@ const OpeningsPage: NextPage = () => { performanceData={controller.currentPerformanceData} onContinueAnalyzing={controller.continueAnalyzing} onNextDrill={controller.moveToNextDrill} + onRetry={controller.retryCurrentDrill} onReconfigureDrills={handleReconfigureDrills} /> )} @@ -2044,6 +2065,7 @@ const OpeningsPage: NextPage = () => { )}