Skip to content

Commit

Permalink
feat: translate web-components from map to views (#2476)
Browse files Browse the repository at this point in the history
  • Loading branch information
flagrede committed Sep 18, 2024
1 parent 1813741 commit 5f4f26d
Show file tree
Hide file tree
Showing 129 changed files with 1,492 additions and 679 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
'lingui/no-unlocalized-strings': [
1,
{
ignoreFunction: ['test', 'makeStyles', 'withStyles', 'cn'],
ignoreFunction: ['test', 'makeStyles', 'withStyles', 'cn', 'styled'],
ignoreAttribute: [
'allow',
'sx',
Expand All @@ -24,6 +24,7 @@ module.exports = {
'labelClassName',
'classes',
'classNames',
'previewClassName',
],
ignoreProperty: [
'border',
Expand Down
1 change: 0 additions & 1 deletion web-components/src/components/map/StaticMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import bbox from '@turf/bbox';
import { FeatureCollection } from 'geojson';

import { GreenPinIcon } from '../icons/GreenPinIcon';
import PinIcon from '../icons/PinIcon';

import 'mapbox-gl/dist/mapbox-gl.css';

Expand Down
1 change: 1 addition & 0 deletions web-components/src/components/methodologies/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable lingui/no-unlocalized-strings */
import React from 'react';

function Methodologies(): JSX.Element {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export const Basic: Story = {
return (
<EmailConfirmationModal
{...args}
title="Please check your email"
description="We’ve just sent a confirmation email to:"
helperText="Please enter the code from that email:"
onClose={onClose}
open={open}
error={error ?? args.error}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import { ButtonType } from '../../../types/shared/buttonType';
import { LinkType } from '../../../types/shared/linkType';
import { Body, Title } from '../../typography';
import Modal, { RegenModalProps } from '..';
import {
EMAIL_CONFIRMATION_CODE_HELPER,
EMAIL_CONFIRMATION_DESCRIPTION,
EMAIL_CONFIRMATION_TITLE,
} from './EmailConfirmationModal.constants';

export interface EmailConfirmationModalProps extends RegenModalProps {
ariaLabel: string;
Expand All @@ -23,6 +18,9 @@ export interface EmailConfirmationModalProps extends RegenModalProps {
resendButtonLink?: ButtonType;
cancelButton: ButtonType;
signInButton: ButtonType;
title: string;
description: string;
helperText: string;
onCodeChange: (code: string) => void;
}

Expand All @@ -35,6 +33,9 @@ export const EmailConfirmationModal = ({
error,
cancelButton,
signInButton,
title,
description,
helperText,
onClose,
onCodeChange,
}: EmailConfirmationModalProps) => {
Expand All @@ -51,15 +52,14 @@ export const EmailConfirmationModal = ({
}}
>
<Title align="center" variant="h4" mb={5}>
{EMAIL_CONFIRMATION_TITLE}
{title}
</Title>
<Body size="lg" align="center" mb={5}>
{EMAIL_CONFIRMATION_DESCRIPTION}{' '}
<Link href={mailLink.href}>{mailLink.text}</Link>
{description} <Link href={mailLink.href}>{mailLink.text}</Link>
{'.'}
</Body>
<Body size="lg" align="center" mb={5} sx={{ fontWeight: 700 }}>
{EMAIL_CONFIRMATION_CODE_HELPER}
{helperText}
</Body>
<ConfirmationCode
ariaLabel={ariaLabel}
Expand Down
11 changes: 7 additions & 4 deletions web-components/src/components/modal/ProcessingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,23 @@ const useStyles = makeStyles()(theme => ({
},
}));

export interface ProcessingModalProps extends RegenModalProps {}
export interface ProcessingModalProps extends RegenModalProps {
title: string;
bodyText: string;
}

const ProcessingModal: React.FC<React.PropsWithChildren<ProcessingModalProps>> =
({ open, onClose }) => {
({ open, onClose, title, bodyText }) => {
const { classes: styles, cx } = useStyles();

return (
<Modal className={styles.root} open={open} onClose={onClose}>
<Spinner className={cx(styles.verticalSpacing, styles.spinner)} />
<Title align="center" variant="h3" mb={6}>
Please wait while transaction processes
{title}
</Title>
<Body size="lg" sx={{ mx: 4, mb: [8, 0] }}>
This may take up to 15 seconds.
{bodyText}
</Body>
</Modal>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,30 @@ import { CancelButtonFooter } from 'web-components/src/components/organisms/Canc
import { Body, Title } from 'web-components/src/components/typography';

interface Props extends RegenModalProps {
title: string;
bodyText: string;
buttonText: string;
navigate: () => void;
}

export const SaveChangesWarningModal = ({ open, onClose, navigate }: Props) => {
export const SaveChangesWarningModal = ({
open,
title,
bodyText,
buttonText,
onClose,
navigate,
}: Props) => {
return (
<SadBeeModal open={open} onClose={onClose}>
<Title variant="h4" align="center" sx={{ my: 5 }}>
Are you sure you want to discard your changes?
{title}
</Title>
<Body size="lg" align="center" sx={{ mb: 12.5 }}>
If you proceed, you will lose all unsaved changes you made. This cannot
be undone.
{bodyText}
</Body>
<CancelButtonFooter
label="yes, discard"
label={buttonText}
onCancel={onClose}
onClick={() => {
navigate();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ export const Basic: Story = {
setOpen(false);
};

return <SwitchWalletWarningModal {...args} onClose={onClose} open={open} />;
return (
<SwitchWalletWarningModal
{...args}
onClose={onClose}
open={open}
title="Please select the following wallet address in Keplr in order to proceed"
bodyText="The email address you are using to log in is associated with the above wallet address, so it must be the currently selected account in Keplr in order to continue."
/>
);
},
};
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import { SadBeeIcon } from '../../../components/icons/SadBeeIcon';
import { Body, Subtitle, Title } from '../../typography';
import Modal, { RegenModalProps } from '..';
import {
SWITCH_WALLET_WARNING_MODAL_MESSAGE,
SWITCH_WALLET_WARNING_MODAL_TITLE,
} from './SwitchWalletWarningModal.constants';

export interface KeplrWalletConnectModalProps extends RegenModalProps {
address: string;
title: string;
bodyText: string;
}

const SwitchWalletWarningModal = ({
open,
address,
title,
bodyText,
onClose,
}: KeplrWalletConnectModalProps) => {
return (
<Modal open={open} onClose={onClose} isFullscreenMobile={false}>
<div className="max-w-[460px] flex flex-col items-center">
<SadBeeIcon className="mb-20" />
<Title align="center" variant="h4" mb={5}>
{SWITCH_WALLET_WARNING_MODAL_TITLE}
{title}
</Title>
<Subtitle size="lg" className="mb-20">
{address}
</Subtitle>
<Body size="lg" align="center">
{SWITCH_WALLET_WARNING_MODAL_MESSAGE}
{bodyText}
</Body>
</div>
</Modal>
Expand Down
2 changes: 1 addition & 1 deletion web-components/src/components/modal/TxErrorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const TxErrorModal: React.FC<React.PropsWithChildren<TxErrorModalProps>> = ({
<TxModal
icon={icon ?? <BrokenLinkIcon sx={{ pb: 4.5 }} />}
cardItems={cardItems ? cardItems : defaultCardItems}
title={title ?? 'Sorry, your transaction was not successful.'}
title={title}
{...props}
/>
);
Expand Down
4 changes: 4 additions & 0 deletions web-components/src/components/modal/TxModal.CardItemValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export const CardItemValue = ({
interface CardItemValueListProps {
value: ItemValue[];
color?: string;
seeMoreText: string;
seeLessText: string;
linkComponent: LinkComponentProp;
}

Expand All @@ -68,6 +70,8 @@ export const CardItemValueList = (
<CollapseList
buttonTextSize="xxs"
max={2}
seeMoreText={props.seeMoreText}
seeLessText={props.seeLessText}
items={props.value.map(row => (
<CardItemValue {...props} value={row} key={row.name} />
))}
Expand Down
38 changes: 32 additions & 6 deletions web-components/src/components/modal/TxModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export type LinkComponentProp = React.FC<React.PropsWithChildren<LinkProps>>;
export interface TxModalProps extends RegenModalProps {
onButtonClick: () => void;
cardTitle: string;
buttonTitle?: string;
buttonTitle: string;
cardItems?: Item[];
linkComponent: LinkComponentProp;
txHash: string;
Expand All @@ -67,17 +67,25 @@ export interface TxModalProps extends RegenModalProps {
description?: string;
buttonLink?: string;
socialItems?: SocialItems;
blockchainRecordText: string;
seeMoreText: string;
seeLessText: string;
shareTitle?: string;
}

interface CardItemProps extends Item {
linkComponent: LinkComponentProp;
seeMoreText: string;
seeLessText: string;
}

export const CardItem: React.FC<React.PropsWithChildren<CardItemProps>> = ({
color,
label,
value,
linkComponent,
seeMoreText,
seeLessText,
}) => {
return (
<Box sx={{ pt: 5 }}>
Expand All @@ -90,6 +98,8 @@ export const CardItem: React.FC<React.PropsWithChildren<CardItemProps>> = ({
value={value}
color={color}
linkComponent={linkComponent}
seeMoreText={seeMoreText}
seeLessText={seeLessText}
/>
) : (
<CardItemValue
Expand All @@ -106,7 +116,7 @@ const TxModal: React.FC<React.PropsWithChildren<TxModalProps>> = ({
icon,
title,
description,
buttonTitle = 'view your portfolio',
buttonTitle,
open,
onClose,
onButtonClick,
Expand All @@ -117,6 +127,10 @@ const TxModal: React.FC<React.PropsWithChildren<TxModalProps>> = ({
linkComponent,
buttonLink,
socialItems,
blockchainRecordText,
seeMoreText,
seeLessText,
shareTitle,
}) => {
const { classes: styles } = useStyles();
const hasCardItems = !!cardItems && cardItems.length > 0;
Expand Down Expand Up @@ -166,13 +180,21 @@ const TxModal: React.FC<React.PropsWithChildren<TxModalProps>> = ({
>
<Title variant="h5">{cardTitle}</Title>
{cardItems?.map((item, i) => (
<CardItem {...item} linkComponent={linkComponent} key={i} />
<CardItem
{...item}
linkComponent={linkComponent}
key={i}
seeMoreText={seeMoreText}
seeLessText={seeLessText}
/>
))}
{txHash && (
<CardItem
label="blockchain record"
label={blockchainRecordText}
value={{ name: truncate(txHash), url: txHashUrl }}
linkComponent={linkComponent}
seeMoreText={seeMoreText}
seeLessText={seeLessText}
/>
)}
</Card>
Expand All @@ -185,8 +207,12 @@ const TxModal: React.FC<React.PropsWithChildren<TxModalProps>> = ({
>
{buttonTitle}
</OutlinedButton>
{socialItems && (
<ShareSection items={socialItems} sx={{ mt: 10, maxWidth: 370 }} />
{socialItems && shareTitle && (
<ShareSection
items={socialItems}
sx={{ mt: 10, maxWidth: 370 }}
title={shareTitle}
/>
)}
</Modal>
);
Expand Down
4 changes: 2 additions & 2 deletions web-components/src/components/modal/TxSuccessfulModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import CelebrateRegenIcon from '../icons/CelebrateRegenIcon';
import { TxModal, TxModalProps } from './TxModal';

export interface TxSuccessfulModalProps extends TxModalProps {
title?: string;
title: string;
}

const TxSuccessfulModal: React.FC<TxSuccessfulModalProps> = props => {
return (
<TxModal
{...props}
icon={<CelebrateRegenIcon sx={{ fontSize: 150, height: 100, mb: 5 }} />}
title={props?.title ?? 'Congrats! Your transaction was successful.'}
title={props?.title}
/>
);
};
Expand Down

This file was deleted.

Loading

0 comments on commit 5f4f26d

Please sign in to comment.