Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const MetadataComponent: React.FC<MetadataProps> = ({ data, setOpen }) => {
variant="bodyLg"
fontWeight="medium"
>
{data.categories[0].name}
{data.sectors[0].name}
</Text>
</div>
{Metadata.map((item, index) => (
Expand All @@ -110,10 +110,10 @@ const MetadataComponent: React.FC<MetadataProps> = ({ data, setOpen }) => {
<div className="flex flex-col gap-4">
<Text variant="bodyMd">Description</Text>
<Text variant="bodyMd">
{data.description.length > 260 && !isexpanded
{data.description?.length > 260 && !isexpanded
? `${data.description.slice(0, 260)}...`
: data.description}
{data.description.length > 260 && (
{data.description?.length > 260 && (
<Button
kind="tertiary"
size="slim"
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/(user)/datasets/[datasetIdentifier]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const datasetQuery = graphql(`
slug
id
}
categories {
sectors {
name
}
formats
Expand Down
6 changes: 3 additions & 3 deletions app/[locale]/(user)/datasets/components/Card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface Dataset {
id: string;
metadata: MetadataEntry[];
tags: string[];
categories: string[];
sectors: string[];
formats: string[];
has_charts: boolean,
title: string;
Expand Down Expand Up @@ -161,9 +161,9 @@ const Cards = ({ data }: { data: Dataset }) => {
{data.has_charts && <Icon source={Icons.chart} size={20} />}
</div>

{data?.categories.length > 0 && (
{data?.sectors.length > 0 && (
<span className="flex flex-wrap gap-2 py-1 pr-2">
{data?.categories.map((category, index) => (
{data?.sectors.map((category, index) => (
<div
key={index}
className="rounded-1 border-1 px-2 py-1 text-75"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { Loading } from '@/components/loading';
import Card from '../../datasets/components/Card';
import Filter from '../../datasets/components/FIlter/Filter';

const categoryQueryDoc: any = graphql(`
query CategoryDetails($filters: CategoryFilter) {
categories(filters: $filters) {
const sectorQueryDoc: any = graphql(`
query CategoryDetails($filters: SectorFilter) {
sectors(filters: $filters) {
id
name
description
Expand Down Expand Up @@ -165,14 +165,14 @@ const useUrlParams = (
}, [queryParams, setVariables, router]);
};

const CategoryDetailsPage = ({ params }: { params: { categorySlug: any } }) => {
const SectorDetailsPage = ({ params }: { params: { categorySlug: any } }) => {
const getCategoryDetails: {
data: any;
isLoading: boolean;
isError: boolean;
} = useQuery([`get_category_details_${params.categorySlug}`], () =>
GraphQL(
categoryQueryDoc,
sectorQueryDoc,
{
// Entity Headers if present
},
Expand Down Expand Up @@ -243,11 +243,11 @@ const CategoryDetailsPage = ({ params }: { params: { categorySlug: any } }) => {
<BreadCrumbs
data={[
{ href: '/', label: 'Home' },
{ href: '/categories', label: 'Categories' },
{ href: '/sectors', label: 'Sectors' },
{
href: '#',
label:
getCategoryDetails.data?.categories[0].name ||
getCategoryDetails.data?.sectors[0].name ||
params.categorySlug,
},
]}
Expand Down Expand Up @@ -275,14 +275,14 @@ const CategoryDetailsPage = ({ params }: { params: { categorySlug: any } }) => {
// className="text-baseIndigoAlpha4"
fontWeight="bold"
>
{getCategoryDetails.data?.categories[0].name ||
{getCategoryDetails.data?.sectors[0].name ||
params.categorySlug}
</Text>
<Text variant="bodyLg">
{getCategoryDetails.data?.categories[0].datasetCount} Datasets
{getCategoryDetails.data?.sectors[0].datasetCount} Datasets
</Text>
<Text variant="bodyMd">
{getCategoryDetails.data?.categories[0].description ||
{getCategoryDetails.data?.sectors[0].description ||
'No description available.'}
</Text>
</div>
Expand Down Expand Up @@ -399,4 +399,4 @@ const CategoryDetailsPage = ({ params }: { params: { categorySlug: any } }) => {
);
};

export default CategoryDetailsPage;
export default SectorDetailsPage;
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import BreadCrumbs from '@/components/BreadCrumbs';
import { ErrorPage } from '@/components/error';
import { Loading } from '@/components/loading';

const categoriesListQueryDoc: any = graphql(`
query CategoriesList {
categories {
const sectorsListQueryDoc: any = graphql(`
query SectorsList {
sectors {
id
name
description
Expand All @@ -23,15 +23,15 @@ const categoriesListQueryDoc: any = graphql(`
}
`);

const CategoriesListingPage = () => {
const getCategoriesList: {
const SectorsListingPage = () => {
const getSectorsList: {
data: any;
isLoading: boolean;
error: any;
isError: boolean;
} = useQuery([`categories_list_page`], () =>
} = useQuery([`sectors_list_page`], () =>
GraphQL(
categoriesListQueryDoc,
sectorsListQueryDoc,
{
// Entity Headers if present
},
Expand All @@ -44,43 +44,43 @@ const CategoriesListingPage = () => {
<BreadCrumbs
data={[
{ href: '/', label: 'Home' },
{ href: '#', label: 'Categories' },
{ href: '#', label: 'Sectors' },
]}
/>
<>
{getCategoriesList.isLoading ? (
{getSectorsList.isLoading ? (
<Loading />
) : getCategoriesList.data?.categories.length > 0 ? (
) : getSectorsList.data?.sectors.length > 0 ? (
<>
<div className="flex h-screen w-full flex-col gap-2 px-28 pt-10">
<Text variant="heading3xl" as="h1">
Categories
Sectors
</Text>
<div className="flex flex-wrap justify-between pt-8">
{getCategoriesList.data?.categories.map((category: any) => (
<Link href={`/categories/${category.slug}`} key={category.id}>
{getSectorsList.data?.sectors.map((sectors: any) => (
<Link href={`/sectors/${sectors.slug}`} key={sectors.id}>
<div className="md::w-72 mb-7 flex flex-row items-center gap-3 rounded-2 border-borderDefault bg-basePureWhite p-3 shadow-basicLg sm:w-72 lg:w-72 xl:w-72">
<div className="flex items-center justify-center rounded-1 bg-baseGraySlateSolid2 p-2">
<Image
src={'/obi.jpg'}
width={40}
height={40}
alt={'Category Logo'}
alt={'Sectors Logo'}
/>
</div>
<div className="flex flex-col gap-1">
<Text variant="bodyMd" fontWeight="semibold">
{category.name}
{sectors.name}
</Text>
<Text>{category.datasetCount} Dataset(s)</Text>
<Text>{sectors.datasetCount} Dataset(s)</Text>
</div>
</div>
</Link>
))}
</div>
</div>
</>
) : getCategoriesList.isError ? (
) : getSectorsList.isError ? (
<ErrorPage />
) : (
<></>
Expand All @@ -90,4 +90,4 @@ const CategoriesListingPage = () => {
);
};

export default CategoriesListingPage;
export default SectorsListingPage;
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import { graphql } from '@/gql';
import {
TypeCategory,
TypeDataset,
TypeMetadata,
TypeSector,
TypeTag,
UpdateMetadataInput
} from '@/gql/generated/graphql';
Expand All @@ -28,9 +28,9 @@ import { GraphQL } from '@/lib/api';
import { useEffect, useState } from 'react';
import DatasetLoading from '../../../components/loading-dataset';

const categoriesListQueryDoc: any = graphql(`
query CategoryList {
categories {
const sectorsListQueryDoc: any = graphql(`
query SectorList {
sectors {
id
name
}
Expand All @@ -56,7 +56,7 @@ const datasetMetadataQueryDoc: any = graphql(`
id
value
}
categories {
sectors {
id
name
}
Expand Down Expand Up @@ -139,10 +139,10 @@ export function EditMetadata({ id }: { id: string }) {
}
);

const getCategoriesList: { data: any; isLoading: boolean; error: any } =
useQuery([`categories_list_query`], () =>
const getSectorsList: { data: any; isLoading: boolean; error: any } =
useQuery([`sectors_list_query`], () =>
GraphQL(
categoriesListQueryDoc,
sectorsListQueryDoc,
{
[params.entityType]: params.entitySlug,
},
Expand Down Expand Up @@ -230,11 +230,11 @@ export function EditMetadata({ id }: { id: string }) {

defaultVal['description'] = dataset?.description || '';

defaultVal['categories'] =
dataset?.categories?.map((category: TypeCategory) => {
defaultVal['sectors'] =
dataset?.sectors?.map((sector: TypeSector) => {
return {
label: category.name,
value: category.id,
label: sector.name,
value: sector.id,
};
}) || [];

Expand Down Expand Up @@ -289,7 +289,7 @@ export function EditMetadata({ id }: { id: string }) {
...Object.keys(transformedValues)
.filter(
(valueItem) =>
!['categories', 'description', 'tags'].includes(valueItem)
!['sectors', 'description', 'tags'].includes(valueItem)
)
.map((key) => {
return {
Expand All @@ -300,8 +300,8 @@ export function EditMetadata({ id }: { id: string }) {
],
description: updatedData.description || '',
tags: updatedData.tags?.map((item: any) => item.label) || [],
categories:
updatedData.categories?.map((item: any) => item.value) || [],
sectors:
updatedData.sectors?.map((item: any) => item.value) || [],
},
});
}
Expand Down Expand Up @@ -427,7 +427,7 @@ export function EditMetadata({ id }: { id: string }) {
return (
<>
{!getTagsList?.isLoading &&
!getCategoriesList?.isLoading &&
!getSectorsList?.isLoading &&
!getDatasetMetadata.isLoading ? (
<Form

Expand Down Expand Up @@ -484,16 +484,16 @@ export function EditMetadata({ id }: { id: string }) {
<div className="w-full py-4 pr-4 sm:w-1/2 md:w-1/2 lg:w-1/2 xl:w-1/2">
<Combobox
displaySelected
label="Categories"
list={getCategoriesList.data?.categories?.map(
(item: TypeCategory) => {
label="Sectors"
list={getSectorsList.data?.sectors?.map(
(item: TypeSector) => {
return { label: item.name, value: item.id };
}
)}
name="categories"
name="sectors"
onChange={(value) => {
handleChange('categories', value);
handleSave({ ...formData, categories: value }); // Save on change
handleChange('sectors', value);
handleSave({ ...formData, sectors: value }); // Save on change
}}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const FetchUseCaseDetails: any = graphql(`
id
title
modified
categories {
sectors {
name
}
}
Expand Down Expand Up @@ -72,7 +72,7 @@ const Assign = () => {
return {
title: item.title,
id: item.id,
category: item.categories[0]?.name || 'N/A', // Safeguard in case of missing category
category: item.sectors[0]?.name || 'N/A', // Safeguard in case of missing category
modified: formatDate(item.modified),
};
});
Expand Down Expand Up @@ -101,7 +101,7 @@ const Assign = () => {
return {
title: item.title,
id: item.id,
category: item.categories[0],
category: item.sectors[0],
modified: formatDate(item.modified),
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const UseCaseDetails: any = graphql(`
datasets {
title
id
categories {
sectors {
name
}
modified
Expand Down Expand Up @@ -119,7 +119,7 @@ const Publish = () => {

const columns = [
{ accessorKey: 'title', header: 'Title' },
{ accessorKey: 'category', header: 'Category' },
{ accessorKey: 'sector', header: 'Sector' },
{ accessorKey: 'modified', header: 'Last Modified' },
];

Expand Down Expand Up @@ -147,7 +147,7 @@ const Publish = () => {
return {
title: item.title,
id: item.id,
category: item.categories[0]?.name,
category: item.sectors[0]?.name,
modified: formatDate(item.modified),
};
});
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/dashboard/components/main-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function MainNav({ hideSearch = false }) {
},
{
title: 'Sectors',
href: '/categories',
href: '/sectors',
},
{
title: 'Use Cases',
Expand Down
Loading