From 8a58e2aca814a9f4882b62286d4f9d6d8c019a85 Mon Sep 17 00:00:00 2001 From: GuillaumeSD Date: Mon, 19 May 2025 01:20:08 +0200 Subject: [PATCH] fix : thread slider context info --- src/components/slider.tsx | 63 ++++++++++++++--- .../engineSettings/engineSettingsDialog.tsx | 67 +++++++------------ tsconfig.json | 2 +- 3 files changed, 81 insertions(+), 51 deletions(-) diff --git a/src/components/slider.tsx b/src/components/slider.tsx index d26d9db..24614d3 100644 --- a/src/components/slider.tsx +++ b/src/components/slider.tsx @@ -1,9 +1,15 @@ +import { Icon } from "@iconify/react"; import { Grid2 as Grid, + IconButton, Slider as MuiSlider, + Popover, + Stack, styled, Typography, + TypographyProps, } from "@mui/material"; +import { useState } from "react"; export interface Props { value: number; @@ -14,6 +20,7 @@ export interface Props { size?: number; marksFilter?: number; step?: number; + infoContent?: TypographyProps["children"]; } export default function Slider({ @@ -25,7 +32,18 @@ export default function Slider({ size, marksFilter, step = 1, + infoContent, }: Props) { + const [anchorEl, setAnchorEl] = useState(null); + + const handleOpenPopover = (event: React.MouseEvent) => { + setAnchorEl(event.currentTarget); + }; + + const handleClosePopover = () => { + setAnchorEl(null); + }; + return ( - - {step === 1 && marksFilter ? label : `${label}: ${value}`} - + + + {step === 1 && marksFilter ? label : `${label}: ${value}`} + + + {!!infoContent && ( + <> + + + + + + + {infoContent} + + + + )} + (null); - const handleHelpClick = (event: React.MouseEvent) => { - setAnchorEl(event.currentTarget); - }; - const handleHelpClose = () => { - setAnchorEl(null); - }; - const helpOpen = Boolean(anchorEl); - useEffect(() => { if (!isEngineSupported(engineName)) { if (Stockfish16_1.isSupported()) { @@ -217,35 +204,31 @@ export default function EngineSettingsDialog({ open, onClose }: Props) { - - - - - - - - - - - More threads means faster analysis, but only if your device can handle them—otherwise, it may have the opposite effect. The estimated optimal value for your device is {getRecommendedWorkersNb()}.
- Due to privacy restrictions in some browsers, detection may be inaccurate and result in underestimated recommendations.
- If the recommended value is unusually low, we suggest using a number close to your CPU’s thread count minus 1 or 2. -
-
-
+ + + More threads means faster analysis, but only if your device + can handle them, otherwise it may have the opposite effect. + The estimated optimal value for your device is{" "} + {getRecommendedWorkersNb()}.
+ Due to privacy restrictions in some browsers, this estimated + value might be underestimated. Don't hesitate to try different + values to find the best one for your device. + + } + />
diff --git a/tsconfig.json b/tsconfig.json index 11341e5..bae9a40 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ES2017", + "target": "ES2021", "lib": ["dom"], "allowJs": false, "skipLibCheck": true,