mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
## Summary Add persistent upgrade CTAs for free-tier users: a topbar button and "Upgrade to add credits" replacing "Add Credits" in popovers and settings panels. ## Changes - **What**: - New `TopbarSubscribeButton` component in both GraphCanvas and LinearView topbars, visible only to free-tier users - Profile popover (legacy + workspace): free-tier users see "Upgrade to add credits" instead of "Add Credits", linking directly to the pricing table - Manage Plan settings (legacy + workspace): same replacement — free-tier users see "Upgrade to add credits" instead of "Add Credits" - Paid-tier users retain the original "Add Credits" behavior in all locations - All upgrade buttons go directly to the pricing table (one-step flow) ## Review Focus - The `isFreeTier` conditional gating on the buttons — ensure free-tier users see upgrade CTAs and paid users see normal Add Credits - Layout in Manage Plan panels uses `flex flex-col gap-3` to stack the upgrade button below the usage history link instead of side-by-side ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9315-feat-add-ever-present-upgrade-button-for-free-tier-users-3166d73d365081228cdfe6a67fec6aec) by [Unito](https://www.unito.io)
60 lines
2.1 KiB
TypeScript
60 lines
2.1 KiB
TypeScript
import type { VariantProps } from 'cva'
|
|
import { cva } from 'cva'
|
|
|
|
export const buttonVariants = cva({
|
|
base: 'relative inline-flex items-center justify-center gap-2 cursor-pointer whitespace-nowrap appearance-none border-none rounded-md text-sm font-medium font-inter transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
|
|
variants: {
|
|
variant: {
|
|
secondary:
|
|
'bg-secondary-background text-secondary-foreground hover:bg-secondary-background-hover',
|
|
primary:
|
|
'bg-primary-background text-base-foreground hover:bg-primary-background-hover',
|
|
inverted:
|
|
'bg-base-foreground text-base-background hover:bg-base-foreground/80',
|
|
destructive:
|
|
'bg-destructive-background text-base-foreground hover:bg-destructive-background-hover',
|
|
textonly:
|
|
'text-base-foreground bg-transparent hover:bg-secondary-background-hover',
|
|
'muted-textonly':
|
|
'text-muted-foreground bg-transparent hover:bg-secondary-background-hover',
|
|
'destructive-textonly':
|
|
'text-destructive-background bg-transparent hover:bg-destructive-background/10',
|
|
'overlay-white': 'bg-white text-gray-600 hover:bg-white/90',
|
|
gradient:
|
|
'bg-subscription-gradient text-white border-transparent hover:opacity-90'
|
|
},
|
|
size: {
|
|
sm: 'h-6 rounded-sm px-2 py-1 text-xs',
|
|
md: 'h-8 rounded-lg p-2 text-xs',
|
|
lg: 'h-10 rounded-lg px-4 py-2 text-sm',
|
|
icon: 'size-8',
|
|
'icon-sm': 'size-5 p-0',
|
|
unset: ''
|
|
}
|
|
},
|
|
|
|
defaultVariants: {
|
|
variant: 'secondary',
|
|
size: 'md'
|
|
}
|
|
})
|
|
|
|
export type ButtonVariants = VariantProps<typeof buttonVariants>
|
|
|
|
const variants = [
|
|
'secondary',
|
|
'primary',
|
|
'inverted',
|
|
'destructive',
|
|
'textonly',
|
|
'muted-textonly',
|
|
'destructive-textonly',
|
|
'overlay-white',
|
|
'gradient'
|
|
] as const satisfies Array<ButtonVariants['variant']>
|
|
const sizes = ['sm', 'md', 'lg', 'icon', 'icon-sm'] as const satisfies Array<
|
|
ButtonVariants['size']
|
|
>
|
|
|
|
export const FOR_STORIES = { variants, sizes } as const
|