fix(ui/homepage): fix empty states of home page modules (#14207)

This commit is contained in:
purnimagarg1 2025-07-24 21:16:03 +05:30 committed by GitHub
parent a5aa0d11b8
commit 9b52637784
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 10 deletions

View File

@ -16,6 +16,11 @@ const Container = styled.div`
flex-direction: column;
justify-content: center;
align-items: center;
p {
text-align: justify;
text-align-last: center;
}
`;
const IconWrapper = styled.div`

View File

@ -1,4 +1,5 @@
import React from 'react';
import React, { useCallback } from 'react';
import { useHistory } from 'react-router';
import { useUserContext } from '@app/context/useUserContext';
import { useGetAssetsYouOwn } from '@app/homeV2/reference/sections/assets/useGetAssetsYouOwn';
@ -7,6 +8,7 @@ import EntityItem from '@app/homeV3/module/components/EntityItem';
import LargeModule from '@app/homeV3/module/components/LargeModule';
import { ModuleProps } from '@app/homeV3/module/types';
import useSearchYourAssets from '@app/homeV3/modules/useSearchYourAssets';
import { navigateToSearchUrl } from '@app/searchV2/utils/navigateToSearchUrl';
import { DataHubPageModuleType } from '@types';
@ -14,6 +16,11 @@ export default function YourAssetsModule(props: ModuleProps) {
const { user } = useUserContext();
const { originEntities, loading } = useGetAssetsYouOwn(user);
const searchForYourAssets = useSearchYourAssets();
const history = useHistory();
const navigateToSearch = useCallback(() => {
navigateToSearchUrl({ query: '*', history });
}, [history]);
return (
<LargeModule {...props} loading={loading} onClickViewAll={searchForYourAssets}>
@ -22,8 +29,8 @@ export default function YourAssetsModule(props: ModuleProps) {
icon="User"
title="No Owned Assets"
description="Select an asset and add yourself as an owner to see the assets in this list"
linkText="Discover assets to subscribe to"
onLinkClick={() => {}}
linkText="Discover the assets you want to own"
onLinkClick={navigateToSearch}
/>
) : (
originEntities.map((entity) => (

View File

@ -25,11 +25,9 @@ export default function LinkModal() {
const linkParams = initialState?.properties?.params?.linkParams;
const urn = initialState?.urn;
/* TODO: Uncomment to validate and disable button once the Rich Text module PR is merged
const titleValue = Form.useWatch('title', form);
const linkUrlValue = Form.useWatch('link', form);
const isDisabled = !titleValue?.trim() || !linkUrlValue?.trim(); */
const nameValue = Form.useWatch('name', form);
const linkUrlValue = Form.useWatch('linkUrl', form);
const isDisabled = !nameValue?.trim() || !linkUrlValue?.trim();
const handleUpsertDocumentationModule = () => {
form.validateFields().then((values) => {
@ -57,8 +55,7 @@ export default function LinkModal() {
subtitle="Add links to your home page"
onUpsert={handleUpsertDocumentationModule}
width="40%"
/* TODO: Uncomment to validate and disable button once the Rich Text module PR is merged
submitButtonProps={{ disabled: isDisabled }} */
submitButtonProps={{ disabled: isDisabled }}
>
<ModalContent>
<ModuleDetailsForm form={form} formValues={{ name: currentName }} />