msyavuz commented on code in PR #34182: URL: https://github.com/apache/superset/pull/34182#discussion_r2229829393
########## superset-frontend/packages/superset-ui-core/src/components/ThemeSelect/index.tsx: ########## @@ -43,36 +50,65 @@ const ThemeSelect: React.FC<ThemeSelectProps> = ({ [ThemeAlgorithm.COMPACT]: <Icons.CompressOutlined />, }; + // Use different icon when local theme is active + const triggerIcon = hasLocalOverride ? ( + <Icons.FormatPainterOutlined style={{ color: theme.colorErrorText }} /> + ) : ( + themeIconMap[themeMode] || <Icons.FormatPainterOutlined /> + ); + + const menuItems: any[] = [ Review Comment: There should be a type for menu items ########## superset-frontend/packages/superset-ui-core/src/components/ThemeSelect/index.tsx: ########## @@ -43,36 +50,65 @@ const ThemeSelect: React.FC<ThemeSelectProps> = ({ [ThemeAlgorithm.COMPACT]: <Icons.CompressOutlined />, }; + // Use different icon when local theme is active + const triggerIcon = hasLocalOverride ? ( + <Icons.FormatPainterOutlined style={{ color: theme.colorErrorText }} /> + ) : ( + themeIconMap[themeMode] || <Icons.FormatPainterOutlined /> + ); + + const menuItems: any[] = [ + { + type: 'group', + label: t('Theme'), + }, + { + key: ThemeMode.DEFAULT, + label: t('Light'), + icon: <Icons.SunOutlined />, + onClick: () => handleSelect(ThemeMode.DEFAULT), + }, + { + key: ThemeMode.DARK, + label: t('Dark'), + icon: <Icons.MoonOutlined />, + onClick: () => handleSelect(ThemeMode.DARK), + }, + ...(allowOSPreference + ? [ + { + key: ThemeMode.SYSTEM, + label: t('Match system'), + icon: <Icons.FormatPainterOutlined />, + onClick: () => handleSelect(ThemeMode.SYSTEM), + }, + ] + : []), + ]; + + // Add clear settings option only when there's a local theme active + if (onClearLocalSettings && hasLocalOverride) { + menuItems.push( + { type: 'divider' } as any, Review Comment: These any assertions shouldn't be necessary -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org