diff --git a/app/[locale]/(user)/datasets/[datasetIdentifier]/components/Metadata/index.tsx b/app/[locale]/(user)/datasets/[datasetIdentifier]/components/Metadata/index.tsx index 1e8dc316..1fe14b70 100644 --- a/app/[locale]/(user)/datasets/[datasetIdentifier]/components/Metadata/index.tsx +++ b/app/[locale]/(user)/datasets/[datasetIdentifier]/components/Metadata/index.tsx @@ -91,7 +91,7 @@ const MetadataComponent: React.FC = ({ data, setOpen }) => { variant="bodyLg" fontWeight="medium" > - {data.categories[0].name} + {data.sectors[0].name} {Metadata.map((item, index) => ( @@ -110,10 +110,10 @@ const MetadataComponent: React.FC = ({ data, setOpen }) => {
Description - {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 && (
- {data?.categories.length > 0 && ( + {data?.sectors.length > 0 && ( - {data?.categories.map((category, index) => ( + {data?.sectors.map((category, index) => (
{ +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 }, @@ -243,11 +243,11 @@ const CategoryDetailsPage = ({ params }: { params: { categorySlug: any } }) => { { // className="text-baseIndigoAlpha4" fontWeight="bold" > - {getCategoryDetails.data?.categories[0].name || + {getCategoryDetails.data?.sectors[0].name || params.categorySlug} - {getCategoryDetails.data?.categories[0].datasetCount} Datasets + {getCategoryDetails.data?.sectors[0].datasetCount} Datasets - {getCategoryDetails.data?.categories[0].description || + {getCategoryDetails.data?.sectors[0].description || 'No description available.'}
@@ -399,4 +399,4 @@ const CategoryDetailsPage = ({ params }: { params: { categorySlug: any } }) => { ); }; -export default CategoryDetailsPage; +export default SectorDetailsPage; diff --git a/app/[locale]/(user)/categories/page.tsx b/app/[locale]/(user)/sectors/page.tsx similarity index 70% rename from app/[locale]/(user)/categories/page.tsx rename to app/[locale]/(user)/sectors/page.tsx index dbb94926..72fd9623 100644 --- a/app/[locale]/(user)/categories/page.tsx +++ b/app/[locale]/(user)/sectors/page.tsx @@ -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 @@ -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 }, @@ -44,35 +44,35 @@ const CategoriesListingPage = () => { <> - {getCategoriesList.isLoading ? ( + {getSectorsList.isLoading ? ( - ) : getCategoriesList.data?.categories.length > 0 ? ( + ) : getSectorsList.data?.sectors.length > 0 ? ( <>
- Categories + Sectors
- {getCategoriesList.data?.categories.map((category: any) => ( - + {getSectorsList.data?.sectors.map((sectors: any) => ( +
{'Category
- {category.name} + {sectors.name} - {category.datasetCount} Dataset(s) + {sectors.datasetCount} Dataset(s)
@@ -80,7 +80,7 @@ const CategoriesListingPage = () => {
- ) : getCategoriesList.isError ? ( + ) : getSectorsList.isError ? ( ) : ( <> @@ -90,4 +90,4 @@ const CategoriesListingPage = () => { ); }; -export default CategoriesListingPage; +export default SectorsListingPage; diff --git a/app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/components/EditMetadata.tsx b/app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/components/EditMetadata.tsx index bf9bdcc5..c1bfbccb 100644 --- a/app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/components/EditMetadata.tsx +++ b/app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/components/EditMetadata.tsx @@ -2,9 +2,9 @@ import { graphql } from '@/gql'; import { - TypeCategory, TypeDataset, TypeMetadata, + TypeSector, TypeTag, UpdateMetadataInput } from '@/gql/generated/graphql'; @@ -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 } @@ -56,7 +56,7 @@ const datasetMetadataQueryDoc: any = graphql(` id value } - categories { + sectors { id name } @@ -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, }, @@ -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, }; }) || []; @@ -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 { @@ -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) || [], }, }); } @@ -427,7 +427,7 @@ export function EditMetadata({ id }: { id: string }) { return ( <> {!getTagsList?.isLoading && - !getCategoriesList?.isLoading && + !getSectorsList?.isLoading && !getDatasetMetadata.isLoading ? (
{ + 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 }} /> diff --git a/app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/assign/page.tsx b/app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/assign/page.tsx index 8e99db51..f837ccf0 100644 --- a/app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/assign/page.tsx +++ b/app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/assign/page.tsx @@ -20,7 +20,7 @@ const FetchUseCaseDetails: any = graphql(` id title modified - categories { + sectors { name } } @@ -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), }; }); @@ -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), }; }); diff --git a/app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/publish/page.tsx b/app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/publish/page.tsx index fcc1e790..ba1842af 100644 --- a/app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/publish/page.tsx +++ b/app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/publish/page.tsx @@ -38,7 +38,7 @@ const UseCaseDetails: any = graphql(` datasets { title id - categories { + sectors { name } modified @@ -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' }, ]; @@ -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), }; }); diff --git a/app/[locale]/dashboard/components/main-nav.tsx b/app/[locale]/dashboard/components/main-nav.tsx index cbf34df2..de201228 100644 --- a/app/[locale]/dashboard/components/main-nav.tsx +++ b/app/[locale]/dashboard/components/main-nav.tsx @@ -65,7 +65,7 @@ export function MainNav({ hideSearch = false }) { }, { title: 'Sectors', - href: '/categories', + href: '/sectors', }, { title: 'Use Cases',