fix: 💄 add icon
All checks were successful
retro / xml (push) Successful in 11s
retro / php (push) Successful in 56s
retro / nodejs (push) Successful in 44s
retro / release (push) Has been skipped

This commit is contained in:
Michel Roux 2025-01-04 22:44:54 +01:00
parent d0e8f9efe0
commit 68614fc9bd
2 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,5 @@
import { import {
DefaultType,
FileAction, FileAction,
FileType, FileType,
Node, Node,
@ -7,19 +8,16 @@ import {
} from '@nextcloud/files' } from '@nextcloud/files'
import cores from './mime.json' import cores from './mime.json'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import icon from '../img/app.svg?raw'
import { t } from '@nextcloud/l10n' import { t } from '@nextcloud/l10n'
const getCore = (file: Node) => { const getCore = (file: Node) => {
if ( if (file.type === FileType.File && file.permissions & Permission.READ) {
!file.fileid || const extension = file.extension?.substring(1)
file.type !== FileType.File || for (const core in cores) {
!(file.permissions & Permission.READ) if (cores[core].types.includes(file.mime)) return core
) if (cores[core].extensions.includes(extension)) return core
return false }
const extension = file.extension?.substring(1)
for (const core in cores) {
if (cores[core].types.includes(file.mime)) return core
if (cores[core].extensions.includes(extension)) return core
} }
return false return false
} }
@ -27,7 +25,7 @@ const getCore = (file: Node) => {
const action = new FileAction({ const action = new FileAction({
id: 'retro', id: 'retro',
displayName: () => t('repod', 'Play'), displayName: () => t('repod', 'Play'),
iconSvgInline: () => '', iconSvgInline: () => icon,
enabled: (files: Node[]) => { enabled: (files: Node[]) => {
if (files.length !== 1) return false if (files.length !== 1) return false
return !!getCore(files[0]) return !!getCore(files[0])
@ -39,6 +37,7 @@ const action = new FileAction({
}) })
return true return true
}, },
default: DefaultType.DEFAULT,
}) })
registerFileAction(action) registerFileAction(action)

View File

@ -10,5 +10,6 @@
"rootDir": ".", "rootDir": ".",
"strict": true, "strict": true,
"noEmit": true, "noEmit": true,
"types": ["vite/client"],
} }
} }