fix(MinApp): integrate dynamic background color for MinappPopupContainer (#5142)

This commit is contained in:
SuYao 2025-04-21 23:44:15 +08:00 committed by GitHub
parent ca553a2454
commit c576aa5cb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 9 deletions

View File

@ -12,6 +12,7 @@ import { DEFAULT_MIN_APPS } from '@renderer/config/minapps'
import { useBridge } from '@renderer/hooks/useBridge' import { useBridge } from '@renderer/hooks/useBridge'
import { useMinappPopup } from '@renderer/hooks/useMinappPopup' import { useMinappPopup } from '@renderer/hooks/useMinappPopup'
import { useMinapps } from '@renderer/hooks/useMinapps' import { useMinapps } from '@renderer/hooks/useMinapps'
import useNavBackgroundColor from '@renderer/hooks/useNavBackgroundColor'
import { useRuntime } from '@renderer/hooks/useRuntime' import { useRuntime } from '@renderer/hooks/useRuntime'
import { MinAppType } from '@renderer/types' import { MinAppType } from '@renderer/types'
import { delay } from '@renderer/utils' import { delay } from '@renderer/utils'
@ -38,6 +39,7 @@ const MinappPopupContainer: React.FC = () => {
const { closeMinapp, hideMinappPopup } = useMinappPopup() const { closeMinapp, hideMinappPopup } = useMinappPopup()
const { pinned, updatePinnedMinapps } = useMinapps() const { pinned, updatePinnedMinapps } = useMinapps()
const { t } = useTranslation() const { t } = useTranslation()
const backgroundColor = useNavBackgroundColor()
/** control the drawer open or close */ /** control the drawer open or close */
const [isPopupShow, setIsPopupShow] = useState(true) const [isPopupShow, setIsPopupShow] = useState(true)
@ -236,7 +238,7 @@ const MinappPopupContainer: React.FC = () => {
} }
return ( return (
<TitleContainer style={{ justifyContent: 'space-between' }}> <TitleContainer style={{ backgroundColor: backgroundColor, justifyContent: 'space-between' }}>
<Tooltip <Tooltip
title={ title={
<TitleTextTooltip> <TitleTextTooltip>

View File

@ -1,20 +1,12 @@
import { isMac } from '@renderer/config/constant' import { isMac } from '@renderer/config/constant'
import { useTheme } from '@renderer/context/ThemeProvider'
import { useRuntime } from './useRuntime'
import { useSettings } from './useSettings' import { useSettings } from './useSettings'
function useNavBackgroundColor() { function useNavBackgroundColor() {
const { windowStyle } = useSettings() const { windowStyle } = useSettings()
const { theme } = useTheme()
const { minappShow } = useRuntime()
const macTransparentWindow = isMac && windowStyle === 'transparent' const macTransparentWindow = isMac && windowStyle === 'transparent'
if (minappShow) {
return theme === 'dark' ? 'var(--navbar-background)' : 'var(--color-white)'
}
if (macTransparentWindow) { if (macTransparentWindow) {
return 'transparent' return 'transparent'
} }