chore: add prefix keys

This commit is contained in:
Christy Jacob
2024-02-29 21:12:00 +05:30
parent 719e4dba7f
commit c35ff02df7
9 changed files with 80 additions and 45 deletions
+1
View File
@@ -18,6 +18,7 @@ const groups = [
'databases',
'functions',
'messaging',
'messages',
'providers',
'topics',
'storage',
+15 -2
View File
@@ -18,6 +18,19 @@ const getLabel = (message) => {
}
};
const getIcon = (message) => {
switch (message.providerType) {
case MessagingProviderType.Push:
return 'device-mobile';
case MessagingProviderType.Sms:
return 'annotation';
case MessagingProviderType.Email:
return 'mail';
default:
return 'send';
}
}
export const messagesSearcher = (async (query: string) => {
const { messages } = await sdk.forProject.messaging.listMessages([], query || undefined);
@@ -29,12 +42,12 @@ export const messagesSearcher = (async (query: string) => {
.map(
(message) =>
({
group: 'messaging',
group: 'messages',
label: getLabel(message),
callback: () => {
goto(`/console/project-${projectId}/messaging/message-${message.$id}`);
},
icon: 'send',
icon: getIcon(message),
}) as const
);
}) satisfies Searcher;
+14 -1
View File
@@ -4,6 +4,19 @@ import { get } from 'svelte/store';
import type { Searcher } from '../commands';
import { sdk } from '$lib/stores/sdk';
const getIcon = (provider) => {
switch (provider.type) {
case MessagingProviderType.Push:
return 'device-mobile';
case MessagingProviderType.Sms:
return 'annotation';
case MessagingProviderType.Email:
return 'mail';
default:
return 'send';
}
}
export const providersSearcher = (async (query: string) => {
const { providers } = await sdk.forProject.messaging.listProviders([], query || undefined);
@@ -20,7 +33,7 @@ export const providersSearcher = (async (query: string) => {
callback: () => {
goto(`/console/project-${projectId}/messaging/providers/provider-${provider.$id}`);
},
icon: 'cloud',
icon: getIcon(provider),
}) as const
);
}) satisfies Searcher;
-21
View File
@@ -1,29 +1,8 @@
<script>
import { addSubPanel, registerCommands } from '$lib/commandCenter';
import { TeamsPanel, UsersPanel } from '$lib/commandCenter/panels';
import { Container } from '$lib/layout';
import { loading } from '../store';
loading.set(false);
$registerCommands([
{
label: 'Find users',
callback: () => {
addSubPanel(UsersPanel);
},
group: 'users',
rank: -1
},
{
label: 'Find teams',
callback: () => {
addSubPanel(TeamsPanel);
},
group: 'teams',
rank: -1
}
]);
</script>
<Container>
+4 -4
View File
@@ -56,7 +56,7 @@
$: $registerCommands([
{
label: 'Go to projects',
label: 'Go to Projects',
callback: () => {
goto('/console');
},
@@ -66,7 +66,7 @@
$page.url.pathname.includes('/console/organization-') &&
!$page.url.pathname.endsWith('/members') &&
!$page.url.pathname.endsWith('/settings'),
rank: -1
rank: -1
},
{
label: 'Ask the AI',
@@ -78,11 +78,11 @@
disabled: !isAssistantEnabled
},
{
label: 'Go to account',
label: 'Go to Account',
callback: () => {
goto('/console/account');
},
keys: ['i'],
keys: ['g', 'i'],
group: 'navigation',
rank: -2
},
@@ -15,6 +15,7 @@
userSearcher
} from '$lib/commandCenter/searchers';
import { MigrationBox } from '$lib/components';
import { page } from '$app/stores';
onMount(() => {
return sdk.forConsole.client.subscribe(['project', 'console'], (response) => {
@@ -32,7 +33,7 @@
callback: () => {
goto(`/console/project-${$project.$id}/auth`);
},
keys: ['a'],
keys: ['g', 'a'],
group: 'navigation'
},
{
@@ -40,7 +41,7 @@
callback: () => {
goto(`/console/project-${$project.$id}/databases`);
},
keys: ['d'],
keys: ['g', 'd'],
group: 'navigation'
},
{
@@ -48,7 +49,7 @@
callback: () => {
goto(`/console/project-${$project.$id}/functions`);
},
keys: ['f'],
keys: ['g', 'f'],
group: 'navigation'
},
{
@@ -56,7 +57,7 @@
callback: () => {
goto(`/console/project-${$project.$id}/messaging`);
},
keys: ['m'],
keys: $page.url.pathname.includes('messaging') ? ['m'] : ['g', 'm'],
group: 'navigation'
},
{
@@ -64,23 +65,23 @@
callback: () => {
goto(`/console/project-${$project.$id}/storage`);
},
keys: ['s'],
keys: ['g', 's'],
group: 'navigation'
},
{
label: 'Go to settings',
label: 'Go to Settings',
callback: () => {
goto(`/console/project-${$project.$id}/settings`);
},
keys: ['p'],
keys: ['g', 'e'],
group: 'navigation'
},
{
label: 'Go to overview',
label: 'Go to Overview',
callback: () => {
goto(`/console/project-${$project.$id}`);
},
keys: ['o'],
keys: ['g', 'o'],
group: 'navigation'
}
]);
@@ -1,7 +1,8 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { registerCommands, updateCommandGroupRanks } from '$lib/commandCenter';
import { addSubPanel, registerCommands, updateCommandGroupRanks } from '$lib/commandCenter';
import { TeamsPanel, UsersPanel } from '$lib/commandCenter/panels';
import { readOnly } from '$lib/stores/billing';
import { GRACE_PERIOD_OVERRIDE } from '$lib/system';
import { project } from '../store';
@@ -77,6 +78,22 @@
group: 'navigation',
rank: 1,
disabled: $page.url.pathname.endsWith('settings')
},
{
label: 'Find users',
callback: () => {
addSubPanel(UsersPanel);
},
group: 'users',
rank: -1
},
{
label: 'Find teams',
callback: () => {
addSubPanel(TeamsPanel);
},
group: 'teams',
rank: -1
}
]);
@@ -26,19 +26,20 @@
},
disabled:
$page.url.pathname.endsWith('topics') || $page.url.pathname.includes('message-'),
group: 'navigation',
group: 'messaging',
rank: 1,
},
{
label: 'Go to Providers',
keys: ['g', 'k'],
keys: ['g', 'p'],
callback() {
goto(`/console/project-${$project.$id}/messaging/providers`);
},
disabled:
$page.url.pathname.endsWith('providers') || $page.url.pathname.includes('message-'),
group: 'navigation',
group: 'messaging',
rank: 2,
forceEnable: true
}
]);
@@ -8,7 +8,7 @@
$: $registerCommands([
{
label: 'Go to subscribers',
label: 'Go to Subscribers',
callback() {
goto(
`/console/project-${$project.$id}/messaging/topics/topic-${topicId}/subscribers`
@@ -16,17 +16,27 @@
},
keys: ['g', 's'],
disabled: $page.url.pathname.endsWith('subscribers'),
group: 'navigation',
group: 'topics',
rank: 1
},
{
label: 'Go to activity',
label: 'Go to Activity',
callback() {
goto(`/console/project-${$project.$id}/messaging/topics/topic-${topicId}/activity`);
},
keys: ['g', 'a'],
disabled: $page.url.pathname.endsWith('activity'),
group: 'navigation',
group: 'topics',
rank: 1
},
{
label: 'Go to Overview',
callback() {
goto(`/console/project-${$project.$id}/messaging/topics/topic-${topicId}`);
},
keys: ['g', 'o'],
disabled: $page.url.pathname.endsWith(`topic-${topicId}`),
group: 'topics',
rank: 1
}
]);