Skip to content

Commit

Permalink
背景全面モードから戻りにくい状態を防止
Browse files Browse the repository at this point in the history
  • Loading branch information
vipzero committed Apr 26, 2024
1 parent 86fb882 commit 717ad6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/components/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ function Home({ song, setBg }: Props) {
(enableFakeBar === 'on' ? TMP_TRACK_TIME : undefined)
const { customTheme } = useSettingsCustomTheme()

const { moz, full } = useLightConfig(song, () => toggleFavorites(song.icy))
const { moz, maxlay, layoff } = useLightConfig(song, () =>
toggleFavorites(song.icy)
)

return (
<Wrap
onClick={() => {
toggleSetting()
layoff()
setBgcmOpen(false)
}}
// @ts-ignore
Expand All @@ -77,7 +80,7 @@ function Home({ song, setBg }: Props) {
data-theme={appliedTheme}
data-shape={shape}
data-moz={moz}
data-full={full}
data-maxlay={maxlay}
data-time-bar-fake={!song.trackTimeMillis && enableFakeBar === 'on'}
customTheme={customTheme}
>
Expand Down Expand Up @@ -297,7 +300,7 @@ const Wrap = styled.div<{ customTheme: string }>`
filter: blur(100px);
}
}
&[data-full='true'] {
&[data-maxlay='true'] {
> :not(#bg) {
visibility: hidden !important;
}
Expand Down
10 changes: 5 additions & 5 deletions src/hooks/useLightConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useSettings, useSettingsEe } from './useSettings'
const mozList = ['on1', 'on2', 'off']

export const useLightConfig = (song: Song, toggleFavorites: () => void) => {
const [moz, setMoz] = useState<typeof mozList[number]>('off')
const [full, setFull] = useState<boolean>(false)
const [moz, setMoz] = useState<(typeof mozList)[number]>('off')
const [maxlay, setMaxlay] = useState<boolean>(false)
const { openEekey } = useSettingsEe()

const s = useSettings()
Expand All @@ -19,8 +19,8 @@ export const useLightConfig = (song: Song, toggleFavorites: () => void) => {
setMoz((v) => cycle(mozList, v))
openEekey('mosaic')
})
useKeyPressToggle(' ', setFull)
useKeyPressToggle('Shift', setFull)
useKeyPressToggle(' ', setMaxlay)
useKeyPressToggle('Shift', setMaxlay)

useKeyPressOne('a', s.toggleArtwork)
useKeyPressOne('h', s.toggleHistory)
Expand All @@ -30,5 +30,5 @@ export const useLightConfig = (song: Song, toggleFavorites: () => void) => {
useEffect(() => {
setMoz('off')
}, [song.icy])
return { moz, full }
return { moz, maxlay, layoff: () => setMaxlay(false) }
}

0 comments on commit 717ad6d

Please sign in to comment.