From 093a98a109a3fdc53a9f628eac4a252413c28415 Mon Sep 17 00:00:00 2001 From: ernstmul Date: Thu, 3 Apr 2025 10:52:30 +0200 Subject: [PATCH 1/3] Resizing of chat --- src/lib/components/chat.svelte | 18 +++----- src/lib/layout/shellStudio.svelte | 73 ++++++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 14 deletions(-) diff --git a/src/lib/components/chat.svelte b/src/lib/components/chat.svelte index c8877ba23..758fd570f 100644 --- a/src/lib/components/chat.svelte +++ b/src/lib/components/chat.svelte @@ -3,9 +3,10 @@ import { IconArrowUp, IconChevronLeft, IconPaperClip } from '@appwrite.io/pink-icons-svelte'; export let showChat; + export let width; -
+
@@ -49,7 +50,8 @@
-
+
+
From 85c1b376da150bd9dc210eb2f99825751b8e8dec Mon Sep 17 00:00:00 2001 From: ernstmul Date: Thu, 3 Apr 2025 13:55:19 +0200 Subject: [PATCH 2/3] Add terminal screen --- package.json | 1 + pnpm-lock.yaml | 8 + src/lib/components/index.ts | 1 + src/lib/components/studio/terminal.svelte | 28 ++++ src/lib/layout/shellStudio.svelte | 2 + .../project-[project]/builder/+page.svelte | 139 +++++++++++++++++- 6 files changed, 177 insertions(+), 2 deletions(-) create mode 100644 src/lib/components/studio/terminal.svelte diff --git a/package.json b/package.json index ada91dd38..9504d21bf 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@popperjs/core": "^2.11.8", "@sentry/sveltekit": "^8.38.0", "@stripe/stripe-js": "^3.5.0", + "@xterm/xterm": "^5.5.0", "ai": "^2.2.37", "analytics": "^0.8.16", "cron-parser": "^4.9.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fdcf03169..d54b2704f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,6 +32,9 @@ importers: '@stripe/stripe-js': specifier: ^3.5.0 version: 3.5.0 + '@xterm/xterm': + specifier: ^5.5.0 + version: 5.5.0 ai: specifier: ^2.2.37 version: 2.2.37(react@18.3.1)(solid-js@1.9.5)(svelte@5.25.3)(vue@3.5.13(typescript@5.8.2)) @@ -1424,6 +1427,9 @@ packages: '@vue/shared@3.5.13': resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==} + '@xterm/xterm@5.5.0': + resolution: {integrity: sha512-hqJHYaQb5OptNunnyAnkHyM8aCjZ1MEIDTQu1iIbbTD/xops91NB5yq1ZK/dC2JDbVWtF23zUtl9JE2NqwT87A==} + acorn-import-attributes@1.9.5: resolution: {integrity: sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==} peerDependencies: @@ -4816,6 +4822,8 @@ snapshots: '@vue/shared@3.5.13': {} + '@xterm/xterm@5.5.0': {} + acorn-import-attributes@1.9.5(acorn@8.14.1): dependencies: acorn: 8.14.1 diff --git a/src/lib/components/index.ts b/src/lib/components/index.ts index c49202c02..d6016680c 100644 --- a/src/lib/components/index.ts +++ b/src/lib/components/index.ts @@ -82,3 +82,4 @@ export { default as BottomSheet } from './bottom-sheet/index'; export { default as Confirm } from './confirm.svelte'; export { default as UsageCard } from './usageCard.svelte'; export { default as Chat } from './chat.svelte'; +export { default as Terminal } from './studio/terminal.svelte'; diff --git a/src/lib/components/studio/terminal.svelte b/src/lib/components/studio/terminal.svelte new file mode 100644 index 000000000..e5fca9d8b --- /dev/null +++ b/src/lib/components/studio/terminal.svelte @@ -0,0 +1,28 @@ + + +
+ +
+ + diff --git a/src/lib/layout/shellStudio.svelte b/src/lib/layout/shellStudio.svelte index 131575ffd..31586e16c 100644 --- a/src/lib/layout/shellStudio.svelte +++ b/src/lib/layout/shellStudio.svelte @@ -39,6 +39,7 @@ window.addEventListener('mousemove', resize); window.addEventListener('mouseup', stopResize); document.body.style.userSelect = 'none'; + document.getElementById('preview-iframe').style.pointerEvents = 'none'; } function resize(event) { @@ -55,6 +56,7 @@ window.removeEventListener('mousemove', resize); window.removeEventListener('mouseup', stopResize); document.body.style.userSelect = ''; + document.getElementById('preview-iframe').style.pointerEvents = ''; } diff --git a/src/routes/(console)/project-[project]/builder/+page.svelte b/src/routes/(console)/project-[project]/builder/+page.svelte index 9214bdda7..1648d4571 100644 --- a/src/routes/(console)/project-[project]/builder/+page.svelte +++ b/src/routes/(console)/project-[project]/builder/+page.svelte @@ -1,5 +1,140 @@ -Iframe + + + + {#each tabs as tab} + + {tab.title} + + {/each} + + + + + + + + +
+
+
+ +
+
+ {#if terminalOpen}
+ {/if} + +
+ + From 17cd889f6adbc0e9becbc94509b8f8e91ed508a8 Mon Sep 17 00:00:00 2001 From: ernstmul Date: Thu, 3 Apr 2025 14:07:23 +0200 Subject: [PATCH 3/3] Setup idea for profiles --- src/lib/profiles.ts | 39 +++++++++++++++++++++++++++++ src/lib/system.ts | 12 +++++++++ src/routes/(console)/+layout.svelte | 4 +-- 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 src/lib/profiles.ts diff --git a/src/lib/profiles.ts b/src/lib/profiles.ts new file mode 100644 index 000000000..4fb91b0a9 --- /dev/null +++ b/src/lib/profiles.ts @@ -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 +}; diff --git a/src/lib/system.ts b/src/lib/system.ts index 8cd3a70f3..e3808b221 100644 --- a/src/lib/system.ts +++ b/src/lib/system.ts @@ -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(); diff --git a/src/routes/(console)/+layout.svelte b/src/routes/(console)/+layout.svelte index 21230e6ff..184e5473f 100644 --- a/src/routes/(console)/+layout.svelte +++ b/src/routes/(console)/+layout.svelte @@ -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 @@ -{#if isStudio} +{#if consoleProfile.hasChatLayout} {:else}