mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Setup idea for profiles
This commit is contained in:
@@ -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
|
||||
};
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user