Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use InlineToast component for GivBack info toast #4666

Merged
merged 8 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lang/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@
"label.modify_stream_balance": "Modificar el Saldo de la Transmissió",
"label.month": "{count, plural, one { Mes} other { Mesos} }",
"label.monthly": "Mensualment",
"label.sign_in_with_your_eth_wallet_for_givebacks": "Inicia la sessió amb la teva cartera Ethereum per a GIVbacks.",
"label.sign_in_with_your_eth_wallet_for_givebacks": "Inicieu la sessió amb la vostra adreça d'ETH per ser elegible per a GIVbacks.",
"label.monthly_across_all_projects": "mensualment a tots els projectes",
"label.months": "{count, plural, one { Mes} other { Mesos} }",
"label.more_about_us": "Més sobre nosaltres",
Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@
"label.modify_stream_balance": "Modify Stream Balance",
"label.month": "{count, plural, one { Month} other { Months} }",
"label.monthly": "Monthly",
"label.sign_in_with_your_eth_wallet_for_givebacks": "Sign in with your ETH wallet to claim GIVbacks.",
"label.sign_in_with_your_eth_wallet_for_givebacks": "Sign in with your ETH address to be eligible for GIVbacks.",
"label.monthly_across_all_projects": "monthly, across all projects",
"label.months": "{count, plural, one { Month} other { Months} }",
"label.more_about_us": "More about us",
Expand Down
2 changes: 1 addition & 1 deletion lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@
"label.modify_stream_balance": "Modificar el Saldo de Transmisión",
"label.month": "{count, plural, one { Mes} other { Meses} }",
"label.monthly": "Mensualmente",
"label.sign_in_with_your_eth_wallet_for_givebacks": "Inicia sesión con tu billetera ETH para GIVbacks.",
"label.sign_in_with_your_eth_wallet_for_givebacks": "Inicia sesión con tu dirección ETH para poder optar a los GIVbacks.",
"label.monthly_across_all_projects": "mensualmente en todos los proyectos",
"label.months": "{count, plural, one { Mes} other { Meses} }",
"label.more_about_us": "Más acerca de nosotros",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
Flex,
neutralColors,
IconArrowLeft,
brandColors,
mediaQueries,
} from '@giveth/ui-design-system';
import { useIntl } from 'react-intl';
Expand All @@ -26,6 +25,7 @@ import { ChainType } from '@/types/config';
import config from '@/configuration';
import {
truncateToDecimalPlaces,
capitalizeAllWords,
formatBalance,
showToastError,
} from '@/lib/helpers';
Expand All @@ -45,12 +45,6 @@ interface QRDonationCardProps extends IDonationCardProps {
setIsQRDonation: (isQRDonation: boolean) => void;
}

interface IMessage {
text: string;
link: string;
linkText: string;
}

const formatAmountToDisplay = (amount: bigint) => {
const decimals = 18;
return truncateToDecimalPlaces(
Expand All @@ -59,15 +53,6 @@ const formatAmountToDisplay = (amount: bigint) => {
).toString();
};

const GivBackToast: FC<IMessage> = ({ text, link, linkText }) => (
<GivBackWrapper>
<P>{text}</P>
<StyledLink onClick={() => window.open(link, '_blank')}>
{linkText}
</StyledLink>
</GivBackWrapper>
);

export const QRDonationCard: FC<QRDonationCardProps> = ({
showQRCode,
qrAcceptedTokens,
Expand Down Expand Up @@ -350,14 +335,18 @@ export const QRDonationCard: FC<QRDonationCardProps> = ({
disabled={amount === 0n}
/>
{!isSignedIn && stellarToken?.isGivbackEligible && (
<GivBackToast
text={formatMessage({
<InlineToast
noIcon
type={EToastType.Hint}
message={formatMessage({
id: 'label.sign_in_with_your_eth_wallet_for_givebacks',
})}
link={links.GIVBACK_DOC}
linkText={formatMessage({
id: 'label.learn_more',
})}
linkText={capitalizeAllWords(
formatMessage({
id: 'label.learn_more',
}),
)}
/>
)}
</CardBottom>
Expand Down Expand Up @@ -459,26 +448,3 @@ const StyledInputWrapper = styled(InputWrapper)`
const MarginLessInlineToast = styled(InlineToast)`
margin: 0;
`;

const GivBackWrapper = styled(Flex)`
align-items: center;
justify-content: space-between;
border-radius: 8px;
border: 1px solid ${brandColors.giv[500]};
background: ${brandColors.giv[50]};
color: ${brandColors.giv[500]};
padding: 16px;
margin-top: 10px;
gap: 10px;

& > * {
display: inline;
}
`;

const StyledLink = styled.div`
display: inline;
margin-left: 4px;
font-weight: 500;
cursor: pointer;
`;
1 change: 1 addition & 0 deletions src/components/views/transaction/DonationStatusSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ const ButtonStyled = styled(Button)`

const FlexWrap = styled(Flex)`
flex-wrap: wrap;
gap: 10px;
`;

const FlexDirection = styled(Flex)`
Expand Down
Loading