Skip to content

Commit 593bbc1

Browse files
templates rendering
1 parent 34b7762 commit 593bbc1

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

apps/desktop/src/components/settings/template/remote.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ function TemplateList({ templates }: { templates: main.Template[] }) {
2929
key={index}
3030
title={template.title}
3131
description={template.description}
32+
category={template.category}
33+
targets={template.targets}
3234
onClick={() =>
3335
cloneAndEdit({
3436
title: template.title,
@@ -56,7 +58,15 @@ function useSuggestedTemplates(query: string) {
5658
return data;
5759
}
5860

59-
return data.filter((template) => template.title.includes(query));
61+
const lowerQuery = query.toLowerCase();
62+
63+
return data.filter((template) => {
64+
const titleMatch = template.title.toLowerCase().includes(lowerQuery);
65+
const categoryMatch = template.category?.toLowerCase().includes(lowerQuery);
66+
const targetsMatch = template.targets?.some((target) => target.toLowerCase().includes(lowerQuery));
67+
68+
return titleMatch || categoryMatch || targetsMatch;
69+
});
6070
},
6171
});
6272
}

apps/desktop/src/components/settings/template/shared.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import { cn } from "@hypr/utils";
33
export function TemplateCard({
44
title,
55
description,
6+
category,
7+
targets,
68
onClick,
79
}: {
810
title?: string | null;
911
description?: string | null;
12+
category?: string | null;
13+
targets?: string[] | null;
1014
onClick?: () => void;
1115
}) {
1216
const displayTitle = title?.trim() ? title : "Untitled";
@@ -34,8 +38,22 @@ export function TemplateCard({
3438
])}
3539
>
3640
<div className="flex-1">
37-
<h3 className="text-sm font-medium mb-1">{displayTitle}</h3>
38-
<p className="text-xs text-neutral-600">{displayDescription}</p>
41+
<h3 className="text-sm font-medium mb-2 inline-flex items-center gap-1">
42+
<span>{displayTitle}</span>
43+
{category && (
44+
<span className="text-stone-400">
45+
- {category}
46+
</span>
47+
)}
48+
</h3>
49+
<p className="text-xs text-neutral-600 mb-2">{displayDescription}</p>
50+
<div className="flex items-center gap-2 flex-wrap">
51+
{targets?.map((target, index) => (
52+
<span key={index} className="text-xs text-neutral-600 bg-neutral-100 px-2 py-0.5 rounded">
53+
{target}
54+
</span>
55+
))}
56+
</div>
3957
</div>
4058
</div>
4159
);

0 commit comments

Comments
 (0)