From c0a63bbbbc2114239158d93f02773e79d76c9fd8 Mon Sep 17 00:00:00 2001 From: porink0424 Date: Wed, 14 Feb 2024 09:39:42 +0900 Subject: [PATCH] Improve modal position and size & add close button --- optuna_dashboard/ts/components/AppDrawer.tsx | 13 ++- optuna_dashboard/ts/components/Settings.tsx | 115 ++++++++++++------- optuna_dashboard/ts/types/index.d.ts | 7 +- 3 files changed, 88 insertions(+), 47 deletions(-) diff --git a/optuna_dashboard/ts/components/AppDrawer.tsx b/optuna_dashboard/ts/components/AppDrawer.tsx index 1d4d9c78..068dcff2 100644 --- a/optuna_dashboard/ts/components/AppDrawer.tsx +++ b/optuna_dashboard/ts/components/AppDrawer.tsx @@ -361,15 +361,16 @@ export const AppDrawer: FC<{ - + diff --git a/optuna_dashboard/ts/components/Settings.tsx b/optuna_dashboard/ts/components/Settings.tsx index 328521c0..f3d5b2af 100644 --- a/optuna_dashboard/ts/components/Settings.tsx +++ b/optuna_dashboard/ts/components/Settings.tsx @@ -1,17 +1,25 @@ -import React, { FC, useState } from "react" +import React, { useState } from "react" import { Typography, Select, MenuItem, - Grid, SelectChangeEvent, + Stack, + useTheme, + IconButton, } from "@mui/material" +import ClearIcon from "@mui/icons-material/Clear" import { useRecoilValue, useSetRecoilState } from "recoil" import { plotlyColorTheme } from "../state" -export const Settings: FC = () => { +interface SettingsProps { + handleClose: () => void +} + +export const Settings = ({ handleClose }: SettingsProps) => { + const theme = useTheme() const colorTheme = useRecoilValue(plotlyColorTheme) const setPlotlyColorTheme = useSetRecoilState(plotlyColorTheme) @@ -29,45 +37,74 @@ export const Settings: FC = () => { } return ( - - - - Settings - - - - + + + + + + + Settings + + + + Plotly Color Scales - - - - - Dark Mode + + Dark Mode + + + + Only the "Default" color scale is supported in dark mode - - - - - - - Light Mode - - - - - - + + Light Mode + + + + ) } diff --git a/optuna_dashboard/ts/types/index.d.ts b/optuna_dashboard/ts/types/index.d.ts index 30d6708f..78ca0386 100644 --- a/optuna_dashboard/ts/types/index.d.ts +++ b/optuna_dashboard/ts/types/index.d.ts @@ -240,7 +240,10 @@ type PreferenceHistory = { is_removed: boolean } +type PlotlyColorThemeDark = "default" +type PlotlyColorThemeLight = "default" | "seaborn" | "presentation" | "ggplot2" + type PlotlyColorTheme = { - dark: string - light: string + dark: PlotlyColorThemeDark + light: PlotlyColorThemeLight }