From 4297579d368b229b61c7e9e6db30ddc8576c9241 Mon Sep 17 00:00:00 2001 From: wadhia-yash Date: Fri, 9 Aug 2024 16:01:09 +0530 Subject: [PATCH 1/4] feat(Agent settings): Showing list of data sources in the settings popup --- web/src/lib/components/SettingsAgent.svelte | 167 ++++++++++++++++++++ web/src/lib/types/Agent.ts | 7 + web/src/routes/+page.svelte | 26 +++ 3 files changed, 200 insertions(+) create mode 100644 web/src/lib/components/SettingsAgent.svelte diff --git a/web/src/lib/components/SettingsAgent.svelte b/web/src/lib/components/SettingsAgent.svelte new file mode 100644 index 00000000..384c5e26 --- /dev/null +++ b/web/src/lib/components/SettingsAgent.svelte @@ -0,0 +1,167 @@ + + +{#if showModalSettings} +
+ +
+
+

Settings

+ +
+
+

+ Options +

+
+
+
+
+ Avatar +
+
+

+ {currentAgent.metadata.display_name} +

+ +
+

+ {currentAgent.description} +

+

+ Created by {currentAgent.author.name} +

+
+
+ +
+
+
+
+
+{/if} diff --git a/web/src/lib/types/Agent.ts b/web/src/lib/types/Agent.ts index 8c2b2de4..aaf33bbe 100644 --- a/web/src/lib/types/Agent.ts +++ b/web/src/lib/types/Agent.ts @@ -19,6 +19,13 @@ export type Agent = { tags: string [], version: string, }, + data_sources: { + id: string, + uri: { + type: string, + uri: string + }[] + }[], min_cli_version: string, name: string, publisher_id: string, diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte index 1cc797da..346dc05b 100644 --- a/web/src/routes/+page.svelte +++ b/web/src/routes/+page.svelte @@ -5,17 +5,22 @@ import CarbonSearch from "~icons/carbon/search"; import CarbonAdd from "~icons/carbon/add"; import CarbonGithub from "~icons/carbon/logo-github"; + import CarbonSettings from "~icons/carbon/settings"; + import type { Agent } from "$lib/types/Agent"; import { goto } from "$app/navigation"; import { debounce } from "$lib/utils/debounce"; import { base } from "$app/paths"; import CreateAgentDialog from "$lib/components/CreateAgentDialog.svelte"; + import SettingsAgent from "$lib/components/SettingsAgent.svelte"; const SEARCH_DEBOUNCE_DELAY = 400; let agents: Agent[] = []; let filteredAgents: Agent[] = []; let searchValue: string = ""; let showModal: boolean = false; + let showModalSettings: boolean = false; + let currentAgent: Agent; $: loading = true; @@ -72,6 +77,12 @@ ? formattedText.slice(0, maxLength) + "..." : formattedText; }; + + const onSettingsClicked = (e: MouseEvent, _agent: Agent) => { + e.stopPropagation(); + showModalSettings = true; + currentAgent = _agent + }; @@ -152,6 +163,13 @@ class="relative flex flex-col items-center justify-center overflow-hidden text-balance rounded-xl border bg-gray-50/50 px-4 py-6 text-center shadow hover:bg-gray-50 hover:shadow-inner max-sm:px-4 sm:h-64 sm:pb-4 xl:pt-8 dark:border-gray-800/70 dark:bg-gray-950/20 dark:hover:bg-gray-950/40" on:click={() => navigateAgents(agent)} > +
onSettingsClicked(e, agent)} + > + +
Avatar + { + showModalSettings = false; + }} +/> +