Skip to content

Commit

Permalink
Changed checked value to use portal plans on toggle (#18708)
Browse files Browse the repository at this point in the history
no issue

- this adds a bit more logic to ensure the portal plans remain consistent with the tier's visibility in the portal preview.
---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at 74fd5c4</samp>

Refactored the `Free` tier checkbox in the portal signup options
component to use the `portalPlans` array. This improves the consistency
and reliability of the portal plans settings.
  • Loading branch information
ronaldlangeveld authored Oct 20, 2023
1 parent 4bf3c6c commit 7f2818c
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,22 @@ const SignupOptions: React.FC<{
localTiers.forEach((tier) => {
if (tier.name === 'Free') {
tiersCheckboxes.push({
checked: tier.visibility === 'public',
checked: (portalPlans.includes('free')),
disabled: isDisabled,
label: 'Free',
value: 'free',
onChange: (checked) => {
if (portalPlans.includes('free') && !checked) {
portalPlans.splice(portalPlans.indexOf('free'), 1);
}

if (!portalPlans.includes('free') && checked) {
portalPlans.push('free');
}

updateSetting('portal_plans', JSON.stringify(portalPlans));

updateTier({...tier, visibility: checked ? 'public' : 'none'});
togglePlan('free');
}
});
}
Expand Down

0 comments on commit 7f2818c

Please sign in to comment.