refactor(subscription): optimize subscription count handling in list view

- Replaced direct length checks on subscriptions with a computed subscriptionCount variable for improved readability and performance.
- Updated the CreateSubscriptionButton to conditionally render based on the new subscriptionCount variable, enhancing clarity in the component logic.
- Adjusted className logic for the button to account for multiple supported methods, ensuring better user experience.
This commit is contained in:
Harry
2025-10-12 23:56:27 +08:00
parent cca48f07aa
commit 90240cb6db
2 changed files with 6 additions and 5 deletions

View File

@ -146,7 +146,7 @@ export const CreateSubscriptionButton = ({ buttonType = CreateButtonType.FULL_BU
triggerPopupSameWidth: buttonType === CreateButtonType.FULL_BUTTON,
}}
triggerProps={{
className: cn('h-8 bg-transparent px-0 hover:bg-transparent', methodType !== DEFAULT_METHOD && 'pointer-events-none', buttonType === CreateButtonType.FULL_BUTTON && 'grow'),
className: cn('h-8 bg-transparent px-0 hover:bg-transparent', methodType !== DEFAULT_METHOD && supportedMethods.length > 1 && 'pointer-events-none', buttonType === CreateButtonType.FULL_BUTTON && 'grow'),
}}
popupProps={{
wrapperClassName: 'z-[1000]',