fix: selected tier is not a env variable but a store

This commit is contained in:
Arman committed 2023-05-25 14:26:37 +02:00
1 parent ba57309b63
commit effa062d70
3 files changed
+15 -13

No files matched your search

+3 -4
View File
@@ -4,12 +4,11 @@
import SupportOfflineDark from '$lib/images/support/support-offline-dark.png';
import SupportOnlineLight from '$lib/images/support/support-online-light.png';
import SupportOnlineDark from '$lib/images/support/support-online-dark.png';
import { app } from '$lib/stores/app';
import { app, isFreeTier } from '$lib/stores/app';
import { wizard } from '$lib/stores/wizard';
import SupportWizard from '../../routes/console/supportWizard.svelte';
import { isSupportOnline } from '../../routes/console/wizard/store';
import { isCloud, Tier } from '$lib/system';
const tier = import.meta.env.VITE_CONSOLE_TIER?.toString() || Tier.FREE;
import { isCloud } from '$lib/system';
export let show = false;
</script>
@@ -35,7 +34,7 @@
Get personalized support from the Appwrite team from <b>09:00 - 17:00 UTC</b>
</p>
</div>
{#if tier === 'base'}
{#if isFreeTier}
<Button fullWidth href="https://appwrite.io/billing">
<span class="text">Get Premium support</span>
</Button>
+12 -1
View File
@@ -1,6 +1,6 @@
import { browser } from '$app/environment';
import { VARS } from '$lib/system';
import { writable } from 'svelte/store';
import { get, writable } from 'svelte/store';
export type AppStore = {
theme: 'light' | 'dark' | 'auto';
@@ -15,11 +15,22 @@ export type Feedback = {
show: boolean;
};
export enum Tier {
FREE = 'free',
PRO = 'pro',
ENTERPRISE = 'enterprise'
}
export const app = writable<AppStore>({
theme: 'auto',
themeInUse: 'light'
});
//TODO: once billing is enabled on organization load/update, update the tier
export const tier = writable<Tier>(Tier.FREE);
export const isFreeTier = get(tier) === Tier.FREE;
export const isPaidTier = get(tier) === Tier.PRO || get(tier) === Tier.ENTERPRISE;
function createFeedbackStore() {
const { subscribe, update } = writable<Feedback>({
elapsed: browser ? parseInt(localStorage.getItem('feedbackElapsed')) : 0,
-8
View File
@@ -3,12 +3,6 @@ export enum Mode {
SELF_HOSTED = 'self-hosted'
}
export enum Tier {
FREE = 'free',
PRO = 'pro',
ENTERPRISE = 'enterprise'
}
export const VARS = {
APPWRITE_ENDPOINT: import.meta.env?.VITE_APPWRITE_ENDPOINT?.toString() as string | undefined,
GROWTH_ENDPOINT: import.meta.env?.VITE_APPWRITE_GROWTH_ENDPOINT?.toString() as
@@ -29,5 +23,3 @@ export const ENV = {
export const MODE = VARS.CONSOLE_MODE === Mode.CLOUD ? Mode.CLOUD : Mode.SELF_HOSTED;
export const isCloud = MODE === Mode.CLOUD;
export const isSelfHosted = MODE === Mode.SELF_HOSTED;
export const TIER = VARS;