diff --git a/src/lib/commandCenter/panels/ai.svelte b/src/lib/commandCenter/panels/ai.svelte index 63dfbd6781..44f6f753dc 100644 --- a/src/lib/commandCenter/panels/ai.svelte +++ b/src/lib/commandCenter/panels/ai.svelte @@ -1,17 +1,18 @@ -
+
{#if label} @@ -79,11 +80,19 @@ } } + .noBoxPadding { + padding: 0 !important; + } + .with-scroll { height: 100%; overflow: auto; } + pre { + padding-inline-end: 7rem !important; // Add space for label and copy btn + } + code, pre { &[class*='language-'] { @@ -116,7 +125,7 @@ :not(pre) > code[class*='language-'], pre[class*='language-'] { background: hsl(var(--p-box-background-color)); - padding-block-start: 4%; + margin: 0; } .prism-token { diff --git a/src/lib/stores/preferences.ts b/src/lib/stores/preferences.ts index 38b45513a4..45d1ab412c 100644 --- a/src/lib/stores/preferences.ts +++ b/src/lib/stores/preferences.ts @@ -6,6 +6,7 @@ import { get, writable } from 'svelte/store'; import { sdk } from './sdk'; import type { Models } from '@appwrite.io/console'; import { organization } from './organization'; +import { onDestroy } from 'svelte'; type Preferences = { limit?: number; @@ -27,31 +28,39 @@ type PreferencesStore = { [key: string]: TeamPreferences['names']; }; }; -}; +} & { hideAiDisclaimer?: boolean }; function createPreferences() { const { subscribe, set, update } = writable({}); + let preferences: PreferencesStore = {}; + if (browser) { set(JSON.parse(globalThis.localStorage.getItem('preferences') ?? '{}')); } + + subscribe((v) => { + preferences = v; + if (browser) { + globalThis.localStorage.setItem('preferences', JSON.stringify(v)); + } + }); + return { subscribe, - get: (route: Page['route']): Preferences => { - let preferences: PreferencesStore; - subscribe((n) => (preferences = n))(); - + set, + update, + get: (route?: Page['route']): Preferences => { + const parsedRoute = route ?? get(page).route; return ( - preferences[sdk.forProject.client.config.project]?.[route.id] ?? { + preferences[sdk.forProject.client.config.project]?.[parsedRoute.id] ?? { limit: null, view: null, columns: null } ); }, - getCustomCollectionColumns: (collectionId: string): Preferences['columns'] => { - let preferences: PreferencesStore; - subscribe((n) => (preferences = n))(); + getCustomCollectionColumns: (collectionId: string): Preferences['columns'] => { return ( preferences[sdk.forProject.client.config.project]?.collections?.[collectionId] ?? null @@ -122,9 +131,7 @@ function createPreferences() { getDisplayNames: () => { const id = get(organization)?.$id; if (!id) return {}; - let preferences: PreferencesStore; - subscribe((n) => (preferences = n))(); return preferences?.[id]?.displayNames ?? {}; }, setDisplayNames: async (collectionId: string, names: TeamPreferences['names']) => { @@ -147,7 +154,3 @@ function createPreferences() { } export const preferences = createPreferences(); - -if (browser) { - preferences.subscribe((n) => globalThis.localStorage.setItem('preferences', JSON.stringify(n))); -} diff --git a/src/routes/auth/+layout.svelte b/src/routes/auth/+layout.svelte index f2ffcf1d24..68866be64d 100644 --- a/src/routes/auth/+layout.svelte +++ b/src/routes/auth/+layout.svelte @@ -1,8 +1,29 @@ diff --git a/src/routes/console/+layout.svelte b/src/routes/console/+layout.svelte index c3bd1b9382..cf229d45e4 100644 --- a/src/routes/console/+layout.svelte +++ b/src/routes/console/+layout.svelte @@ -17,7 +17,7 @@ import { goto } from '$app/navigation'; import { CommandCenter, registerCommands, registerSearchers } from '$lib/commandCenter'; - import { AIPanel } from '$lib/commandCenter/panels'; + import { AIPanel, OrganizationsPanel, ProjectsPanel } from '$lib/commandCenter/panels'; import { orgSearcher, projectsSearcher } from '$lib/commandCenter/searchers'; import { addSubPanel } from '$lib/commandCenter/subPanels'; import { addNotification } from '$lib/stores/notifications'; @@ -205,6 +205,23 @@ disabled: isOnSettingsLayout && $page.url.pathname.includes('smtp'), group: isOnSettingsLayout ? 'navigation' : 'settings', rank: -1 + }, + // Searcher panels + { + label: 'Find organizations', + callback: () => { + addSubPanel(OrganizationsPanel); + }, + group: 'organizations', + rank: -1 + }, + { + label: 'Find projects', + callback: () => { + addSubPanel(ProjectsPanel); + }, + group: 'projects', + rank: -1 } ]); let isOpen = false; diff --git a/src/routes/console/project-[project]/databases/+layout.svelte b/src/routes/console/project-[project]/databases/+layout.svelte index 1d101a6557..439c5e488f 100644 --- a/src/routes/console/project-[project]/databases/+layout.svelte +++ b/src/routes/console/project-[project]/databases/+layout.svelte @@ -1,7 +1,8 @@ + Functions - Appwrite diff --git a/src/routes/console/project-[project]/functions/+page.svelte b/src/routes/console/project-[project]/functions/+page.svelte index b7466f1c8c..5cd83a8e06 100644 --- a/src/routes/console/project-[project]/functions/+page.svelte +++ b/src/routes/console/project-[project]/functions/+page.svelte @@ -17,7 +17,7 @@ import { wizard } from '$lib/stores/wizard'; import { onMount } from 'svelte'; import Initial from '$lib/wizards/functions/cover.svelte'; - import { registerCommands } from '$lib/commandCenter'; + import { registerCommands, updateCommandGroupRanks } from '$lib/commandCenter'; import CreateTemplate from '$lib/wizards/functions/createTemplate.svelte'; import { templateConfig as templateConfigStore, @@ -63,9 +63,12 @@ callback: openWizard, keys: ['c'], disabled: $wizard.show, - icon: 'plus' + icon: 'plus', + group: 'functions' } ]); + + $updateCommandGroupRanks({ functions: 1000 }); diff --git a/src/routes/console/project-[project]/storage/+layout.svelte b/src/routes/console/project-[project]/storage/+layout.svelte index 8a12d0d0f8..ef71811138 100644 --- a/src/routes/console/project-[project]/storage/+layout.svelte +++ b/src/routes/console/project-[project]/storage/+layout.svelte @@ -1,7 +1,8 @@