-
Notifications
You must be signed in to change notification settings - Fork 125
Change pricing Pro max to 5B #7717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,7 +86,7 @@ export function Pricing({ className }: { className?: string }): ReactElement { | |
| <PricingSlider | ||
| className="mt-6 lg:mt-12" | ||
| onChange={value => { | ||
| const newPlan = value === 1 ? 'Hobby' : value < 280 ? 'Pro' : 'Enterprise'; | ||
| const newPlan = value === 1 ? 'Hobby' : value < 4800 ? 'Pro' : 'Enterprise'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Enterprise threshold (4800) is very close to the maximum, and the slider continues to show a calculated Pro price for values >= 4800 even though the Enterprise card is highlighted. The slider should ideally show 'Contact us' or hide the price once the Enterprise threshold is reached to avoid confusion. |
||
| if (newPlan !== highlightedPlan) { | ||
| setHighlightedPlan(newPlan); | ||
| if (!scrollviewRef.current) return; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,16 @@ import { CallToAction, cn } from '@theguild/components'; | |
| import { BookIcon } from '../book-icon'; | ||
| import { Slider } from '../slider'; | ||
|
|
||
| function formatOps(millions: number): { label: string; chars: number } { | ||
| if (millions >= 1000) { | ||
| const b = parseFloat((millions / 1000).toFixed(3)); | ||
| const label = `${b} B`; | ||
| return { label, chars: label.length - 1 }; | ||
| } | ||
| const label = `${millions} M`; | ||
| return { label, chars: label.length - 1 }; | ||
| } | ||
|
|
||
| export function PricingSlider({ | ||
| className, | ||
| onChange, | ||
|
|
@@ -13,29 +23,30 @@ export function PricingSlider({ | |
| onChange: (value: number) => void; | ||
| }) { | ||
| const min = 1; | ||
| const max = 300; | ||
| const max = 5000; | ||
|
|
||
| const [popoverOpen, setPopoverOpen] = useState(false); | ||
| const [opsLabel, setOpsLabel] = useState(() => formatOps(min).label); | ||
| const rootRef = useRef<HTMLDivElement>(null); | ||
|
|
||
| return ( | ||
| <div | ||
| ref={rootRef} | ||
| className={cn( | ||
| 'relative isolate block select-none rounded-3xl border border-green-400 p-4 [counter-set:ops_calc(var(--ops))] sm:p-8', | ||
| 'relative isolate block select-none rounded-3xl border border-green-400 p-4 sm:p-8', | ||
| className, | ||
| )} | ||
| // 10$ base price + 10$ per 1M | ||
| style={{ '--ops': min, '--price': 'calc(10 + var(--ops) * 10)' }} | ||
| style={{ '--ops': min, '--ops-chars': 0, '--price': 'calc(10 + var(--ops) * 10)' }} | ||
| {...rest} | ||
| > | ||
| <div | ||
| aria-hidden | ||
| className="text-green-1000 flex flex-wrap items-center text-2xl font-medium md:h-12 md:w-[calc(100%-260px)]" | ||
| > | ||
| <div className="relative min-w-[clamp(calc(60.95px+14.47px*round(down,log(max(var(--ops),1),10),1)),(2-var(--ops))*111px,111px)] max-w-[clamp(calc(60.95px+14.47px*round(down,log(max(var(--ops),1),10),1)),(2-var(--ops))*111px,111px)] shrink grow motion-safe:transition-all"> | ||
| <div className="flex w-full whitespace-pre rounded-[40px] bg-blue-300 px-3 py-1 tabular-nums leading-8 opacity-[calc(var(--ops)-1)] [transition-duration:calc(clamp(0,var(--ops)-1,1)*350ms)] before:tracking-[-0.12em] before:content-[''_counter(ops)_'_'] motion-safe:transition-all"> | ||
| M | ||
| <div className="relative min-w-[clamp(calc(60.95px+14.47px*var(--ops-chars)),(2-var(--ops))*111px,111px)] max-w-[clamp(calc(60.95px+14.47px*var(--ops-chars)),(2-var(--ops))*111px,111px)] shrink grow motion-safe:transition-all"> | ||
| <div className="flex w-full whitespace-pre rounded-[40px] bg-blue-300 px-3 py-1 tabular-nums leading-8 opacity-[calc(var(--ops)-1)] [transition-duration:calc(clamp(0,var(--ops)-1,1)*350ms)] tracking-[-0.12em] motion-safe:transition-all"> | ||
| {opsLabel} | ||
| </div> | ||
| <div className="absolute left-0 top-0 whitespace-pre leading-10 opacity-[calc(2-var(--ops))] [transition-duration:calc(clamp(0,2-var(--ops),1)*350ms)] motion-safe:transition"> | ||
| How many | ||
|
|
@@ -60,11 +71,14 @@ export function PricingSlider({ | |
| counter="after:content-['$'_counter(price)_'_/_month'] after:[counter-set:price_calc(var(--price))]" | ||
| onChange={event => { | ||
| const value = event.currentTarget.valueAsNumber; | ||
| const display = formatOps(value); | ||
| rootRef.current!.style.setProperty('--ops', `${value}`); | ||
| rootRef.current!.style.setProperty('--ops-chars', `${display.chars}`); | ||
| setOpsLabel(display.label); | ||
| onChange(value); | ||
| }} | ||
| /> | ||
| <span className="font-medium">{max}M</span> | ||
| <span className="font-medium">5B</span> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| </div> | ||
| <Root delayDuration={0} open={popoverOpen} onOpenChange={setPopoverOpen}> | ||
| <Trigger asChild> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Increasing the slider maximum to 5000 (5B) on a linear scale makes it extremely difficult to select lower values precisely. For instance, 100M is now at the 2% mark. Consider using a logarithmic scale or adding a numeric input field for better precision, especially since intermediate labels like 100M/200M were removed.