Skip to content

Commit

Permalink
chore: update hub search result (#3273)
Browse files Browse the repository at this point in the history
  • Loading branch information
urmauur authored Aug 6, 2024
1 parent db5d8ab commit 10b4a90
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 11 deletions.
55 changes: 45 additions & 10 deletions web/screens/HubScreen2/components/HubScreenFilter/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { Fragment } from 'react'

import Image from 'next/image'

import BlankState from '@/containers/BlankState'

import useModelHub from '@/hooks/useModelHub'
Expand Down Expand Up @@ -43,23 +47,54 @@ const HubScreenFilter: React.FC<Props> = ({ queryText }) => {
filteredHuggingFaceModels.length === 0 &&
filteredRemoteModels.length === 0

const isOnDevice =
filteredBuiltInModels.length > 0 || filteredHuggingFaceModels.length > 0

return (
<div className="h-full w-full overflow-x-hidden rounded-lg bg-[hsla(var(--app-bg))]">
{isResultEmpty ? (
<div className="py-6">
<BlankState title="No search results found" />
</div>
) : (
<div className="mx-auto flex h-full w-full max-w-[650px] flex-col gap-6 py-6">
{filteredBuiltInModels.map((hfModelEntry) => (
<BuiltInModelCard key={hfModelEntry.id} {...hfModelEntry} />
))}
{filteredHuggingFaceModels.map((hfModelEntry) => (
<HuggingFaceModelCard key={hfModelEntry.id} {...hfModelEntry} />
))}
{filteredRemoteModels.map((hfModelEntry) => (
<RemoteModelCard key={hfModelEntry.id} {...hfModelEntry} />
))}
<div className="mx-auto mt-6 flex h-full w-full max-w-[650px] flex-col gap-6 py-6">
{isOnDevice && (
<Fragment>
<div className="mt-4 flex items-center gap-2 first:mt-0">
<Image
width={24}
height={24}
src="icons/app_icon.svg"
alt="Built-In Models"
/>
<h1 className="text-lg font-semibold">On-Device Models</h1>
</div>
<div className="w-full">
{filteredBuiltInModels.map((hfModelEntry) => (
<BuiltInModelCard key={hfModelEntry.id} {...hfModelEntry} />
))}
{filteredHuggingFaceModels.map((hfModelEntry) => (
<HuggingFaceModelCard
key={hfModelEntry.id}
{...hfModelEntry}
/>
))}
</div>
</Fragment>
)}

{filteredRemoteModels.length > 0 && (
<Fragment>
<div className="mt-4 flex items-center gap-2 first:mt-0">
<h1 className="text-lg font-semibold">Cloud Models</h1>
</div>
<div className="w-full">
{filteredRemoteModels.map((hfModelEntry) => (
<RemoteModelCard key={hfModelEntry.id} {...hfModelEntry} />
))}
</div>
</Fragment>
)}
</div>
)}
</div>
Expand Down
8 changes: 7 additions & 1 deletion web/screens/HubScreen2/components/RemoteModelGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ const RemoteModelGroup: React.FC<Props> = ({ data, engine, onSeeAllClick }) => {
<Fragment>
<div className="mt-12 flex items-center gap-2 first:mt-0">
{engineLogo && (
<Image width={24} height={24} src={engineLogo} alt="Engine logo" />
<Image
width={24}
height={24}
src={engineLogo}
alt="Engine logo"
className="rounded-full"
/>
)}
<h1 className="text-lg font-semibold">{refinedTitle}</h1>

Expand Down

0 comments on commit 10b4a90

Please sign in to comment.