Skip to content

Commit

Permalink
Hide plan selector from legacy plan holders (#1007)
Browse files Browse the repository at this point in the history
* Hide plan selector from legacy plan holders

* cleanup

* updated copy

* updated copy again
  • Loading branch information
mdelaossa authored Dec 18, 2024
1 parent 96f276a commit 51b5366
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions src/ui/pages/plans.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
fetchPlans,
selectFirstActivePlan,
selectPlanByActiveId,
selectStacksByOrgAsList,
updateActivePlan,
} from "@app/deploy";
import { selectOrganizationSelected } from "@app/organizations";
Expand Down Expand Up @@ -37,6 +38,10 @@ export const PlansPage = () => {
const hasPaymentMethod = useSelector(selectHasPaymentMethod);
const paymentRequired = hasTrialNoPayment || !hasPaymentMethod;

const stacks = useSelector(selectStacksByOrgAsList);
const hasDedicatedStack = stacks.filter((s) => s.organizationId).length > 0;
const legacy = hasDedicatedStack && !activePlan.planId;

const onSelectPlan = ({ planId, name }: { planId: string; name: string }) => {
dispatch(
updateActivePlan({
Expand Down Expand Up @@ -74,14 +79,24 @@ export const PlansPage = () => {
before changing your plan.
</Banner>
) : null}
{legacy ? (
<Banner>
You are currently on an older plan with Aptible. Please{" "}
<Link to="https://aptible.com/contact">contact us</Link> to update
your plan or{" "}
<Link to="https://www.aptible.com/pricing">view new plans</Link>.
</Banner>
) : null}
</Group>

<Plans
activePlan={activePlan}
selected={selectedPlan.name}
onSelectPlan={onSelectPlan}
paymentRequired={paymentRequired}
/>
{legacy ? null : (
<Plans
activePlan={activePlan}
selected={selectedPlan.name}
onSelectPlan={onSelectPlan}
paymentRequired={paymentRequired}
/>
)}
</Group>
</HeroBgLayout>
);
Expand Down

0 comments on commit 51b5366

Please sign in to comment.