Add Share to Context menus, also share artist

This commit is contained in:
Deluan
2023-01-24 13:35:51 -05:00
parent 051e9c556d
commit 433da37982
5 changed files with 50 additions and 8 deletions
+11 -4
View File
@@ -18,6 +18,7 @@ import {
openExtendedInfoDialog,
DOWNLOAD_MENU_ALBUM,
DOWNLOAD_MENU_ARTIST,
openShareMenu,
} from '../actions'
import { LoveButton } from './LoveButton'
import config from '../config'
@@ -79,12 +80,18 @@ const ContextMenu = ({
label: translate('resources.album.actions.addToPlaylist'),
action: (data, ids) => dispatch(openAddToPlaylist({ selectedIds: ids })),
},
share: {
enabled: config.devEnableShare,
needData: false,
label: translate('ra.action.share'),
action: (record) => {
dispatch(openShareMenu([record.id], resource, record.name))
},
},
download: {
enabled: config.enableDownloads && record.size,
needData: false,
label: `${translate('resources.album.actions.download')} (${formatBytes(
record.size
)})`,
label: `${translate('ra.action.download')} (${formatBytes(record.size)})`,
action: () => {
dispatch(
openDownloadMenu(
@@ -141,7 +148,7 @@ const ContextMenu = ({
notify('ra.page.error', 'warning')
})
} else {
options[key].action()
options[key].action(record)
}
e.stopPropagation()
+9 -3
View File
@@ -14,6 +14,7 @@ import {
openExtendedInfoDialog,
openDownloadMenu,
DOWNLOAD_MENU_SONG,
openShareMenu,
} from '../actions'
import { LoveButton } from './LoveButton'
import config from '../config'
@@ -63,11 +64,16 @@ export const SongContextMenu = ({
})
),
},
share: {
enabled: config.devEnableShare,
label: translate('ra.action.share'),
action: (record) => {
dispatch(openShareMenu([record.id], 'song', record.title))
},
},
download: {
enabled: config.enableDownloads,
label: `${translate('resources.song.actions.download')} (${formatBytes(
record.size
)})`,
label: `${translate('ra.action.download')} (${formatBytes(record.size)})`,
action: (record) => {
dispatch(openDownloadMenu(record, DOWNLOAD_MENU_SONG))
},