-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: MET-1768 show multiple txs protocol
- Loading branch information
1 parent
9cd4a31
commit e039f26
Showing
7 changed files
with
93 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { screen } from "@testing-library/react"; | ||
|
||
import { render } from "src/test-utils"; | ||
|
||
import TxsProtocolModal from "./TxsProtocolModal"; | ||
|
||
test("Check Test Trx Protocol Modal", async () => { | ||
const handleCloseModal = jest.fn(); | ||
render( | ||
<TxsProtocolModal | ||
txs={[ | ||
"62c3c13187423c47f629e6187f36fbd61a9ba1d05d101588340cfbfdf47b22d2", | ||
"a83f479c5635e1e563a19f6e72a1be59fb082bbf31de90cc176850ee799b08ac" | ||
]} | ||
open={true} | ||
onClose={handleCloseModal} | ||
/> | ||
); | ||
expect(screen.getByText("Transactions")).toBeInTheDocument(); | ||
expect(screen.getByText("Confirmed by transactions")).toBeInTheDocument(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { styled, Box } from "@mui/material"; | ||
import { t } from "i18next"; | ||
import { Link } from "react-router-dom"; | ||
|
||
import { details } from "src/commons/routers"; | ||
import DynamicEllipsisText from "src/components/DynamicEllipsisText"; | ||
import CustomModal from "src/components/commons/CustomModal"; | ||
|
||
interface TxsProtocolModalProps { | ||
open: boolean; | ||
onClose: () => void; | ||
txs?: string[] | null; | ||
} | ||
|
||
const TxsProtocolModal: React.FC<TxsProtocolModalProps> = ({ txs, ...props }) => { | ||
return ( | ||
<CustomModal width={550} {...props} title={t("glossary.transactions")}> | ||
<ContentModal> | ||
<Box fontWeight={600} color={({ palette }) => palette.secondary.light} mb={2}> | ||
{t("protocol.trxModalSubTitle")} | ||
</Box> | ||
<Box> | ||
{txs?.map((tx, idx) => ( | ||
<Box | ||
mb={1} | ||
fontWeight={"bold"} | ||
color={({ palette }) => `${palette.primary.main} !important`} | ||
display={"block"} | ||
key={idx} | ||
component={Link} | ||
to={details.transaction(tx, "protocols")} | ||
> | ||
<DynamicEllipsisText value={tx} isTooltip /> | ||
</Box> | ||
))} | ||
</Box> | ||
</ContentModal> | ||
</CustomModal> | ||
); | ||
}; | ||
|
||
export default TxsProtocolModal; | ||
|
||
const ContentModal = styled(Box)(({ theme }) => ({ | ||
padding: "16px 20px", | ||
background: theme.isDark ? theme.palette.secondary[100] : theme.palette.secondary[0], | ||
borderRadius: "8px", | ||
boxShadow: theme.shadow.card | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters