Skip to content

Commit

Permalink
Disable use plotlypy setting when plotlypy is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
porink0424 committed Aug 28, 2024
1 parent 80c23a3 commit a290c5c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion optuna_dashboard/ts/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ import {
useTheme,
} from "@mui/material"
import React from "react"
import { useRecoilValue } from "recoil"
import { PlotlyColorThemeDark, PlotlyColorThemeLight } from "ts/types/optuna"
import { usePlotBackendRendering, usePlotlyColorThemeState } from "../state"
import {
plotlypyIsAvailableState,
usePlotBackendRendering,
usePlotlyColorThemeState,
} from "../state"

interface SettingsProps {
handleClose: () => void
Expand All @@ -23,6 +28,7 @@ export const Settings = ({ handleClose }: SettingsProps) => {
const [plotlyColorTheme, setPlotlyColorTheme] = usePlotlyColorThemeState()
const [plotBackendRendering, setPlotBackendRendering] =
usePlotBackendRendering()
const plotlypyIsAvailable = useRecoilValue(plotlypyIsAvailableState)

const handleDarkModeColorChange = (event: SelectChangeEvent) => {
const dark = event.target.value as PlotlyColorThemeDark
Expand Down Expand Up @@ -123,6 +129,7 @@ export const Settings = ({ handleClose }: SettingsProps) => {
checked={plotBackendRendering}
onChange={togglePlotBackendRendering}
value="enable"
disabled={!plotlypyIsAvailable}
/>
</Stack>
</Stack>
Expand Down

0 comments on commit a290c5c

Please sign in to comment.