Skip to content

Commit d63c9c3

Browse files
committed
Add cover image model hub screen
1 parent f3fbade commit d63c9c3

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

core/src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ export type ModelMetadata = {
240240
author: string;
241241
tags: string[];
242242
size: number;
243+
cover?: string;
243244
};
244245

245246
/**

web/screens/ExploreModels/ExploreModelItemHeader/index.tsx

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,30 @@ const ExploreModelItemHeader: React.FC<Props> = ({ model, onClick, open }) => {
9898

9999
return (
100100
<div
101-
className="flex cursor-pointer items-center justify-between rounded-t-md bg-background/50 px-4 py-4"
101+
className="cursor-pointer rounded-t-md bg-background/50"
102102
onClick={onClick}
103103
>
104-
<div className="flex items-center gap-2">
105-
<span className="font-bold">{model.name}</span>
106-
</div>
107-
<div className="inline-flex items-center space-x-2">
108-
<span className="mr-4 font-semibold text-muted-foreground">
109-
{toGigabytes(model.metadata.size)}
110-
</span>
111-
{downloadButton}
112-
<ChevronDownIcon
113-
className={twMerge(
114-
'h-5 w-5 flex-none text-gray-400',
115-
open === model.id && 'rotate-180'
116-
)}
117-
/>
104+
{model.metadata.cover && (
105+
<div className="relative h-full w-full">
106+
<img src={model.metadata.cover} alt={`Cover - ${model.id}`} />
107+
</div>
108+
)}
109+
<div className="flex items-center justify-between p-4">
110+
<div className="flex items-center gap-2">
111+
<span className="font-bold">{model.name}</span>
112+
</div>
113+
<div className="inline-flex items-center space-x-2">
114+
<span className="mr-4 font-semibold text-muted-foreground">
115+
{toGigabytes(model.metadata.size)}
116+
</span>
117+
{downloadButton}
118+
<ChevronDownIcon
119+
className={twMerge(
120+
'h-5 w-5 flex-none text-gray-400',
121+
open === model.id && 'rotate-180'
122+
)}
123+
/>
124+
</div>
118125
</div>
119126
</div>
120127
)

0 commit comments

Comments
 (0)