Skip to content

Commit

Permalink
upd: only show "Open With" if there's more than one option
Browse files Browse the repository at this point in the history
  • Loading branch information
solvedDev committed Aug 18, 2022
1 parent b756b0c commit 3af63ec
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,22 @@ export const OpenWithAction = async (fileWrapper: FileWrapper) => {
})
}

const actions = [
...defaultActions,
defaultActions.length > 0 && externalActions.length > 0
? { type: 'divider' }
: null,
...externalActions,
].filter((action) => action !== null)

if (actions.length <= 1) return null

// Construct and return submenu
return <ISubmenuConfig>{
type: 'submenu',
icon: 'mdi-open-in-app',
name: 'actions.openWith.name',

actions: [
...defaultActions,
defaultActions.length > 0 && externalActions.length > 0
? { type: 'divider' }
: null,
...externalActions,
],
actions,
}
}

0 comments on commit 3af63ec

Please sign in to comment.