chore: add images for providers results

This commit is contained in:
Christy Jacob committed 2024-03-01 00:22:12 +05:30
1 parent 217b27a189
commit 2c54c12efc
6 files changed
+20 -19

No files matched your search

+1
View File
@@ -49,6 +49,7 @@ type BaseCommand = {
forceEnable?: boolean;
group?: CommandGroup;
icon?: string;
image?: string;
rank?: number;
nested?: boolean;
keepOpen?: boolean;
+9 -1
View File
@@ -2,6 +2,8 @@
This is the root command panel. It precedes all other command panels.
-->
<script lang="ts">
import { base } from '$app/paths';
import { app } from '$lib/stores/app';
import { debounce } from '$lib/helpers/debounce';
import { isMac } from '$lib/helpers/platform';
import { commands, searchers, type Command, isKeyedCommand } from '../commands';
@@ -54,7 +56,13 @@
<Template options={results} bind:search searchPlaceholder="Search for commands or content...">
<div slot="option" class="u-flex u-main-space-between content" let:option={command}>
<div class="u-flex u-gap-8 u-cross-center">
<i class="icon-{command.icon ?? 'arrow-sm-right'}" />
{#if command.image}
<img
src={`${base}/icons/${$app.themeInUse}/color/${command.image}.svg`}
alt={command.label} />
{:else}
<i class="icon-{command.icon ?? 'arrow-sm-right'}" />
{/if}
<span>
{command.label}
</span>
+1 -2
View File
@@ -1,7 +1,7 @@
import { goto } from '$app/navigation';
import { project } from '$routes/console/project-[project]/store';
import { get } from 'svelte/store';
import type { Searcher } from '../commands';
import { type Searcher } from '../commands';
import { sdk } from '$lib/stores/sdk';
import { MessagingProviderType } from '@appwrite.io/console';
@@ -34,7 +34,6 @@ const getIcon = (message) => {
export const messagesSearcher = (async (query: string) => {
const { messages } = await sdk.forProject.messaging.listMessages([], query || undefined);
console.log(messages);
const projectId = get(project).$id;
return messages
+6 -14
View File
@@ -3,24 +3,16 @@ import { project } from '$routes/console/project-[project]/store';
import { get } from 'svelte/store';
import type { Searcher } from '../commands';
import { sdk } from '$lib/stores/sdk';
import { getProviderDisplayNameAndIcon } from '$routes/console/project-[project]/messaging/provider.svelte';
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';
}
}
const getIcon = (provider: string) => {
const { icon } = getProviderDisplayNameAndIcon(provider);
return icon;
};
export const providersSearcher = (async (query: string) => {
const { providers } = await sdk.forProject.messaging.listProviders([], query || undefined);
console.log(providers);
const projectId = get(project).$id;
return providers
@@ -33,7 +25,7 @@ export const providersSearcher = (async (query: string) => {
callback: () => {
goto(`/console/project-${projectId}/messaging/providers/provider-${provider.$id}`);
},
icon: getIcon(provider),
image: getIcon(provider.provider),
}) as const
);
}) satisfies Searcher;
+1 -1
View File
@@ -19,7 +19,7 @@ export const topicsSearcher = (async (query: string) => {
callback: () => {
goto(`/console/project-${projectId}/messaging/topics/topic-${topic.$id}`);
},
icon: 'archive',
icon: 'send',
}) as const
);
}) satisfies Searcher;
@@ -57,7 +57,8 @@
callback: () => {
goto(`/console/project-${$project.$id}/messaging`);
},
keys: $page.url.pathname.includes('messaging') ? ['m'] : ['g', 'm'],
keys:['g', 'm'],
disabled: $page.url.pathname.endsWith('messaging'),
group: 'navigation'
},
{