Skip to content

Commit

Permalink
fix: update link to funding and releasing action, fix advanced paymen…
Browse files Browse the repository at this point in the history
…ts finalize expenditure translation
  • Loading branch information
Nortsova committed Feb 5, 2025
1 parent 30994b9 commit 4a48dc5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const getMessageDescriptorKeys = (actionType: AnyActionType) => {
ActionTitleMessageKeys.TokensNumber,
];
case actionType.includes(ColonyActionType.FundExpenditureMotion):
case actionType.includes(ColonyActionType.FinalizeExpenditureMotion):
return [
ActionTitleMessageKeys.Initiator,
ActionTitleMessageKeys.RecipientsNumber,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React, { useMemo, type FC } from 'react';
import React, { useMemo, type FC, useState } from 'react';
import { useEffect } from 'react';
import { FormattedDate, useIntl } from 'react-intl';
import { useNavigate, useParams } from 'react-router-dom';

import { useGetActionTitleValues } from '~common/ColonyActions/index.ts';
import { UserStakeType } from '~gql';
import useNetworkInverseFee from '~hooks/useNetworkInverseFee.ts';
import { TX_SEARCH_PARAM } from '~routes';
import Numeral from '~shared/Numeral/index.ts';
Expand All @@ -16,6 +18,9 @@ const displayName =
'common.Extensions.UserHub.partials.StakesTab.partials.StakeItem';

const StakeItem: FC<StakeItemProps> = ({ stake }) => {
const [stakeTxParam, setStakeTxParam] = useState(
stake.action?.transactionHash,
);
const { formatMessage } = useIntl();
const navigate = useNavigate();
const { expenditure } = useGetExpenditureData(stake.action?.expenditureId);
Expand Down Expand Up @@ -62,6 +67,18 @@ const StakeItem: FC<StakeItemProps> = ({ stake }) => {
networkInverseFee,
});

useEffect(() => {
if (stake.type === UserStakeType.Motion) {
setStakeTxParam(
stake.action?.expenditure?.creatingActions?.items[0]?.transactionHash,
);
}
}, [
stake.type,
setStakeTxParam,
stake.action?.expenditure?.creatingActions?.items,
]);

return (
<li className="flex flex-col border-b border-gray-100 first:pt-2 last:pb-6 sm:first:pt-0 sm:last:border-none sm:last:pb-1.5">
<button
Expand All @@ -71,7 +88,7 @@ const StakeItem: FC<StakeItemProps> = ({ stake }) => {
setQueryParamOnUrl({
path: navigatePath,
params: {
[TX_SEARCH_PARAM]: stake.action?.transactionHash,
[TX_SEARCH_PARAM]: stakeTxParam,
},
}),
{
Expand Down
1 change: 1 addition & 0 deletions src/i18n/en-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const actionsMessageDescriptors = {
${ColonyActionType.ManageTokensMotion} {Manage tokens by {initiator}}
${ColonyActionType.ManageTokensMultisig} {Manage tokens by {initiator}}
${ColonyActionType.FundExpenditureMotion} {Payment to {recipientsNumber} {recipientsNumber, plural, one {recipient} other {recipients}} with {tokensNumber} {tokensNumber, plural, one {token} other {tokens}} by {initiator}}
${ColonyActionType.FinalizeExpenditureMotion} {Payment to {recipientsNumber} {recipientsNumber, plural, one {recipient} other {recipients}} with {tokensNumber} {tokensNumber, plural, one {token} other {tokens}} by {initiator}}
${ColonyActionType.MakeArbitraryTransaction} {{arbitraryTransactionsLength, select,
0 {Arbitrary transaction by {initiator}}
Expand Down

0 comments on commit 4a48dc5

Please sign in to comment.