Skip to content

Commit

Permalink
Merge pull request #123 from nini22P/next
Browse files Browse the repository at this point in the history
v1.9.1
  • Loading branch information
nini22P authored Oct 29, 2024
2 parents d22730d + 5cbdb44 commit a8d29a0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "omp",
"description": "OneDrive Media Player",
"private": true,
"version": "1.9.0",
"version": "1.9.1",
"scripts": {
"dev": "webpack serve",
"build": "node update-version-info.mjs && webpack --mode=production --node-env=production",
Expand Down
31 changes: 23 additions & 8 deletions src/components/Lyrics/Lyrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ import { t } from '@lingui/macro'
const Lyrics = ({ lyrics, currentTime }: { lyrics: string, currentTime: number }) => {
const theme = useTheme()
const lyricsRef = useRef<HTMLDivElement>(null)
const lyricLineHeight = 48

const isMobile = useMediaQuery('(max-height: 600px) or (max-width: 600px)')

const xs = useMediaQuery(theme.breakpoints.up('xs'))
const sm = useMediaQuery(theme.breakpoints.up('sm'))
const md = useMediaQuery(theme.breakpoints.up('md'))
const lg = useMediaQuery(theme.breakpoints.up('lg'))
const xl = useMediaQuery(theme.breakpoints.up('xl'))

const lyricLineHeight = xl ? 44 : lg ? 46 : md ? 48 : sm ? 48 : xs ? 48 : 50

type Lyrics = {
time: number,
Expand Down Expand Up @@ -59,7 +68,7 @@ const Lyrics = ({ lyrics, currentTime }: { lyrics: string, currentTime: number }
config: { mass: 2, tension: 300, friction: 25 },
})

const isMobile = useMediaQuery('(max-height: 600px) or (max-width: 600px)')
const isHighlight = (time: number) => lyricsList[currentLyricIndex] && time === lyricsList[currentLyricIndex].time

return (
<div key={'lyrics'} style={{ height: '100%', width: '100%', overflow: 'hidden' }}>
Expand Down Expand Up @@ -87,26 +96,32 @@ const Lyrics = ({ lyrics, currentTime }: { lyrics: string, currentTime: number }
>
<div style={{ height: '30%' }} />
{
lyricsList.map((item, index) =>
lyricsList.map((item) =>
<div
key={item.time + item.text}
style={{
display: 'flex',
justifyContent: 'start',
alignItems: 'center',
height: index === currentLyricIndex ? lyricLineHeight * 1.6 : lyricLineHeight,
paddingLeft: index === currentLyricIndex
height: isHighlight(item.time)
? lyricLineHeight * 1.6
: lyricLineHeight,
paddingLeft: isHighlight(item.time)
? isMobile ? 0 : '1rem'
: isMobile ? '1rem' : '2rem',
}}
>
<p
style={{
fontSize: index === currentLyricIndex
fontSize: isHighlight(item.time)
? isMobile ? '1.5rem' : '1.5rem'
: isMobile ? '1rem' : '1.2rem',
color: index === currentLyricIndex ? theme.palette.text.primary : theme.palette.text.secondary,
fontWeight: index === currentLyricIndex ? 'bold' : 'normal',
color: isHighlight(item.time)
? theme.palette.text.primary
: theme.palette.text.secondary,
fontWeight: isHighlight(item.time)
? 'bold'
: 'normal',
transition: 'font-size 0.3s ease-out, color 0.3s ease, font-weight 0.3s ease',
}}
>
Expand Down
5 changes: 5 additions & 0 deletions src/pages/Player/Audio/Audio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ const Audio = ({ player }: { player: HTMLVideoElement | null }) => {
)

const bind = useDrag(({ down, movement: [, my], last, event }) => {
const element = event.target as HTMLElement

if (element.classList.contains('MuiSlider-thumb'))
return

if ('pointerType' in event && event.pointerType !== 'touch') {
return
}
Expand Down

0 comments on commit a8d29a0

Please sign in to comment.