Skip to content

Commit

Permalink
Don't show the "Copy size" menu item when it can't be used
Browse files Browse the repository at this point in the history
  • Loading branch information
maksis committed Jan 20, 2025
1 parent 84d345e commit ea03098
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/actions/ui/downloadable-item/DownloadableItemActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const canViewImage: Filter = (data) =>

const canCopyTTH: Filter = (data) => hasCopySupport() && !isDirectory(data);
const canCopyPath: Filter = (data) => hasCopySupport() && !!data.itemData.itemInfo.path;
const canCopySize: Filter = (data) => hasCopySupport() && data.itemData.itemInfo.size > 0;

// Handlers
type Handler = UI.ActionHandler<UI.DownloadableItemData, UI.SessionItemBase>;
Expand Down Expand Up @@ -320,6 +321,7 @@ export const CopySizeAction = {
id: 'copySize',
displayName: 'Copy size',
icon: IconConstants.COPY,
filter: canCopySize,
handler: handleCopySize,
notifications: {
onSuccess: 'Size was copied to clipboard',
Expand Down

0 comments on commit ea03098

Please sign in to comment.