Skip to content

Commit acf1716

Browse files
committed
fix: update ListingComponent to display correct profile images for datasets and improve loading component usage
1 parent b36e104 commit acf1716

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

app/[locale]/(user)/components/ListingComponent.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import {
1717
import { cn, formatDate } from '@/lib/utils';
1818
import BreadCrumbs from '@/components/BreadCrumbs';
1919
import { Icons } from '@/components/icons';
20+
import { Loading } from '@/components/loading';
2021
import Filter from '../datasets/components/FIlter/Filter';
2122
import Styles from '../datasets/dataset.module.scss';
22-
import { Loading } from '@/components/loading';
2323

2424
// Interfaces
2525
interface Bucket {
@@ -450,6 +450,14 @@ const ListingComponent: React.FC<ListingProps> = ({
450450
view={view}
451451
>
452452
{datasetDetails.map((item: any) => {
453+
const image = item.is_individual_dataset
454+
? item?.user?.profile_picture
455+
? `${process.env.NEXT_PUBLIC_BACKEND_URL}/${item.user.profile_picture}`
456+
: '/profile.png'
457+
: item?.organization?.logo
458+
? `${process.env.NEXT_PUBLIC_BACKEND_URL}/${item.organization.logo}`
459+
: '/org.png';
460+
453461
const commonProps = {
454462
title: item.title,
455463
description: item.description,
@@ -477,7 +485,7 @@ const ListingComponent: React.FC<ListingProps> = ({
477485
icon: `/Sectors/${item.sectors[0]}.svg`,
478486
label: 'Sectors',
479487
},
480-
{ icon: '/fallback.svg', label: 'Published by' },
488+
{ icon: image, label: 'Published by' },
481489
],
482490
};
483491

@@ -495,7 +503,7 @@ const ListingComponent: React.FC<ListingProps> = ({
495503
})}
496504
</GraphqlPagination>
497505
) : (
498-
<Loading/>
506+
<Loading />
499507
)}
500508
</div>
501509
</div>

0 commit comments

Comments
 (0)