Copilot commented on code in PR #3310: URL: https://github.com/apache/apisix-dashboard/pull/3310#discussion_r2893266841
########## src/components/Header/DarkModeToggleBtn.tsx: ########## @@ -0,0 +1,36 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { ActionIcon, useComputedColorScheme, useMantineColorScheme } from '@mantine/core'; + +import IconDarkMode from '~icons/material-symbols/dark-mode'; +import IconLightMode from '~icons/material-symbols/light-mode'; + +export const DarkModeToggleBtn = () => { + const { toggleColorScheme } = useMantineColorScheme(); + const computedColorScheme = useComputedColorScheme('light', { getInitialValueInEffect: false }); + const isDark = computedColorScheme === 'dark'; Review Comment: Indentation/formatting in this new component doesn’t match surrounding Header components (they use 2-space indentation and multiline imports when needed). Please run the formatter or adjust indentation/wrapping so it matches the repo’s standard formatting. ########## src/components/Header/DarkModeToggleBtn.tsx: ########## @@ -0,0 +1,36 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { ActionIcon, useComputedColorScheme, useMantineColorScheme } from '@mantine/core'; + +import IconDarkMode from '~icons/material-symbols/dark-mode'; +import IconLightMode from '~icons/material-symbols/light-mode'; + +export const DarkModeToggleBtn = () => { + const { toggleColorScheme } = useMantineColorScheme(); + const computedColorScheme = useComputedColorScheme('light', { getInitialValueInEffect: false }); + const isDark = computedColorScheme === 'dark'; + + return ( + <ActionIcon + onClick={() => toggleColorScheme()} + variant="light" + size="sm" + > + {isDark ? <IconLightMode /> : <IconDarkMode />} + </ActionIcon> Review Comment: This is an icon-only control; please add an accessible label (e.g., `aria-label`) and consider making the label/state explicit (e.g., “Switch to dark mode” / “Switch to light mode”) so screen readers and tooltips convey the action clearly. ########## e2e/server/apisix_conf.yml: ########## @@ -1,42 +1,22 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - apisix: - node_listen: 9080 # APISIX listening port + node_listen: 9080 enable_ipv6: false Review Comment: The ASF/Apache license header comment block was removed from this YAML file. This repo appears to keep the license header in other e2e/server YAML files (e.g., docker-compose.yml), so it should remain here as well to satisfy project licensing requirements. ########## src/config/antdConfigProvider.tsx: ########## @@ -16,23 +16,47 @@ */ import '@ant-design/v5-patch-for-react-19'; -import { ConfigProvider } from 'antd'; +import { useComputedColorScheme, useMantineTheme } from '@mantine/core'; +import { ConfigProvider, theme } from 'antd'; import enUS from 'antd/locale/en_US'; import type { PropsWithChildren } from 'react'; import { useTranslation } from 'react-i18next'; export const AntdConfigProvider = (props: PropsWithChildren) => { const { children } = props; const { t } = useTranslation(); + const colorScheme = useComputedColorScheme('light', { + getInitialValueInEffect: false, + }); + const isDark = colorScheme === 'dark'; + const mantineTheme = useMantineTheme(); return ( <ConfigProvider virtual locale={enUS} renderEmpty={() => <div>{t('noData')}</div>} theme={{ + algorithm: isDark ? theme.darkAlgorithm : theme.defaultAlgorithm, token: { borderRadiusSM: 2, + ...(isDark + ? { + colorBgBase: mantineTheme.colors.dark[8], + colorBgContainer: mantineTheme.colors.dark[7], // matches mantine body/paper exactly + colorBgElevated: mantineTheme.colors.dark[6], // dropdowns float slightly above + colorFillAlter: mantineTheme.colors.dark[6], // table header backgrounds Review Comment: The dark palette indices/comments in main.tsx imply `dark[7]` is “paper/container” and `dark[8]` is “body/base background”, but here `colorBgContainer` is described as matching Mantine body/paper and `colorBgBase` is set to `dark[8]`. Please clarify which index is intended for the app body vs containers and align tokens/comments accordingly to avoid subtle background mismatches between Mantine and Ant Design surfaces. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
