Skip to content

Commit 59db081

Browse files
authored
fix: remove search & dark mode default to icon if darkMode icon not present (#1987)
* fix: remove search & dark mode default to icon if darkMode icon not present * Update +page.svelte
1 parent d95f0fd commit 59db081

File tree

1 file changed

+12
-35
lines changed

1 file changed

+12
-35
lines changed

ui/user/src/routes/home/+page.svelte

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@
1313
import { type Project } from '$lib/services';
1414
import Confirm from '$lib/components/Confirm.svelte';
1515
import { twMerge } from 'tailwind-merge';
16-
import Search from '$lib/components/Search.svelte';
1716
1817
let { data }: PageProps = $props();
1918
let toDelete = $state<Project>();
2019
let projects = $state(data.editorProjects);
2120
let shares = $state<ProjectShare[]>(data.shares.filter((s) => !s.featured));
2221
let featured = $state<ProjectShare[]>(data.shares.filter((s) => s.featured));
2322
let tools = $state(new Map(data.tools.map((t) => [t.id, t])));
24-
let searchResults = $state<(Project | ProjectShare)[]>([]);
25-
let searchQuery = $state('');
2623
2724
async function createNew() {
2825
const assistants = (await ChatService.listAssistants()).items;
@@ -44,18 +41,9 @@
4441
projects.push(newProject);
4542
}
4643
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-
5644
function getImage(project: Project | ProjectShare) {
5745
const imageUrl = darkMode.isDark
58-
? (project.icons?.iconDark ?? project.icons?.icon)
46+
? project.icons?.iconDark || project.icons?.icon
5947
: project.icons?.icon;
6048
6149
return imageUrl ?? '/agent/images/placeholder.jpeg'; // need placeholder image
@@ -154,9 +142,7 @@
154142

155143
<main class="colors-background flex w-full max-w-screen-2xl flex-col justify-center px-12 pb-12">
156144
<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}
160146
<div class="flex w-full flex-col gap-4">
161147
<h3 class="text-2xl font-semibold">Featured</h3>
162148
<div class="featured-card-layout">
@@ -170,25 +156,16 @@
170156
<div class="flex w-full flex-col gap-4">
171157
<h3 class="text-2xl font-semibold">My Obots</h3>
172158
<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>
192169
</div>
193170
</div>
194171
</div>

0 commit comments

Comments
 (0)