File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed
apps/desktop/src/components/settings/template Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change @@ -3,10 +3,14 @@ import { cn } from "@hypr/utils";
33export 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 ) ;
You can’t perform that action at this time.
0 commit comments