|
13 | 13 | import { type Project } from '$lib/services';
|
14 | 14 | import Confirm from '$lib/components/Confirm.svelte';
|
15 | 15 | import { twMerge } from 'tailwind-merge';
|
16 |
| - import Search from '$lib/components/Search.svelte'; |
17 | 16 |
|
18 | 17 | let { data }: PageProps = $props();
|
19 | 18 | let toDelete = $state<Project>();
|
20 | 19 | let projects = $state(data.editorProjects);
|
21 | 20 | let shares = $state<ProjectShare[]>(data.shares.filter((s) => !s.featured));
|
22 | 21 | let featured = $state<ProjectShare[]>(data.shares.filter((s) => s.featured));
|
23 | 22 | let tools = $state(new Map(data.tools.map((t) => [t.id, t])));
|
24 |
| - let searchResults = $state<(Project | ProjectShare)[]>([]); |
25 |
| - let searchQuery = $state(''); |
26 | 23 |
|
27 | 24 | async function createNew() {
|
28 | 25 | const assistants = (await ChatService.listAssistants()).items;
|
|
44 | 41 | projects.push(newProject);
|
45 | 42 | }
|
46 | 43 |
|
47 |
| - function handleSearch(value: string) { |
48 |
| - searchQuery = value; |
49 |
| - searchResults = [...projects, ...shares, ...featured].filter( |
50 |
| - (project) => |
51 |
| - project.name?.toLowerCase().includes(value.toLowerCase()) || |
52 |
| - project.description?.toLowerCase().includes(value.toLowerCase()) |
53 |
| - ); |
54 |
| - } |
55 |
| -
|
56 | 44 | function getImage(project: Project | ProjectShare) {
|
57 | 45 | const imageUrl = darkMode.isDark
|
58 |
| - ? (project.icons?.iconDark ?? project.icons?.icon) |
| 46 | + ? project.icons?.iconDark || project.icons?.icon |
59 | 47 | : project.icons?.icon;
|
60 | 48 |
|
61 | 49 | return imageUrl ?? '/agent/images/placeholder.jpeg'; // need placeholder image
|
|
154 | 142 |
|
155 | 143 | <main class="colors-background flex w-full max-w-screen-2xl flex-col justify-center px-12 pb-12">
|
156 | 144 | <div class="mt-8 flex w-full flex-col gap-8">
|
157 |
| - <Search onChange={handleSearch} /> |
158 |
| - |
159 |
| - {#if featured.length > 0 && !searchQuery} |
| 145 | + {#if featured.length > 0} |
160 | 146 | <div class="flex w-full flex-col gap-4">
|
161 | 147 | <h3 class="text-2xl font-semibold">Featured</h3>
|
162 | 148 | <div class="featured-card-layout">
|
|
170 | 156 | <div class="flex w-full flex-col gap-4">
|
171 | 157 | <h3 class="text-2xl font-semibold">My Obots</h3>
|
172 | 158 | <div class="card-layout">
|
173 |
| - {#if searchQuery} |
174 |
| - {#each searchResults as project} |
175 |
| - {@render projectCard(project)} |
176 |
| - {/each} |
177 |
| - {#if searchResults.length === 0} |
178 |
| - <p class="text-gray">No results found.</p> |
179 |
| - {/if} |
180 |
| - {:else} |
181 |
| - {#each [...projects, ...shares] as project} |
182 |
| - {@render projectCard(project)} |
183 |
| - {/each} |
184 |
| - <button |
185 |
| - class="card flex items-center justify-center gap-1 shadow-md" |
186 |
| - onclick={() => createNew()} |
187 |
| - > |
188 |
| - <Plus class="h-5 w-5" /> |
189 |
| - <span class="font-semibold">Create New Obot</span> |
190 |
| - </button> |
191 |
| - {/if} |
| 159 | + {#each [...projects, ...shares] as project} |
| 160 | + {@render projectCard(project)} |
| 161 | + {/each} |
| 162 | + <button |
| 163 | + class="card flex items-center justify-center gap-1 shadow-md" |
| 164 | + onclick={() => createNew()} |
| 165 | + > |
| 166 | + <Plus class="h-5 w-5" /> |
| 167 | + <span class="font-semibold">Create New Obot</span> |
| 168 | + </button> |
192 | 169 | </div>
|
193 | 170 | </div>
|
194 | 171 | </div>
|
|
0 commit comments