Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f823b67
Enhance metadata update handling with success feedback and form data …
sanjaypinna Jun 5, 2025
d4ce981
Enhance logo display in footer with hover effect for improved user ex…
sanjaypinna Jun 5, 2025
4b878ec
Remove debug log statement from StepNavigation component
sanjaypinna Jun 5, 2025
9266268
Refactor Details component layout and enhance form fields for better …
sanjaypinna Jun 5, 2025
42b2349
enhance error handling with dismiss action
sanjaypinna Jun 5, 2025
64532fa
Enhance dataset mutation response structure and error handling in Edi…
sanjaypinna Jun 5, 2025
860cd72
Refactor MainNav component to enhance search functionality and improv…
sanjaypinna Jun 5, 2025
12cb2d0
Add loading state and improve empty dataset handling in ListingComponent
sanjaypinna Jun 5, 2025
3448b1b
add optional chaining operator
sanjaypinna Jun 5, 2025
d9d76d4
add optional chaining operator
sanjaypinna Jun 5, 2025
a601f45
add sector logo in dataset details page
sanjaypinna Jun 5, 2025
911cf67
update usecase query
sanjaypinna Jun 5, 2025
f466458
add contact us in footer
sanjaypinna Jun 5, 2025
8c6d779
update summary font size
sanjaypinna Jun 5, 2025
e22390d
update labels
sanjaypinna Jun 5, 2025
ee2c168
refactor: enhance error handling and success notifications for datase…
sanjaypinna Jun 5, 2025
068722a
fix: update labels to indicate required fields in metadata form
sanjaypinna Jun 5, 2025
a4a37b9
fix: correct dataset ID reference in router push after dataset creation
sanjaypinna Jun 5, 2025
967ec51
Add a required field in form and disable button based on conditions
sanjaypinna Jun 5, 2025
d30574f
add required fields
sanjaypinna Jun 5, 2025
c0a0c2d
update label
sanjaypinna Jun 5, 2025
a7cbc73
add required fields
sanjaypinna Jun 5, 2025
a14b5af
add checks to enable Publish button
sanjaypinna Jun 5, 2025
d882b8b
update label
sanjaypinna Jun 5, 2025
b054799
disable restricted access
sanjaypinna Jun 5, 2025
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
22 changes: 19 additions & 3 deletions app/[locale]/(user)/components/ListingComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ const ListingComponent: React.FC<ListingProps> = ({
}
}, [variables, fetchDatasets]);

const [hasMounted, setHasMounted] = useState(false);

useEffect(() => {
setHasMounted(true);
}, []);

if (!hasMounted) return <Loading />;

const handlePageChange = (newPage: number) => {
setQueryParams({ type: 'SET_CURRENT_PAGE', payload: newPage });
};
Expand Down Expand Up @@ -301,7 +309,11 @@ const ListingComponent: React.FC<ListingProps> = ({
</Text>
)}

<Text variant="headingLg" fontWeight="regular" className=' leading-3 '>
<Text
variant="headingLg"
fontWeight="regular"
className=" leading-3 "
>
{categoryDescription
? categoryDescription
: 'No Description Provided'}
Expand Down Expand Up @@ -440,7 +452,9 @@ const ListingComponent: React.FC<ListingProps> = ({
</div>
)}

