Skip to content

Commit

Permalink
Merge pull request #933 from multiversx/development
Browse files Browse the repository at this point in the history
2.21.0
  • Loading branch information
CiprianDraghici authored Sep 21, 2023
2 parents 3129ac4 + ecfc39e commit 7de763e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,30 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [[v2.21.0]](https://github.com/multiversx/mx-sdk-dapp/pull/933)] - 2023-09-21

- [Prevent duplicate custom toasts with the same ID](https://github.com/multiversx/mx-sdk-dapp/pull/932)
- [Extend UI/CopyButton icons](https://github.com/multiversx/mx-sdk-dapp/pull/931)

## [[v2.20.6]](https://github.com/multiversx/mx-sdk-dapp/pull/928)] - 2023-09-14

- [Add network option when refreshing a native auth token](https://github.com/multiversx/mx-sdk-dapp/pull/927)

## [[v2.20.5]](https://github.com/multiversx/mx-sdk-dapp/pull/925)] - 2023-09-14

- [Fix refreshNativeAuthTokenLogin signature](https://github.com/multiversx/mx-sdk-dapp/pull/924)

## [[v2.20.4]](https://github.com/multiversx/mx-sdk-dapp/pull/923)] - 2023-09-14

- [Fix custom transaction information overrides - missing properties on 'signed' state transition](https://github.com/multiversx/mx-sdk-dapp/pull/922)

## [[v2.20.3]](https://github.com/multiversx/mx-sdk-dapp/pull/920)] - 2023-09-13

- [Add back cancelAction when cancelling a transaction and remove it from transaction toast discard](https://github.com/multiversx/mx-sdk-dapp/pull/919)

## [[v2.20.2]](https://github.com/multiversx/mx-sdk-dapp/pull/913)] - 2023-09-13

- [Changed Ledger authentication texts for v.23 of MultiversX app](https://github.com/multiversx/mx-sdk-dapp/pull/910)
- [Fix transaction cancellation when a transaction toast is discarded](https://github.com/multiversx/mx-wallet-dapp/pull/915)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-dapp",
"version": "2.20.6",
"version": "2.21.0",
"description": "A library to hold the main logic for a dapp on the MultiversX blockchain",
"author": "MultiversX",
"license": "GPL-3.0-or-later",
Expand Down
11 changes: 8 additions & 3 deletions src/UI/CopyButton/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState, MouseEvent } from 'react';
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { faCheck, faCopy } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

Expand All @@ -9,11 +10,15 @@ import { copyTextToClipboard } from './helpers/copyToClipboard';

export interface CopyButtonPropsType extends WithClassnameType {
text: string;
copyIcon?: IconProp;
successIcon?: IconProp;
}

export const CopyButton = ({
text,
className = 'dapp-copy-button'
className = 'dapp-copy-button',
copyIcon = faCopy,
successIcon = faCheck
}: CopyButtonPropsType) => {
const [copyResult, setCopyResut] = useState({
default: true,
Expand Down Expand Up @@ -46,9 +51,9 @@ export const CopyButton = ({
className={classNames(styles.copy, className)}
>
{copyResult.default || !copyResult.success ? (
<FontAwesomeIcon icon={faCopy} />
<FontAwesomeIcon icon={copyIcon} />
) : (
<FontAwesomeIcon icon={faCheck} />
<FontAwesomeIcon icon={successIcon} />
)}
</a>
);
Expand Down
22 changes: 19 additions & 3 deletions src/reduxStore/slices/toastsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,28 @@ export const toastsSlice = createSlice({
state: ToastsSliceState,
action: PayloadAction<CustomToastType>
) => {
const toastId =
action.payload.toastId ||
`custom-toast-${state.customToasts.length + 1}`;

const existingToastIndex = state.customToasts.findIndex(
(toast) => toast.toastId === toastId
);

if (existingToastIndex !== -1) {
state.customToasts[existingToastIndex] = {
...state.customToasts[existingToastIndex],
...action.payload,
type: ToastsEnum.custom,
toastId
} as CustomToastType;
return;
}

state.customToasts.push({
...action.payload,
type: ToastsEnum.custom,
toastId:
action.payload.toastId ||
`custom-toast-${state.customToasts.length + 1}`
toastId
});
},

Expand Down

0 comments on commit 7de763e

Please sign in to comment.