diff --git a/.changeset/app-983-fix-scroll-to-eligibility-section.md b/.changeset/app-983-fix-scroll-to-eligibility-section.md new file mode 100644 index 000000000..5d519cb3b --- /dev/null +++ b/.changeset/app-983-fix-scroll-to-eligibility-section.md @@ -0,0 +1,5 @@ +--- +"@aragon/app": patch +--- + +Implement scrolling into the proposal creation eligibility section and remove the "No description" fallback text diff --git a/apps/app/src/assets/locales/en.json b/apps/app/src/assets/locales/en.json index a3fd99dfd..60aa554ad 100644 --- a/apps/app/src/assets/locales/en.json +++ b/apps/app/src/assets/locales/en.json @@ -3863,7 +3863,6 @@ "defaultName": "No name {{type}} policy" }, "processDataListItem": { - "defaultDescription": "No description", "notEligible": "Not eligible", "viewRequirements": "View requirements" }, diff --git a/apps/app/src/modules/governance/hooks/useSimulateProposal/useSimulateProposalCreation.test.ts b/apps/app/src/modules/governance/hooks/useSimulateProposal/useSimulateProposalCreation.test.ts index 049b2c7ce..e016cb322 100644 --- a/apps/app/src/modules/governance/hooks/useSimulateProposal/useSimulateProposalCreation.test.ts +++ b/apps/app/src/modules/governance/hooks/useSimulateProposal/useSimulateProposalCreation.test.ts @@ -125,7 +125,9 @@ describe('useSimulateProposalCreation hook', () => { ); expect(useCallSpy).toHaveBeenCalledWith( - expect.objectContaining({ query: { enabled: false } }), + expect.objectContaining({ + query: expect.objectContaining({ enabled: false }), + }), ); }); @@ -135,7 +137,9 @@ describe('useSimulateProposalCreation hook', () => { ); expect(useCallSpy).toHaveBeenCalledWith( - expect.objectContaining({ query: { enabled: false } }), + expect.objectContaining({ + query: expect.objectContaining({ enabled: false }), + }), ); }); }); diff --git a/apps/app/src/modules/governance/hooks/useSimulateProposal/useSimulateProposalCreation.ts b/apps/app/src/modules/governance/hooks/useSimulateProposal/useSimulateProposalCreation.ts index a8f90315b..218bad77b 100644 --- a/apps/app/src/modules/governance/hooks/useSimulateProposal/useSimulateProposalCreation.ts +++ b/apps/app/src/modules/governance/hooks/useSimulateProposal/useSimulateProposalCreation.ts @@ -79,6 +79,7 @@ export const useSimulateProposalCreation = ( ...transactionData, query: { enabled: isEnabled, + refetchOnWindowFocus: false, }, }); diff --git a/apps/app/src/modules/settings/pages/daoProcessDetailsPage/daoProcessDetailsPageClient.tsx b/apps/app/src/modules/settings/pages/daoProcessDetailsPage/daoProcessDetailsPageClient.tsx index 39d7bf0af..78ff0b323 100644 --- a/apps/app/src/modules/settings/pages/daoProcessDetailsPage/daoProcessDetailsPageClient.tsx +++ b/apps/app/src/modules/settings/pages/daoProcessDetailsPage/daoProcessDetailsPageClient.tsx @@ -1,6 +1,7 @@ 'use client'; import { Card, DateFormat, formatterUtils } from '@aragon/gov-ui-kit'; +import { useEffect } from 'react'; import { FormProvider, useForm } from 'react-hook-form'; import type { ICreateDaoFormData } from '@/modules/createDao/components/createDaoForm'; import { @@ -17,6 +18,7 @@ import type { } from '@/modules/governance/types'; import { useDao } from '@/shared/api/daoService'; import { Page } from '@/shared/components/page'; +import { proposalCreationEligibilityAnchor } from '@/shared/components/processDataListItem'; import { useTranslations } from '@/shared/components/translationsProvider'; import { useDaoPlugins } from '@/shared/hooks/useDaoPlugins'; import { useIsMounted } from '@/shared/hooks/useIsMounted'; @@ -139,6 +141,22 @@ export const DaoProcessDetailsPageClient: React.FC< ? (slotResult ?? fallback) : fallback; + const hasProposalCreationEligibility = + settings != null && settings.length > 0; + + useEffect(() => { + if ( + !hasProposalCreationEligibility || + window.location.hash !== `#${proposalCreationEligibilityAnchor}` + ) { + return; + } + + document + .getElementById(proposalCreationEligibilityAnchor) + ?.scrollIntoView({ behavior: 'smooth', block: 'start' }); + }, [hasProposalCreationEligibility]); + return ( <> - {settings != null && settings.length > 0 && ( + {hasProposalCreationEligibility && ( = ( const { address, description, slug } = process; - const processedDescription = - description != null && description.length > 0 - ? description - : t('app.shared.processDataListItem.defaultDescription'); + const processDescription = + description != null && description.length > 0 ? description : undefined; return ( = ( {slug}

-

- {processedDescription} -

+ {processDescription && ( +

+ {processDescription} +

+ )} @@ -85,7 +93,10 @@ export const ProcessDataListItem: React.FC = (
{t('app.shared.processDataListItem.notEligible')} •{' '} {t(