Setup idea for profiles

This commit is contained in:
ernstmul
2025-04-03 14:07:23 +02:00
parent 85c1b376da
commit 17cd889f6a
3 changed files with 53 additions and 2 deletions
+39
View File
@@ -0,0 +1,39 @@
type Profile = {
hasChatLayout: boolean;
hasAuth: boolean;
hasDatabases: boolean;
hasFunctions: boolean;
hasMessages: boolean;
hasStorage: boolean;
hasSites: boolean;
};
export const ConsoleCloudProfile: Profile = {
hasChatLayout: false,
hasAuth: true,
hasDatabases: true,
hasFunctions: true,
hasMessages: true,
hasStorage: true,
hasSites: true
};
export const ConsoleSelfhostedProfile: Profile = {
hasChatLayout: false,
hasAuth: true,
hasDatabases: true,
hasFunctions: true,
hasMessages: true,
hasStorage: true,
hasSites: true
};
export const StudioProfile: Profile = {
hasChatLayout: true,
hasAuth: true,
hasDatabases: true,
hasFunctions: false,
hasMessages: true,
hasStorage: true,
hasSites: true
};
+12
View File
@@ -1,5 +1,6 @@
import { env } from '$env/dynamic/public';
import { dev } from '$app/environment';
import { ConsoleCloudProfile, ConsoleSelfhostedProfile, StudioProfile } from '$lib/profiles';
export const enum Mode {
CLOUD = 'cloud',
@@ -26,6 +27,16 @@ export const ENV = {
TEST: !!import.meta.env?.VITEST
};
function getProfile() {
if (PROFILE === Profile.STUDIO) {
return StudioProfile;
} else if (MODE === Mode.CLOUD) {
return ConsoleCloudProfile;
} else {
return ConsoleSelfhostedProfile;
}
}
export const MODE = VARS.CONSOLE_MODE === Mode.CLOUD ? Mode.CLOUD : Mode.SELF_HOSTED;
export const PROFILE = VARS.PROJECT_PROFILE === Profile.CONSOLE ? Profile.CONSOLE : Profile.STUDIO;
export const isCloud = MODE === Mode.CLOUD;
@@ -35,3 +46,4 @@ export const isDev = ENV.DEV;
export const isProd = ENV.PROD;
export const hasStripePublicKey = !!VARS.PUBLIC_STRIPE_KEY;
export const GRACE_PERIOD_OVERRIDE = false;
export const consoleProfile = getProfile();
+2 -2
View File
@@ -33,7 +33,7 @@
import { openMigrationWizard } from './(migration-wizard)';
import { project } from './project-[project]/store';
import { feedback } from '$lib/stores/feedback';
import { hasStripePublicKey, isCloud, isStudio, VARS } from '$lib/system';
import { consoleProfile, hasStripePublicKey, isCloud, isStudio, VARS } from '$lib/system';
import { stripe } from '$lib/stores/stripe';
import MobileSupportModal from './wizard/support/mobileSupportModal.svelte';
import { showSupportModal } from './wizard/support/store';
@@ -330,7 +330,7 @@
</script>
<CommandCenter />
{#if isStudio}
{#if consoleProfile.hasChatLayout}
<ShellStudio bind:loadedProjects><slot /></ShellStudio>
{:else}
<Shell