From 80cc7252e6e1b0766f6b311bb3177fde0523d732 Mon Sep 17 00:00:00 2001 From: Roie Natan Date: Tue, 1 Aug 2023 08:44:16 +1300 Subject: [PATCH 1/2] immediate proposals: fix wrong circle name --- .../AssignCircleStage/AssignCircleStage.tsx | 2 +- .../components/PopoverItem/PopoverItem.tsx | 4 ++-- .../ImmediateProposalInfo.tsx | 14 ++++++++------ .../utils/getProposalTitleString.ts | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/pages/OldCommon/components/CommonDetailContainer/CreateProposalModal/AssignCircleStage/AssignCircleStage.tsx b/src/pages/OldCommon/components/CommonDetailContainer/CreateProposalModal/AssignCircleStage/AssignCircleStage.tsx index a990b029e4..1cd5810b86 100644 --- a/src/pages/OldCommon/components/CommonDetailContainer/CreateProposalModal/AssignCircleStage/AssignCircleStage.tsx +++ b/src/pages/OldCommon/components/CommonDetailContainer/CreateProposalModal/AssignCircleStage/AssignCircleStage.tsx @@ -88,7 +88,7 @@ const AssignCircleStage: FC = (props) => { // TODO: Use here name of common member title: `Request to join ${ assignCircleData.circle.name - } circle by ${getUserName(assignCircleData.commonMember.user)}`, + } by ${getUserName(assignCircleData.commonMember.user)}`, description: assignCircleData.description, images: [], links: [], diff --git a/src/pages/common/components/CommonMemberInfo/components/PopoverItem/PopoverItem.tsx b/src/pages/common/components/CommonMemberInfo/components/PopoverItem/PopoverItem.tsx index cd8769b7cd..8033990ab4 100644 --- a/src/pages/common/components/CommonMemberInfo/components/PopoverItem/PopoverItem.tsx +++ b/src/pages/common/components/CommonMemberInfo/components/PopoverItem/PopoverItem.tsx @@ -100,8 +100,8 @@ export const PopoverItem: FC = (props) => { { args: { commonId, - title: `Request to join ${circleName} circle by ${userName}`, - description: `Join circle request: ${circleName}`, + title: `Request to join ${circleName} by ${userName}`, + description: `Join request: ${circleName}`, images: [], links: [], files: [], diff --git a/src/pages/common/components/ProposalFeedCard/components/ImmediateProposalInfo/ImmediateProposalInfo.tsx b/src/pages/common/components/ProposalFeedCard/components/ImmediateProposalInfo/ImmediateProposalInfo.tsx index 2deccbac1a..07433b283c 100644 --- a/src/pages/common/components/ProposalFeedCard/components/ImmediateProposalInfo/ImmediateProposalInfo.tsx +++ b/src/pages/common/components/ProposalFeedCard/components/ImmediateProposalInfo/ImmediateProposalInfo.tsx @@ -1,6 +1,6 @@ import React from "react"; -import { getVotersString } from "@/pages/OldCommon/containers/ProposalContainer/helpers"; import { Governance, Proposal } from "@/shared/models"; +import { isAssignCircleProposal } from "@/shared/models/governance/proposals"; import styles from "./ImmediateProposalInfo.module.scss"; interface ImmediateProposalInfoProps { @@ -14,15 +14,17 @@ export const ImmediateProposalInfo = ({ governanceCircles, proposerUserName, }: ImmediateProposalInfoProps) => { - const votersString = getVotersString( - proposal.global.weights, - governanceCircles, - ); + let circleName: string | undefined; + if (isAssignCircleProposal(proposal)) { + circleName = Object.values(governanceCircles).find( + (circle) => circle.id === proposal.data.args.circleId, + )?.name; + } return (
- {`${proposerUserName} requests to join ${votersString} circle`} + {`${proposerUserName} requests to join ${circleName}`}
{/* Show this only when the required number of voters is greater than 1. Logic for this will be added in the future, see detalis here https://github.com/daostack/common-backend/issues/1844 */} {/*
diff --git a/src/pages/common/components/ProposalFeedCard/utils/getProposalTitleString.ts b/src/pages/common/components/ProposalFeedCard/utils/getProposalTitleString.ts index ff75009469..eb55ce38a9 100644 --- a/src/pages/common/components/ProposalFeedCard/utils/getProposalTitleString.ts +++ b/src/pages/common/components/ProposalFeedCard/utils/getProposalTitleString.ts @@ -23,7 +23,7 @@ export const getProposalTitleString = ( return `Request to join ${ targetCircle?.name ? `${targetCircle.name} ` : "" - }circle`; + }`; } return proposal.data.args.title; From 10036652052b1bef559f33dca1b42ee4004755c1 Mon Sep 17 00:00:00 2001 From: Roie Natan Date: Tue, 1 Aug 2023 08:52:45 +1300 Subject: [PATCH 2/2] . --- .../ImmediateProposalInfo/ImmediateProposalInfo.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pages/common/components/ProposalFeedCard/components/ImmediateProposalInfo/ImmediateProposalInfo.tsx b/src/pages/common/components/ProposalFeedCard/components/ImmediateProposalInfo/ImmediateProposalInfo.tsx index 07433b283c..3a2371815c 100644 --- a/src/pages/common/components/ProposalFeedCard/components/ImmediateProposalInfo/ImmediateProposalInfo.tsx +++ b/src/pages/common/components/ProposalFeedCard/components/ImmediateProposalInfo/ImmediateProposalInfo.tsx @@ -14,12 +14,11 @@ export const ImmediateProposalInfo = ({ governanceCircles, proposerUserName, }: ImmediateProposalInfoProps) => { - let circleName: string | undefined; - if (isAssignCircleProposal(proposal)) { - circleName = Object.values(governanceCircles).find( - (circle) => circle.id === proposal.data.args.circleId, - )?.name; - } + const circleName = isAssignCircleProposal(proposal) + ? Object.values(governanceCircles).find( + (circle) => circle.id === proposal.data.args.circleId, + )?.name + : "unknown"; return (