49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { Button, Stack } from "@mantine/core";
|
|
import { useModals } from "@mantine/modals";
|
|
import { ModalsContextProps } from "@mantine/modals/lib/context";
|
|
import { FormattedMessage } from "react-intl";
|
|
import { translateOutsideContext } from "../../../hooks/useTranslate.hook";
|
|
import CopyTextField from "../../upload/CopyTextField";
|
|
|
|
const showCompletedReverseShareModal = (
|
|
modals: ModalsContextProps,
|
|
link: string,
|
|
getReverseShares: () => void,
|
|
) => {
|
|
const t = translateOutsideContext();
|
|
return modals.openModal({
|
|
closeOnClickOutside: false,
|
|
withCloseButton: false,
|
|
closeOnEscape: false,
|
|
title: t("account.reverseShares.modal.reverse-share-link"),
|
|
children: <Body link={link} getReverseShares={getReverseShares} />,
|
|
});
|
|
};
|
|
|
|
const Body = ({
|
|
link,
|
|
getReverseShares,
|
|
}: {
|
|
link: string;
|
|
getReverseShares: () => void;
|
|
}) => {
|
|
const modals = useModals();
|
|
|
|
return (
|
|
<Stack align="stretch">
|
|
<CopyTextField link={link} />
|
|
|
|
<Button
|
|
onClick={() => {
|
|
modals.closeAll();
|
|
getReverseShares();
|
|
}}
|
|
>
|
|
<FormattedMessage id="common.button.done" />
|
|
</Button>
|
|
</Stack>
|
|
);
|
|
};
|
|
|
|
export default showCompletedReverseShareModal;
|