Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions src/components/Analysis/AnalysisNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Props> = ({
progress,
onCancel,
cancelLabel,
}) => {
const hasTotals = progress.totalMoves > 0
const progressPercentage = hasTotals
Expand Down Expand Up @@ -47,13 +51,22 @@ export const AnalysisNotification: React.FC<Props> = ({
</span>
</div>

<button
onClick={onCancel}
className="flex h-8 w-8 flex-none items-center justify-center rounded-full border border-white/25 bg-white/10 text-white/70 transition-colors duration-150 hover:bg-white/20"
title="Cancel Analysis"
>
<span className="material-symbols-outlined !text-sm">close</span>
</button>
{cancelLabel ? (
<button
onClick={onCancel}
className="flex h-8 flex-none items-center justify-center rounded-full border border-white/25 bg-white/10 px-3 text-xs font-medium text-white/85 transition-colors duration-150 hover:bg-white/20"
>
{cancelLabel}
</button>
) : (
<button
onClick={onCancel}
className="flex h-8 w-8 flex-none items-center justify-center rounded-full border border-white/25 bg-white/10 text-white/70 transition-colors duration-150 hover:bg-white/20"
title="Cancel Analysis"
>
<span className="material-symbols-outlined !text-sm">close</span>
</button>
)}
</div>

<div className="flex flex-col px-4 pb-3">
Expand Down
22 changes: 22 additions & 0 deletions src/components/Openings/DrillPerformanceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ interface Props {
performanceData: DrillPerformanceData
onContinueAnalyzing: () => void
onNextDrill: () => void
onRetry: () => void
onReconfigureDrills: () => void
}

Expand Down Expand Up @@ -769,6 +770,7 @@ const DesktopLayout: React.FC<{
performanceData: DrillPerformanceData
onContinueAnalyzing: () => void
onNextDrill: () => void
onRetry: () => void
onReconfigureDrills: () => void
gameTree: GameTree
openingEndNode: GameNode
Expand All @@ -788,6 +790,7 @@ const DesktopLayout: React.FC<{
performanceData,
onContinueAnalyzing,
onNextDrill,
onRetry,
onReconfigureDrills,
gameTree,
openingEndNode,
Expand Down Expand Up @@ -1064,6 +1067,13 @@ const DesktopLayout: React.FC<{
{/* Action Buttons */}
<div className="border-t border-glass-border p-4">
<div className="flex gap-3">
<button
onClick={onRetry}
className="flex flex-1 items-center justify-center gap-1 rounded border border-glass-border bg-white/5 py-2 font-medium text-white/90 transition-colors hover:bg-white/10"
>
<span className="material-symbols-outlined !text-base">replay</span>
Retry
</button>
<button
onClick={onContinueAnalyzing}
className="flex-1 rounded bg-human-4 py-2 font-medium text-white transition-colors hover:bg-human-4/80"
Expand Down Expand Up @@ -1097,6 +1107,7 @@ const MobileLayout: React.FC<{
performanceData: DrillPerformanceData
onContinueAnalyzing: () => void
onNextDrill: () => void
onRetry: () => void
onReconfigureDrills: () => void
activeTab: 'replay' | 'analysis' | 'insights'
setActiveTab: (tab: 'replay' | 'analysis' | 'insights') => void
Expand All @@ -1118,6 +1129,7 @@ const MobileLayout: React.FC<{
performanceData,
onContinueAnalyzing,
onNextDrill,
onRetry,
onReconfigureDrills,
activeTab,
setActiveTab,
Expand Down Expand Up @@ -1286,6 +1298,13 @@ const MobileLayout: React.FC<{
{/* Action Buttons */}
<div className="border-t border-glass-border p-4">
<div className="flex gap-3">
<button
onClick={onRetry}
className="flex flex-1 items-center justify-center gap-1 rounded border border-glass-border bg-white/5 py-2 font-medium text-white/90 transition-colors hover:bg-white/10"
>
<span className="material-symbols-outlined !text-base">replay</span>
Retry
</button>
<button
onClick={onContinueAnalyzing}
className="flex-1 rounded bg-human-4 py-2 font-medium text-white transition-colors hover:bg-human-4/80"
Expand Down Expand Up @@ -1315,6 +1334,7 @@ export const DrillPerformanceModal: React.FC<Props> = ({
performanceData,
onContinueAnalyzing,
onNextDrill,
onRetry,
onReconfigureDrills,
}) => {
const { isMobile } = useContext(WindowSizeContext)
Expand Down Expand Up @@ -1504,6 +1524,7 @@ export const DrillPerformanceModal: React.FC<Props> = ({
performanceData={performanceData}
onContinueAnalyzing={onContinueAnalyzing}
onNextDrill={onNextDrill}
onRetry={onRetry}
onReconfigureDrills={onReconfigureDrills}
activeTab={activeTab}
setActiveTab={setActiveTab}
Expand All @@ -1524,6 +1545,7 @@ export const DrillPerformanceModal: React.FC<Props> = ({
performanceData={performanceData}
onContinueAnalyzing={onContinueAnalyzing}
onNextDrill={onNextDrill}
onRetry={onRetry}
onReconfigureDrills={onReconfigureDrills}
gameTree={gameTree}
openingEndNode={openingEndNode}
Expand Down
1 change: 1 addition & 0 deletions src/constants/materialSymbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const MATERIAL_SYMBOLS = [
'radio_button_unchecked',
'refresh',
'remove',
'replay',
'school',
'search',
'settings',
Expand Down
Loading
Loading