Copilot commented on code in PR #3310:
URL: https://github.com/apache/apisix-dashboard/pull/3310#discussion_r2939569267


##########
src/components/Header/DarkModeToggleBtn.tsx:
##########
@@ -0,0 +1,37 @@
+/*
+ * 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, IconLightMode } from '@tabler/icons-react';

Review Comment:
   `@tabler/icons-react` is imported here, but the dependency doesn’t appear in 
this repo’s `package.json`. This will break the build unless the package is 
added explicitly or the icon implementation is switched to the existing 
`~icons/material-symbols/*` pattern used elsewhere in the header.
   



##########
src/components/Header/DarkModeToggleBtn.tsx:
##########
@@ -0,0 +1,37 @@
+/*
+ * 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, IconLightMode } from '@tabler/icons-react';
+
+export const DarkModeToggleBtn = () => {
+  const { toggleColorScheme } = useMantineColorScheme();
+  const computedColorScheme = useComputedColorScheme('light', { 
getInitialValueInEffect: false });
+  const isDark = computedColorScheme === 'dark';
+
+  return (
+    <ActionIcon
+      onClick={() => toggleColorScheme()}
+      variant="light"
+      size="sm"
+      aria-label={isDark ? 'Switch to light mode' : 'Switch to dark mode'}
+      title={isDark ? 'Switch to light mode' : 'Switch to dark mode'}

Review Comment:
   The `title` attribute contains literal text, which violates the repo’s i18n 
lint rule (`i18n/no-text-as-attribute` for `title`) and will fail `pnpm lint`. 
Please route this text through `t(...)` (and add the corresponding translation 
keys), or remove `title` if you only need an accessible name via `aria-label`.
   



##########
src/components/Header/index.tsx:
##########
@@ -46,6 +47,7 @@ export const Header: FC<HeaderProps> = (props) => {
           <div>{t('apisix.dashboard')}</div>
         </Group>
         <Group h="100%" gap="sm">
+          <DarkModeToggleBtn />
           <SettingModalBtn />
           <LanguageMenu />

Review Comment:
   The PR description mentions additional theme consistency work (e.g., Ant 
Design ProTable styling variables). Those changes aren’t present in this PR’s 
diff; either include the missing styling updates or adjust the PR description 
to match the actual changes.



-- 
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]

Reply via email to