fix(context-menu): ensure submenu is only transformed if it has items

- Updated the submenu transformation logic to check for item length before processing, preventing unnecessary transformations.
- Adjusted the EntryTitle component's hover effect class for improved scaling behavior.

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei 2025-04-24 12:45:06 +08:00
parent b3a2fdb1fb
commit b6eb586121
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
2 changed files with 5 additions and 4 deletions

View File

@ -103,9 +103,10 @@ function transformMenuItemsForNative(nextItems: FollowMenuItem[]): ElectronMenuI
(!item.disabled && item.click !== undefined) || (!!item.submenu && item.submenu.length > 0),
accelerator: item.shortcut?.replace("Meta", "CmdOrCtrl"),
checked: typeof item.checked === "boolean" ? item.checked : undefined,
submenu: item.submenu
? transformMenuItemsForNative(filterNullableMenuItems(item.submenu))
: undefined,
submenu:
item.submenu.length > 0
? transformMenuItemsForNative(filterNullableMenuItems(item.submenu))
: undefined,
}
})
}

View File

@ -71,7 +71,7 @@ export const EntryTitle = ({ entryId, compact }: EntryLinkProps) => {
href={populatedFullHref ?? "#"}
target="_blank"
rel="noopener noreferrer"
className="cursor-link hover:multi-[scale-105;opacity-95] inline-block select-text break-words text-[1.7rem] font-bold leading-normal duration-200"
className="cursor-link hover:multi-[scale-[1.01];opacity-95] inline-block select-text break-words text-[1.7rem] font-bold leading-normal duration-200"
>
<EntryTranslation
source={entry.entries.title}