mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-08 03:12:24 +03:00
Fix formatting
This commit is contained in:
parent
2397a7e464
commit
14525cd056
@ -55,7 +55,9 @@ const Player = () => {
|
|||||||
const queue = useSelector((state) => state.queue)
|
const queue = useSelector((state) => state.queue)
|
||||||
const current = queue.current || {}
|
const current = queue.current || {}
|
||||||
const { authenticated } = useAuthState()
|
const { authenticated } = useAuthState()
|
||||||
const showNotifications = useSelector((state) => state.settings.notifications || false)
|
const showNotifications = useSelector(
|
||||||
|
(state) => state.settings.notifications || false
|
||||||
|
)
|
||||||
|
|
||||||
const visible = authenticated && queue.queue.length > 0
|
const visible = authenticated && queue.queue.length > 0
|
||||||
const classes = useStyle({ visible })
|
const classes = useStyle({ visible })
|
||||||
@ -233,7 +235,11 @@ const Player = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (showNotifications) {
|
if (showNotifications) {
|
||||||
sendNotification(info.name, `${info.singer} - ${info.album}`, baseUrl(info.cover))
|
sendNotification(
|
||||||
|
info.name,
|
||||||
|
`${info.singer} - ${info.album}`,
|
||||||
|
baseUrl(info.cover)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -13,10 +13,7 @@ import {
|
|||||||
} from 'react-admin'
|
} from 'react-admin'
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
import HelpOutlineIcon from '@material-ui/icons/HelpOutline'
|
import HelpOutlineIcon from '@material-ui/icons/HelpOutline'
|
||||||
import {
|
import { changeTheme, setNotificationsState } from '../actions'
|
||||||
changeTheme,
|
|
||||||
setNotificationsState,
|
|
||||||
} from '../actions'
|
|
||||||
import themes from '../themes'
|
import themes from '../themes'
|
||||||
import { docsUrl } from '../utils'
|
import { docsUrl } from '../utils'
|
||||||
import { useGetLanguageChoices } from '../i18n'
|
import { useGetLanguageChoices } from '../i18n'
|
||||||
@ -130,7 +127,7 @@ const NotificationsToggle = (props) => {
|
|||||||
const notify = useNotify()
|
const notify = useNotify()
|
||||||
const currentSetting = useSelector((state) => state.settings.notifications)
|
const currentSetting = useSelector((state) => state.settings.notifications)
|
||||||
const current = (() => {
|
const current = (() => {
|
||||||
if (!("Notification" in window) || Notification.permission !== 'granted') {
|
if (!('Notification' in window) || Notification.permission !== 'granted') {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return currentSetting
|
return currentSetting
|
||||||
@ -139,12 +136,15 @@ const NotificationsToggle = (props) => {
|
|||||||
return (
|
return (
|
||||||
<BooleanInput
|
<BooleanInput
|
||||||
{...props}
|
{...props}
|
||||||
source='notifications'
|
source="notifications"
|
||||||
label={translate('menu.personal.options.desktop_notifications')}
|
label={translate('menu.personal.options.desktop_notifications')}
|
||||||
defaultValue={current}
|
defaultValue={current}
|
||||||
onChange={async (notificationsEnabled) => {
|
onChange={async (notificationsEnabled) => {
|
||||||
if (notificationsEnabled) {
|
if (notificationsEnabled) {
|
||||||
if (!('Notification' in window) || Notification.permission === 'denied') {
|
if (
|
||||||
|
!('Notification' in window) ||
|
||||||
|
Notification.permission === 'denied'
|
||||||
|
) {
|
||||||
notify(translate('message.notifications_blocked'), 'warning')
|
notify(translate('message.notifications_blocked'), 'warning')
|
||||||
notificationsEnabled = false
|
notificationsEnabled = false
|
||||||
} else {
|
} else {
|
||||||
|
@ -10,7 +10,7 @@ export const settingsReducer = (previousState = initialState, payload) => {
|
|||||||
case SET_NOTIFICATIONS_STATE:
|
case SET_NOTIFICATIONS_STATE:
|
||||||
return {
|
return {
|
||||||
...previousState,
|
...previousState,
|
||||||
notifications: data
|
notifications: data,
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return previousState
|
return previousState
|
||||||
|
@ -3,7 +3,7 @@ export const sendNotification = (title, body = '', image = '') => {
|
|||||||
new Notification(title, {
|
new Notification(title, {
|
||||||
body: body,
|
body: body,
|
||||||
icon: image,
|
icon: image,
|
||||||
silent: true
|
silent: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user