Skip to content

Commit

Permalink
fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nini22P committed Jan 1, 2024
1 parent 2d43395 commit 11f62a8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/hooks/graph/useUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ const useUser = () => {
usePlayQueueStore.persist.clearStorage()
useUiStore.persist.clearStorage()
instance.logoutRedirect({
postLogoutRedirectUri: '/'
postLogoutRedirectUri: '/',
})
location.reload()
}

const account: AccountInfo | null = accounts[0] || null
Expand Down
8 changes: 6 additions & 2 deletions src/hooks/ui/useThemeColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect } from 'react'
import useUiStore from '../../store/useUiStore'
import useTheme from './useTheme'
import { blendHex } from '@/utils'
import { useMediaQuery } from '@mui/material'
const useThemeColor = () => {

const [
Expand All @@ -20,6 +21,8 @@ const useThemeColor = () => {

const theme = useTheme()

const windowControlsOverlayOpen = useMediaQuery('(display-mode: window-controls-overlay)')

useEffect(
() => {
const themeColorLight = document.getElementById('themeColorLight') as HTMLMetaElement
Expand All @@ -35,13 +38,14 @@ const useThemeColor = () => {
themeColorDark.content = '#1e1e1e'
}
else if (audioViewIsShow && audioViewTheme === 'modern') {
const color = blendHex(`${theme.palette.background.default}`, `${coverColor}33`)

const color = blendHex(`${theme.palette.background.default}`, windowControlsOverlayOpen ? `${coverColor}30` : `${coverColor}33`)
themeColorLight.content = color
themeColorDark.content = color
}
}
},
[audioViewIsShow, audioViewTheme, coverColor, theme.palette.background.default, videoViewIsShow]
[audioViewIsShow, audioViewTheme, coverColor, theme.palette.background.default, videoViewIsShow, windowControlsOverlayOpen]
)

}
Expand Down
2 changes: 1 addition & 1 deletion src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"openSourceDependencies": "开源库"
},
"account": {
"account": "账号",
"account": "账户",
"signIn": "登录",
"signOut": "注销",
"signInAlert": "请使用微软账户授权登录"
Expand Down
9 changes: 5 additions & 4 deletions src/pages/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Typography, Container, IconButton } from '@mui/material'
import { Box, Typography, Container, IconButton, useMediaQuery } from '@mui/material'
import MenuRoundedIcon from '@mui/icons-material/MenuRounded'
import useUiStore from '../store/useUiStore'
import useUser from '@/hooks/graph/useUser'
Expand All @@ -8,6 +8,7 @@ const NavBar = () => {
const [mobileSideBarOpen, updateMobileSideBarOpen] = useUiStore(
(state) => [state.mobileSideBarOpen, state.updateMobileSideBarOpen]
)
const windowControlsOverlayOpen = useMediaQuery('(display-mode: window-controls-overlay)')

return (
<Box
Expand All @@ -28,7 +29,7 @@ const NavBar = () => {
justifyContent: 'flex-start',
alignItems: 'center',
height: '100%',
px: { xs: '0.5rem', sm: 'calc(env(titlebar-area-height, 1.25rem) - env(titlebar-area-height, 0rem) + 0.25rem)' },
px: { xs: '0.5rem', sm: windowControlsOverlayOpen ? '0.25rem' : '1.5rem' },
py: 'calc(env(titlebar-area-height, 0.5rem) - env(titlebar-area-height, 0rem) + 0.25rem)',
}}
>
Expand All @@ -47,12 +48,12 @@ const NavBar = () => {
alt='logo'
style={{
height: '100%',
marginRight: 'calc(env(titlebar-area-height, 0.5rem) - env(titlebar-area-height, 0rem) + 0.125rem)',
marginRight: windowControlsOverlayOpen ? '0.125rem' : '0.6125rem',
}}
/>
<Typography
component="div"
fontSize={'calc(env(titlebar-area-height, 0.25rem) - env(titlebar-area-height, 0rem) + 1rem)'}
fontSize={windowControlsOverlayOpen ? '1rem' : '1.25rem'}
>
OMP
</Typography>
Expand Down

0 comments on commit 11f62a8

Please sign in to comment.