@@ -198,7 +201,7 @@ const SignUpForm: React.FC
= ({ authService }) => {
-
+
);
};
diff --git a/src/components/SkeletonList.tsx b/src/components/SkeletonList.tsx
index ffd300212..3463e7e98 100644
--- a/src/components/SkeletonList.tsx
+++ b/src/components/SkeletonList.tsx
@@ -1,9 +1,14 @@
import React from "react";
-import { Skeleton } from "@material-ui/lab";
-import { makeStyles } from "@material-ui/core";
+import { styled } from "@mui/material/styles";
+import { Skeleton } from "@mui/material";
+const PREFIX = "ListSkeleton";
-const useStyles = makeStyles((theme) => ({
- root: {
+const classes = {
+ root: `${PREFIX}-root`,
+};
+
+const Root = styled("div")(({ theme }) => ({
+ [`&.${classes.root}`]: {
minHeight: "100vh",
marginLeft: theme.spacing(2),
marginRight: theme.spacing(2),
@@ -12,9 +17,8 @@ const useStyles = makeStyles((theme) => ({
}));
const ListSkeleton = () => {
- const classes = useStyles();
return (
-
+
@@ -59,7 +63,7 @@ const ListSkeleton = () => {
-
+
);
};
diff --git a/src/components/TransactionAmount.tsx b/src/components/TransactionAmount.tsx
index 8bde02a9a..a4dc04465 100644
--- a/src/components/TransactionAmount.tsx
+++ b/src/components/TransactionAmount.tsx
@@ -1,32 +1,39 @@
import React from "react";
-import { makeStyles, Typography } from "@material-ui/core";
+import { styled } from "@mui/material/styles";
+import { Typography } from "@mui/material";
import { TransactionResponseItem } from "../models";
import { isRequestTransaction, formatAmount } from "../utils/transactionUtils";
-const useStyles = makeStyles((theme) => ({
- amountPositive: {
+const PREFIX = "TransactionAmount";
+
+const classes = {
+ amountPositive: `${PREFIX}-amountPositive`,
+ amountNegative: `${PREFIX}-amountNegative`,
+};
+
+const StyledTypography = styled(Typography)(({ theme }) => ({
+ [`&.${classes.amountPositive}`]: {
fontSize: 24,
- [theme.breakpoints.down("sm")]: {
+ [theme.breakpoints.down("md")]: {
fontSize: theme.typography.body1.fontSize,
},
color: "#4CAF50",
},
- amountNegative: {
+
+ [`&.${classes.amountNegative}`]: {
fontSize: 24,
- [theme.breakpoints.down("sm")]: {
+ [theme.breakpoints.down("md")]: {
fontSize: theme.typography.body1.fontSize,
},
color: "red",
},
-}));
+})) as typeof Typography;
const TransactionAmount: React.FC<{
transaction: TransactionResponseItem;
}> = ({ transaction }) => {
- const classes = useStyles();
-
return (
-
{isRequestTransaction(transaction) ? "+" : "-"}
{transaction.amount && formatAmount(transaction.amount)}
-
+
);
};
diff --git a/src/components/TransactionCreateStepOne.tsx b/src/components/TransactionCreateStepOne.tsx
index 5c843d9b8..09fc428dc 100644
--- a/src/components/TransactionCreateStepOne.tsx
+++ b/src/components/TransactionCreateStepOne.tsx
@@ -1,11 +1,18 @@
import React from "react";
-import { makeStyles, Paper } from "@material-ui/core";
+import { styled } from "@mui/material/styles";
+import { Paper } from "@mui/material";
import UsersList from "./UsersList";
import { User } from "../models";
import UserListSearchForm from "./UserListSearchForm";
-const useStyles = makeStyles((theme) => ({
- paper: {
+const PREFIX = "TransactionCreateStepOne";
+
+const classes = {
+ paper: `${PREFIX}-paper`,
+};
+
+const StyledPaper = styled(Paper)(({ theme }) => ({
+ [`&.${classes.paper}`]: {
//marginTop: theme.spacing(2),
padding: theme.spacing(2),
display: "flex",
@@ -25,13 +32,11 @@ const TransactionCreateStepOne: React.FC = ({
userListSearch,
users,
}) => {
- const classes = useStyles();
-
return (
-
+
-
+
);
};
diff --git a/src/components/TransactionCreateStepThree.tsx b/src/components/TransactionCreateStepThree.tsx
index f20d4cbae..3d1420927 100644
--- a/src/components/TransactionCreateStepThree.tsx
+++ b/src/components/TransactionCreateStepThree.tsx
@@ -1,6 +1,7 @@
import React from "react";
+import { styled } from "@mui/material/styles";
import { Link as RouterLink, useHistory } from "react-router-dom";
-import { Paper, Typography, Grid, Avatar, Box, Button, makeStyles } from "@material-ui/core";
+import { Paper, Typography, Grid, Avatar, Box, Button } from "@mui/material";
import {
BaseActionObject,
Interpreter,
@@ -16,8 +17,14 @@ import {
import { useActor } from "@xstate/react";
import { formatAmount } from "../utils/transactionUtils";
-const useStyles = makeStyles((theme) => ({
- paper: {
+const PREFIX = "TransactionCreateStepThree";
+
+const classes = {
+ paper: `${PREFIX}-paper`,
+};
+
+const StyledPaper = styled(Paper)(({ theme }) => ({
+ [`&.${classes.paper}`]: {
display: "flex",
flexDirection: "column",
alignItems: "center",
@@ -43,14 +50,14 @@ const TransactionCreateStepThree: React.FC = ({
createTransactionService,
}) => {
const history = useHistory();
- const classes = useStyles();
+
const [createTransactionState, sendCreateTransaction] = useActor(createTransactionService);
const receiver = createTransactionState?.context?.receiver;
const transactionDetails = createTransactionState?.context?.transactionDetails;
return (
-
+
= ({
height={200}
style={{ paddingTop: "5%" }}
>
-
+
-
+
@@ -81,7 +94,7 @@ const TransactionCreateStepThree: React.FC = ({
height="100"
style={{ paddingBottom: "5%" }}
>
-
+
{transactionDetails?.transactionType === "payment" ? "Paid " : "Requested "}
@@ -99,7 +112,7 @@ const TransactionCreateStepThree: React.FC = ({
height="100"
style={{ paddingBottom: "5%" }}
>
-
+
-
+
);
};
diff --git a/src/components/TransactionCreateStepTwo.tsx b/src/components/TransactionCreateStepTwo.tsx
index df69d0951..65e44c5ec 100644
--- a/src/components/TransactionCreateStepTwo.tsx
+++ b/src/components/TransactionCreateStepTwo.tsx
@@ -1,42 +1,43 @@
import React, { useState } from "react";
+import { styled } from "@mui/material/styles";
import NumberFormat from "react-number-format";
import { Formik, Form, Field, FieldProps } from "formik";
import { string, object, number } from "yup";
-import {
- Paper,
- Typography,
- Button,
- Grid,
- Container,
- Avatar,
- Box,
- TextField,
- makeStyles,
-} from "@material-ui/core";
+import { Paper, Typography, Button, Grid, Container, Avatar, Box, TextField } from "@mui/material";
import { User } from "../models";
-const validationSchema = object({
- amount: number().required("Please enter a valid amount"),
- description: string().required("Please enter a note"),
- senderId: string(),
- receiverId: string(),
-});
+const PREFIX = "TransactionCreateStepTwo";
+
+const classes = {
+ paper: `${PREFIX}-paper`,
+ form: `${PREFIX}-form`,
+ submit: `${PREFIX}-submit`,
+};
-const useStyles = makeStyles((theme) => ({
- paper: {
+const StyledPaper = styled(Paper)(({ theme }) => ({
+ [`&.${classes.paper}`]: {
display: "flex",
flexDirection: "column",
alignItems: "center",
},
- form: {
+
+ [`& .${classes.form}`]: {
width: "100%",
marginTop: theme.spacing(1),
},
- submit: {
+
+ [`& .${classes.submit}`]: {
margin: theme.spacing(3, 0, 2),
},
}));
+const validationSchema = object({
+ amount: number().required("Please enter a valid amount"),
+ description: string().required("Please enter a note"),
+ senderId: string(),
+ receiverId: string(),
+});
+
interface NumberFormatCustomProps {
inputRef: (el: HTMLInputElement) => void;
onChange: (event: { target: { value: string } }) => void;
@@ -84,7 +85,6 @@ const TransactionCreateStepTwo: React.FC = ({
createTransaction,
showSnackbar,
}) => {
- const classes = useStyles();
const [transactionType, setTransactionType] = useState();
const initialValues: FormValues = {
amount: "",
@@ -94,9 +94,9 @@ const TransactionCreateStepTwo: React.FC = ({
};
return (
-
+
-
+
@@ -167,7 +167,13 @@ const TransactionCreateStepTwo: React.FC = ({
/>
)}
-
+
+
);
};
diff --git a/src/components/TransactionDateRangeFilter.tsx b/src/components/TransactionDateRangeFilter.tsx
index 39ae2956d..7949f3a92 100644
--- a/src/components/TransactionDateRangeFilter.tsx
+++ b/src/components/TransactionDateRangeFilter.tsx
@@ -1,34 +1,23 @@
import React from "react";
+import { styled } from "@mui/material/styles";
import { format as formatDate } from "date-fns";
-import {
- Popover,
- Chip,
- useTheme,
- makeStyles,
- Drawer,
- Button,
- useMediaQuery,
- colors,
-} from "@material-ui/core";
-import { ArrowDropDown as ArrowDropDownIcon, Cancel as CancelIcon } from "@material-ui/icons";
+import { Popover, Chip, useTheme, Drawer, Button, useMediaQuery, colors } from "@mui/material";
+import { ArrowDropDown as ArrowDropDownIcon, Cancel as CancelIcon } from "@mui/icons-material";
import InfiniteCalendar, { Calendar, withRange } from "react-infinite-calendar";
import "react-infinite-calendar/styles.css";
import { TransactionDateRangePayload } from "../models";
import { hasDateQueryFields } from "../utils/transactionUtils";
-const { indigo } = colors;
-const CalendarWithRange = withRange(Calendar);
+const PREFIX = "TransactionListDateRangeFilter";
-export type TransactionListDateRangeFilterProps = {
- filterDateRange: Function;
- dateRangeFilters: TransactionDateRangePayload;
- resetDateRange: Function;
+const classes = {
+ popover: `${PREFIX}-popover`,
};
-const useStyles = makeStyles((theme) => ({
- popover: {
- [theme.breakpoints.down("sm")]: {
+const Root = styled("div")(({ theme }) => ({
+ [`& .${classes.popover}`]: {
+ [theme.breakpoints.down("md")]: {
top: 0,
left: 0,
right: 0,
@@ -37,12 +26,20 @@ const useStyles = makeStyles((theme) => ({
},
}));
+const { indigo } = colors;
+const CalendarWithRange = withRange(Calendar);
+
+export type TransactionListDateRangeFilterProps = {
+ filterDateRange: Function;
+ dateRangeFilters: TransactionDateRangePayload;
+ resetDateRange: Function;
+};
+
const TransactionListDateRangeFilter: React.FC = ({
filterDateRange,
dateRangeFilters,
resetDateRange,
}) => {
- const classes = useStyles();
const theme = useTheme();
const xsBreakpoint = useMediaQuery(theme.breakpoints.only("xs"));
const queryHasDateFields = dateRangeFilters && hasDateQueryFields(dateRangeFilters);
@@ -80,7 +77,7 @@ const TransactionListDateRangeFilter: React.FC
+
{!queryHasDateFields && (
)}
-
+
);
};
diff --git a/src/components/TransactionDetail.tsx b/src/components/TransactionDetail.tsx
index ae87dc62b..44d954482 100644
--- a/src/components/TransactionDetail.tsx
+++ b/src/components/TransactionDetail.tsx
@@ -1,7 +1,8 @@
import React from "react";
-import { Button, Typography, Grid, Avatar, Paper, IconButton, makeStyles } from "@material-ui/core";
-import { AvatarGroup } from "@material-ui/lab";
-import { ThumbUpAltOutlined as LikeIcon, CommentRounded as CommentIcon } from "@material-ui/icons";
+import { styled } from "@mui/material/styles";
+import { Button, Typography, Grid, Avatar, Paper, IconButton } from "@mui/material";
+import { AvatarGroup } from "@mui/material";
+import { ThumbUpAltOutlined as LikeIcon, CommentRounded as CommentIcon } from "@mui/icons-material";
import { TransactionResponseItem, TransactionRequestStatus, User } from "../models";
import CommentForm from "./CommentForm";
import {
@@ -13,34 +14,53 @@ import CommentsList from "./CommentList";
import TransactionTitle from "./TransactionTitle";
import TransactionAmount from "./TransactionAmount";
-const useStyles = makeStyles((theme) => ({
- paper: {
+const PREFIX = "TransactionDetail";
+
+const classes = {
+ paper: `${PREFIX}-paper`,
+ paperComments: `${PREFIX}-paperComments`,
+ avatar: `${PREFIX}-avatar`,
+ headline: `${PREFIX}-headline`,
+ avatarLarge: `${PREFIX}-avatarLarge`,
+ avatarGroup: `${PREFIX}-avatarGroup`,
+ redButton: `${PREFIX}-redButton`,
+ greenButton: `${PREFIX}-greenButton`,
+};
+
+const StyledPaper = styled(Paper)(({ theme }) => ({
+ [`&.${classes.paper}`]: {
padding: theme.spacing(2),
display: "flex",
overflow: "auto",
flexDirection: "column",
},
- paperComments: {
+
+ [`& .${classes.paperComments}`]: {
marginTop: theme.spacing(6),
padding: theme.spacing(2),
display: "flex",
overflow: "auto",
flexDirection: "column",
},
- avatar: {
+
+ [`& .${classes.avatar}`]: {
width: theme.spacing(2),
},
- headline: {
+
+ [`& .${classes.headline}`]: {
marginTop: theme.spacing(4),
},
- avatarLarge: {
+
+ [`& .${classes.avatarLarge}`]: {
width: theme.spacing(7),
height: theme.spacing(7),
},
- avatarGroup: {
+
+ [`& .${classes.avatarGroup}`]: {
margin: 10,
},
- redButton: {
+
+ [`& .${classes.redButton}`]: {
backgrounColor: "red",
color: "#ffffff",
backgroundColor: "red",
@@ -54,7 +74,8 @@ const useStyles = makeStyles((theme) => ({
boxShadow: "none",
},
},
- greenButton: {
+
+ [`& .${classes.greenButton}`]: {
marginRight: theme.spacing(2),
color: "#ffffff",
backgroundColor: "#00C853",
@@ -85,10 +106,8 @@ const TransactionDetail: React.FC
= ({
transactionUpdate,
currentUser,
}) => {
- const classes = useStyles();
-
return (
-
+
= ({
-
-
-
-
-
+
+
+
+
+
+ {/* eat up space to right of AvatarGroup: */}
+
+
+
@@ -139,9 +162,15 @@ const TransactionDetail: React.FC = ({
-
+
-
+
{transaction.likes ? transaction.likes.length : 0}{" "}
@@ -151,6 +180,7 @@ const TransactionDetail: React.FC = ({
disabled={currentUserLikesTransaction(currentUser, transaction)}
onClick={() => transactionLike(transaction.id)}
data-test={`transaction-like-button-${transaction.id}`}
+ size="large"
>
@@ -207,7 +237,7 @@ const TransactionDetail: React.FC = ({
)}
-
+
);
};
diff --git a/src/components/TransactionInfiniteList.tsx b/src/components/TransactionInfiniteList.tsx
index f2c1a7f76..326670c6c 100644
--- a/src/components/TransactionInfiniteList.tsx
+++ b/src/components/TransactionInfiniteList.tsx
@@ -1,20 +1,21 @@
import React from "react";
+import { styled } from "@mui/material/styles";
import { get } from "lodash/fp";
-import { useTheme, makeStyles, useMediaQuery, Divider } from "@material-ui/core";
+import { useTheme, useMediaQuery, Divider } from "@mui/material";
import { InfiniteLoader, List, Index } from "react-virtualized";
import "react-virtualized/styles.css"; // only needs to be imported once
import TransactionItem from "./TransactionItem";
import { TransactionResponseItem, TransactionPagination } from "../models";
-export interface TransactionListProps {
- transactions: TransactionResponseItem[];
- loadNextPage: Function;
- pagination: TransactionPagination;
-}
+const PREFIX = "TransactionInfiniteList";
+
+const classes = {
+ transactionList: `${PREFIX}-transactionList`,
+};
-const useStyles = makeStyles((theme) => ({
- transactionList: {
+const StyledInfiniteLoader = styled(InfiniteLoader)(({ theme }) => ({
+ [`& .${classes.transactionList}`]: {
width: "100%",
minHeight: "80vh",
display: "flex",
@@ -23,15 +24,20 @@ const useStyles = makeStyles((theme) => ({
},
}));
+export interface TransactionListProps {
+ transactions: TransactionResponseItem[];
+ loadNextPage: Function;
+ pagination: TransactionPagination;
+}
+
const TransactionInfiniteList: React.FC = ({
transactions,
loadNextPage,
pagination,
}) => {
- const classes = useStyles();
const theme = useTheme();
- const isXsBreakpoint = useMediaQuery(theme.breakpoints.down("xs"));
- const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
+ const isXsBreakpoint = useMediaQuery(theme.breakpoints.down("sm"));
+ const isMobile = useMediaQuery(theme.breakpoints.down("md"));
const itemCount = pagination.hasNextPages ? transactions.length + 1 : transactions.length;
@@ -58,8 +64,10 @@ const TransactionInfiniteList: React.FC = ({
}
}
+ const removePx = (str: string) => +str.slice(0, str.length - 2);
+
return (
- = ({
rowCount={itemCount}
ref={registerChild}
onRowsRendered={onRowsRendered}
- height={isXsBreakpoint ? theme.spacing(74) : theme.spacing(88)}
- width={isXsBreakpoint ? theme.spacing(38) : theme.spacing(110)}
- rowHeight={isXsBreakpoint ? theme.spacing(28) : theme.spacing(16)}
+ height={isXsBreakpoint ? removePx(theme.spacing(74)) : removePx(theme.spacing(88))}
+ width={isXsBreakpoint ? removePx(theme.spacing(38)) : removePx(theme.spacing(90))}
+ rowHeight={isXsBreakpoint ? removePx(theme.spacing(28)) : removePx(theme.spacing(16))}
rowRenderer={rowRenderer}
/>
)}
-
+
);
};
diff --git a/src/components/TransactionItem.tsx b/src/components/TransactionItem.tsx
index f1f444355..2e2f6ccc3 100644
--- a/src/components/TransactionItem.tsx
+++ b/src/components/TransactionItem.tsx
@@ -1,4 +1,5 @@
import React from "react";
+import { styled } from "@mui/material/styles";
import { useHistory } from "react-router";
import {
ListItem,
@@ -8,37 +9,50 @@ import {
ListItemAvatar,
Paper,
Badge,
- withStyles,
Theme,
- createStyles,
- makeStyles,
-} from "@material-ui/core";
-import { ThumbUpAltOutlined as LikeIcon, CommentRounded as CommentIcon } from "@material-ui/icons";
+} from "@mui/material";
+import { ThumbUpAltOutlined as LikeIcon, CommentRounded as CommentIcon } from "@mui/icons-material";
import { TransactionResponseItem } from "../models";
import TransactionTitle from "./TransactionTitle";
import TransactionAmount from "./TransactionAmount";
-const useStyles = makeStyles((theme) => ({
- root: {
+const PREFIX = "TransactionItem";
+
+const classes = {
+ root: `${PREFIX}-root`,
+ paper: `${PREFIX}-paper`,
+ avatar: `${PREFIX}-avatar`,
+ socialStats: `${PREFIX}-socialStats`,
+ countIcons: `${PREFIX}-countIcons`,
+ countText: `${PREFIX}-countText`,
+};
+
+const StyledListItem = styled(ListItem)(({ theme }) => ({
+ [`& .${classes.root}`]: {
flexGrow: 1,
},
- paper: {
+
+ [`& .${classes.paper}`]: {
padding: theme.spacing(0),
margin: "auto",
width: "100%",
},
- avatar: {
+
+ [`& .${classes.avatar}`]: {
width: theme.spacing(2),
},
- socialStats: {
- [theme.breakpoints.down("sm")]: {
+
+ [`& .${classes.socialStats}`]: {
+ [theme.breakpoints.down("md")]: {
marginTop: theme.spacing(2),
},
},
- countIcons: {
+
+ [`& .${classes.countIcons}`]: {
color: theme.palette.grey[400],
},
- countText: {
+
+ [`& .${classes.countText}`]: {
color: theme.palette.grey[400],
marginTop: 2,
height: theme.spacing(2),
@@ -50,18 +64,15 @@ type TransactionProps = {
transaction: TransactionResponseItem;
};
-const SmallAvatar = withStyles((theme: Theme) =>
- createStyles({
- root: {
- width: 22,
- height: 22,
- border: `2px solid ${theme.palette.background.paper}`,
- },
- })
-)(Avatar);
+const SmallAvatar = styled(Avatar)(({ theme }: { theme: Theme }) => {
+ return {
+ width: 22,
+ height: 22,
+ border: `2px solid ${theme.palette.background.paper}`,
+ };
+});
const TransactionItem: React.FC