mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
fix(premium): reflect limit config flags in plan comparisons (#3319)
This commit is contained in:
1 parent
acc1392a53
commit
94f1239050
4 files changed
+49
-8
No files matched your search
+8
-4
@@ -139,8 +139,10 @@ export const FeatureComparisonTable = observer(() => {
|
||||
<ComparisonCheckRow
|
||||
key={perk.id}
|
||||
feature={label}
|
||||
restrictedHas={perk.restrictedValue}
|
||||
stockHas={perk.stockValue}
|
||||
restrictedHas={
|
||||
perk.limitKey ? Limits.hasRestrictedFeature(perk.limitKey, perk.restrictedValue) : perk.restrictedValue
|
||||
}
|
||||
stockHas={perk.limitKey ? Limits.hasStockFeature(perk.limitKey, perk.stockValue) : perk.stockValue}
|
||||
data-flx="app.feature-comparison-table.render-perk-row.comparison-check-row"
|
||||
/>
|
||||
);
|
||||
@@ -157,9 +159,11 @@ export const FeatureComparisonTable = observer(() => {
|
||||
);
|
||||
}
|
||||
if (isTextTierPerk(perk)) {
|
||||
const restrictedLabel =
|
||||
const lowLabel =
|
||||
perkLabels[perk.restrictedValueI18nKey as keyof typeof perkLabels] || perk.restrictedValueI18nKey;
|
||||
const stockLabel = perkLabels[perk.stockValueI18nKey as keyof typeof perkLabels] || perk.stockValueI18nKey;
|
||||
const highLabel = perkLabels[perk.stockValueI18nKey as keyof typeof perkLabels] || perk.stockValueI18nKey;
|
||||
const restrictedLabel = perk.limitKey && Limits.hasRestrictedFeature(perk.limitKey, false) ? highLabel : lowLabel;
|
||||
const stockLabel = !perk.limitKey || Limits.hasStockFeature(perk.limitKey, true) ? highLabel : lowLabel;
|
||||
return (
|
||||
<ComparisonRow
|
||||
key={perk.id}
|
||||
|
||||
@@ -102,6 +102,14 @@ class LimitsClass {
|
||||
return LimitResolver.resolveFree(key, fallback);
|
||||
}
|
||||
|
||||
hasStockFeature(key: LimitKey, fallback: boolean): boolean {
|
||||
return this.getStockValue(key, fallback ? 1 : 0) > 0;
|
||||
}
|
||||
|
||||
hasRestrictedFeature(key: LimitKey, fallback: boolean): boolean {
|
||||
return this.getRestrictedValue(key, fallback ? 1 : 0) > 0;
|
||||
}
|
||||
|
||||
getPremiumValue(key: LimitKey, fallback: number): number {
|
||||
return this.getStockValue(key, fallback);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user