{facets && datasetDetails?.length > 0 ? (
{facets === null ? (
<Loading />
) : facets.results.length > 0 ? (
<GraphqlPagination
totalRows={count}
pageSize={queryParams.pageSize}
Expand Down Expand Up @@ -503,7 +517,9 @@ const ListingComponent: React.FC<ListingProps> = ({
})}
</GraphqlPagination>
) : (
<Loading />
<div className="flex h-screen items-center justify-center">
<Text variant="heading2xl">No datasets found</Text>
</div>
)}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/[locale]/(user)/components/UseCases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const useCasesListDoc: any = graphql(`
$filters: UseCaseFilter
$pagination: OffsetPaginationInput
) {
useCases(filters: $filters, pagination: $pagination) {
publishedUseCases(filters: $filters, pagination: $pagination) {
id
title
summary
Expand Down Expand Up @@ -123,8 +123,8 @@ const UseCasesListingPage = () => {
) : (
<CarouselContent className="p-4 ">
{getUseCasesList &&
getUseCasesList?.data?.useCases.length > 0 &&
getUseCasesList?.data?.useCases.map((item: any, index: any) => (
getUseCasesList?.data?.publishedUseCases.length > 0 &&
getUseCasesList?.data?.publishedUseCases.map((item: any, index: any) => (
<CarouselItem
key={item.id}
className={cn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,26 @@ const MetadataComponent: React.FC<MetadataProps> = ({ data, setOpen }) => {
: data.organization.name}
</Text>
</div>
<div className="flex items-center gap-2 ">
<div className="flex gap-2 ">
<Text className="min-w-[120px] basis-1/4 uppercase" variant="bodyMd">
Sector
</Text>
<Text
className="max-w-xs truncate "
variant="bodyLg"
fontWeight="medium"
>
{data.sectors[0].name}
</Text>
<div className="flex flex-wrap gap-2">
{data.sectors.length > 0 ? (
data.sectors.map((sector: any, index: number) => (
<Image
key={index}
src={`/Sectors/${sector.name}.svg`}
alt={sector.name || ''}
width={52}
height={52}
className="border-1 border-solid border-greyExtralight p-1"
/>
))
) : (
<span>N/A</span>
)}
</div>
</div>
{Metadata.map((item: any, index: any) => (
<div className="flex items-start gap-2 " key={index}>
Expand All @@ -152,7 +161,7 @@ const MetadataComponent: React.FC<MetadataProps> = ({ data, setOpen }) => {
) : (
<Link href={item.value} target="_blank">
<Text className="underline" color="highlight">
{sourceTitle?.trim() ? sourceTitle : 'Source'}
{sourceTitle?.trim() ? sourceTitle : 'Visit Website'}
</Text>
</Link>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const SimilarDatasets: React.FC<Props> = ({ showCharts }) => {
formats={item.formats}
footerContent={[
{
icon: `/Sectors/${item.sectors[0].name}.svg`,
icon: `/Sectors/${item.sectors[0]?.name}.svg`,
label: 'Sectors',
},
{
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/(user)/publishers/components/Datasets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const Datasets = ({ type }: { type: 'organization' | 'Publisher' }) => {
formats={item.formats}
footerContent={[
{
icon: `/Sectors/${item.sectors[0].name}.svg`,
icon: `/Sectors/${item.sectors[0]?.name}.svg`,
label: 'Sectors',
},
{
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/(user)/usecases/[useCaseSlug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ const UseCaseDetailPage = () => {
href={`/datasets/${dataset.id}`}
footerContent={[
{
icon: `/Sectors/${dataset.sectors[0].name}.svg`,
icon: `/Sectors/${dataset.sectors[0]?.name}.svg`,
label: 'Sectors',
},
{
Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/(user)/usecases/components/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const PrimaryDetails = ({ data, isLoading }: { data: any; isLoading: any }) => {
<div className="mt-6 lg:mt-10">
<Text variant="heading2xl">Summary</Text>
<div className="mt-4">
<Text variant="headingLg" fontWeight="regular">
<Text variant="headingMd" fontWeight="regular">
{data.useCase.summary}
</Text>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/[locale]/(user)/usecases/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Styles from '../page.module.scss';

const useCasesListQueryDoc: any = graphql(`
query UseCasesList($filters: UseCaseFilter) {
useCases(filters: $filters) {
publishedUseCases(filters: $filters) {
id
title
summary
Expand Down Expand Up @@ -129,8 +129,8 @@ const UseCasesListingPage = () => {
)}
>
{getUseCasesList &&
getUseCasesList?.data?.useCases.length > 0 &&
getUseCasesList?.data?.useCases.map((item: any, index: any) => (
getUseCasesList?.data?.publishedUseCases.length > 0 &&
getUseCasesList?.data?.publishedUseCases.map((item: any, index: any) => (
<Card
title={item.title}
key={index}
Expand Down
27 changes: 20 additions & 7 deletions app/[locale]/dashboard/[entityType]/[entitySlug]/admin/addUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ const AddUser = ({

const { mutate: updateMutate, isLoading: updateUserLoading } = useMutation(
(input: { input: AssignOrganizationRoleInput }) =>
GraphQL(updateUser, {
[params.entityType]: params.entitySlug,
}, input),
GraphQL(
updateUser,
{
[params.entityType]: params.entitySlug,
},
input
),
{
onSuccess: (res: any) => {
toast('User updated successfully');
Expand Down Expand Up @@ -172,6 +176,12 @@ const AddUser = ({
const filteredOptions = Users.data?.searchUsers;
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
if (value === '') {
setFormData({
userId: '',
roleId: formData.roleId,
});
}
setSearchValue(value);
setIsDropdownOpen(true); // Keep dropdown open while typing
Users.refetch(); // Refetch when search term changes
Expand All @@ -193,13 +203,13 @@ const AddUser = ({
>
<div className="m-auto mb-6 flex flex-col gap-6">
<div className="relative w-full">
<Label>Select User</Label>
<Label>Select User *</Label>
<input
type="text"
id="combobox"
disabled={isEdit}
value={searchValue}
autoComplete='off'
autoComplete="off"
onChange={handleInputChange}
className="border border-gray-100 placeholder:text-sm mt-1 block w-full px-3 py-1"
placeholder={'Select user'}
Expand Down Expand Up @@ -229,7 +239,7 @@ const AddUser = ({
label: toTitleCase(role.name),
value: role.id,
}))}
label="Select a role"
label="Select a role *"
helpText={RolesList.data?.roles
.filter((role: any) => role.id === formData.roleId)
.map((role: any) => role.description)}
Expand All @@ -239,9 +249,12 @@ const AddUser = ({
<Button
kind="primary"
className="m-auto"
disabled={!formData.userId || !formData.roleId}
onClick={() => {
setIsOpen(false);
isEdit ? updateMutate({ input: formData }) : mutate({ input: formData });
isEdit
? updateMutate({ input: formData })
: mutate({ input: formData });
}}
>
{isEdit ? 'Update' : 'Add'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ interface StepNavigationProps {
const StepNavigation = ({ steps }: StepNavigationProps) => {
const pathname = usePathname(); // Get the current URL path
const router = useRouter();
console.log(pathname);

// Find the current step's index based on the pathname (without query params)
const currentIndex = steps.findIndex((step) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,14 @@ const metadataQueryDoc: any = graphql(`
const updateMetadataMutationDoc: any = graphql(`
mutation SaveMetadata($UpdateMetadataInput: UpdateMetadataInput!) {
addUpdateDatasetMetadata(updateMetadataInput: $UpdateMetadataInput) {
__typename
... on TypeDataset {
success
errors {
fieldErrors {
field
messages
}
}
data {
id
description
title
Expand Down Expand Up @@ -208,20 +214,26 @@ export function EditMetadata({ id }: { id: string }) {
),
{
onSuccess: (res: any) => {
toast('Details updated successfully!');
queryClient.invalidateQueries({
queryKey: [
`metadata_values_query_${params.id}`,
`metadata_fields_list_${id}`,
],
});
const updatedData = defaultValuesPrepFn(res.addUpdateDatasetMetadata);
setFormData(updatedData);
setPreviousFormData(updatedData);
// getDatasetMetadata.refetch();
},
onError: (err: any) => {
toast('Error: ' + err.message.split(':')[0]);
if (res.addUpdateDatasetMetadata.success) {
toast('Details updated successfully!');
queryClient.invalidateQueries({
queryKey: [
`metadata_values_query_${params.id}`,
`metadata_fields_list_${id}`,
],
});
const updatedData = defaultValuesPrepFn(
res.addUpdateDatasetMetadata.data
);
setFormData(updatedData);
setPreviousFormData(updatedData);
// getDatasetMetadata.refetch();
} else {
toast(
'Error: ' +
res.addUpdateDatasetMetadata.errors.fieldErrors[0].messages[0]
);
}
},
}
);
Expand Down Expand Up @@ -310,6 +322,7 @@ export function EditMetadata({ id }: { id: string }) {
},
{}
);

updateMetadataMutation.mutate({
UpdateMetadataInput: {
dataset: id,
Expand All @@ -323,16 +336,16 @@ export function EditMetadata({ id }: { id: string }) {
'tags',
'isPublic',
'license',
].includes(valueItem)
].includes(valueItem) && transformedValues[valueItem] !== ''
)
.map((key) => {
return {
id: key,
value: transformedValues[key] || '',
value: transformedValues[key],
};
}),
],
license: updatedData.license || '',
...(updatedData.license && { license: updatedData.license }),
accessType: updatedData.accessType || 'PUBLIC',
description: updatedData.description || '',
tags: updatedData.tags?.map((item: any) => item.label) || [],
Expand Down Expand Up @@ -425,6 +438,7 @@ export function EditMetadata({ id }: { id: string }) {
<Input
type="date"
name={metadataFormItem.id}
max={new Date().toISOString().split('T')[0]}
value={formData[metadataFormItem.id] || ''}
label={metadataFormItem.label}
disabled={
Expand Down Expand Up @@ -490,18 +504,19 @@ export function EditMetadata({ id }: { id: string }) {
<div className="w-full">
<TextField
key="description"
multiline={3}
multiline={4}
name="description"
label={'Description'}
label="Description *"
value={formData.description}
helpText="Character limit: 1000"
onChange={(e) => handleChange('description', e)}
onBlur={() => handleSave(formData)} // Save on blur
/>
</div>

<Combobox
displaySelected
label="Sectors"
label="Sectors *"
list={getSectorsList.data?.sectors?.map(
(item: TypeSector) => {
return { label: item.name, value: item.id };
Expand All @@ -522,7 +537,7 @@ export function EditMetadata({ id }: { id: string }) {
value: item.id,
};
})}
label="Tags"
label="Tags *"
creatable
onChange={(value) => {
handleChange('tags', value);
Expand Down Expand Up @@ -567,9 +582,9 @@ export function EditMetadata({ id }: { id: string }) {
defaultChecked={false}
disabled
>
<div className="flex flex-col gap-1">
<Text>Restricted Access</Text>
<Text>
<div className="flex flex-col gap-1 " title='Coming Soon'>
<Text className=' text-textDisabled'>Restricted Access</Text>
<Text className=' text-iconDisabled'>
Users would require to request access to the dataset to
view and download it. Recommended for sensitive data.
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ const Page = () => {
>
{sourceTitle?.trim()
? sourceTitle
: 'Source'}
: 'Visit Website'}
</Text>
</Link>
)}
Expand Down
Loading