mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-02 23:38:06 +00:00
Hide subscriptions in store and account modal behind a feature flag
Subscriptions aren't ready yet. Add SUBSCRIPTIONS_ENABLED (currently false) in Cosmetics.ts to gate the Subscriptions store tab, the subscription panel on the account modal, and its cosmetics fetch. Flip the flag to true to re-enable.
This commit is contained in:
@@ -21,7 +21,7 @@ import "./components/Difficulties";
|
|||||||
import "./components/FriendsList";
|
import "./components/FriendsList";
|
||||||
import "./components/SubscriptionPanel";
|
import "./components/SubscriptionPanel";
|
||||||
import { modalHeader } from "./components/ui/ModalHeader";
|
import { modalHeader } from "./components/ui/ModalHeader";
|
||||||
import { fetchCosmetics } from "./Cosmetics";
|
import { fetchCosmetics, SUBSCRIPTIONS_ENABLED } from "./Cosmetics";
|
||||||
import { translateText } from "./Utils";
|
import { translateText } from "./Utils";
|
||||||
|
|
||||||
@customElement("account-modal")
|
@customElement("account-modal")
|
||||||
@@ -32,9 +32,9 @@ export class AccountModal extends BaseModal {
|
|||||||
@state() private isLoadingUser: boolean = false;
|
@state() private isLoadingUser: boolean = false;
|
||||||
|
|
||||||
private userMeResponse: UserMeResponse | null = null;
|
private userMeResponse: UserMeResponse | null = null;
|
||||||
|
private cosmetics: Cosmetics | null = null;
|
||||||
private statsTree: PlayerStatsTree | null = null;
|
private statsTree: PlayerStatsTree | null = null;
|
||||||
private recentGames: PlayerGame[] = [];
|
private recentGames: PlayerGame[] = [];
|
||||||
private cosmetics: Cosmetics | null = null;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@@ -225,6 +225,7 @@ export class AccountModal extends BaseModal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private renderSubscriptionPanel(): TemplateResult | "" {
|
private renderSubscriptionPanel(): TemplateResult | "" {
|
||||||
|
if (!SUBSCRIPTIONS_ENABLED) return "";
|
||||||
const sub = this.userMeResponse?.player?.subscription;
|
const sub = this.userMeResponse?.player?.subscription;
|
||||||
if (!sub) return "";
|
if (!sub) return "";
|
||||||
const cosmetic = this.cosmetics?.subscriptions?.[sub.tier] ?? null;
|
const cosmetic = this.cosmetics?.subscriptions?.[sub.tier] ?? null;
|
||||||
@@ -419,10 +420,12 @@ export class AccountModal extends BaseModal {
|
|||||||
protected onOpen(): void {
|
protected onOpen(): void {
|
||||||
this.isLoadingUser = true;
|
this.isLoadingUser = true;
|
||||||
|
|
||||||
|
if (SUBSCRIPTIONS_ENABLED) {
|
||||||
void fetchCosmetics().then((cosmetics) => {
|
void fetchCosmetics().then((cosmetics) => {
|
||||||
this.cosmetics = cosmetics;
|
this.cosmetics = cosmetics;
|
||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void getUserMe()
|
void getUserMe()
|
||||||
.then((userMe) => {
|
.then((userMe) => {
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ import { translateText } from "./Utils";
|
|||||||
|
|
||||||
export const TEMP_FLARE_OFFSET = 1 * 60 * 1000; // 1 minute
|
export const TEMP_FLARE_OFFSET = 1 * 60 * 1000; // 1 minute
|
||||||
|
|
||||||
|
// Subscriptions are not ready yet — flip to true to show them in the store
|
||||||
|
// and on the account/profile modal.
|
||||||
|
export const SUBSCRIPTIONS_ENABLED = false;
|
||||||
|
|
||||||
let __cosmetics: Promise<Cosmetics | null> | null = null;
|
let __cosmetics: Promise<Cosmetics | null> | null = null;
|
||||||
let __cosmeticsHash: string | null = null;
|
let __cosmeticsHash: string | null = null;
|
||||||
let __cosmeticsCache: Cosmetics | null = null;
|
let __cosmeticsCache: Cosmetics | null = null;
|
||||||
|
|||||||
+9
-1
@@ -12,6 +12,7 @@ import {
|
|||||||
fetchCosmetics,
|
fetchCosmetics,
|
||||||
purchaseCosmetic,
|
purchaseCosmetic,
|
||||||
resolveCosmetics,
|
resolveCosmetics,
|
||||||
|
SUBSCRIPTIONS_ENABLED,
|
||||||
} from "./Cosmetics";
|
} from "./Cosmetics";
|
||||||
import { translateText } from "./Utils";
|
import { translateText } from "./Utils";
|
||||||
|
|
||||||
@@ -32,7 +33,14 @@ export class StoreModal extends BaseModal {
|
|||||||
return {
|
return {
|
||||||
tabs: [
|
tabs: [
|
||||||
{ key: "packs", label: translateText("store.packs") },
|
{ key: "packs", label: translateText("store.packs") },
|
||||||
{ key: "subscriptions", label: translateText("store.subscriptions") },
|
...(SUBSCRIPTIONS_ENABLED
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
key: "subscriptions",
|
||||||
|
label: translateText("store.subscriptions"),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
{ key: "patterns", label: translateText("store.patterns") },
|
{ key: "patterns", label: translateText("store.patterns") },
|
||||||
{ key: "flags", label: translateText("store.flags") },
|
{ key: "flags", label: translateText("store.flags") },
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user