refactor scss

This commit is contained in:
Petropoulos Evangelos 2025-06-30 19:21:27 +03:00
parent 9a8d00e8ff
commit c76099dd3d
27 changed files with 318 additions and 226 deletions

View File

@ -0,0 +1,7 @@
.account-iq-wrapper {
.icon {
font-weight: bold;
color: #4ecdc4;
margin-top: 4px;
}
}

View File

@ -1,17 +1,13 @@
import { styled } from "@mui/material"; import { Box } from "@mui/material";
import { SectionCard } from "../SectionCard/SectionCard"; import { SectionCard } from "../SectionCard/SectionCard";
import "./AccountIQ.scss";
const AccountIQIcon = styled("div")(() => ({
fontWeight: "bold",
color: "#4ecdc4",
marginTop: "4px",
}));
export const AccountIQ = () => { export const AccountIQ = () => {
return ( return (
<Box className="account-iq-wrapper">
<SectionCard <SectionCard
title="AccountIQ" title="AccountIQ"
icon={<AccountIQIcon>AIQ</AccountIQIcon>} icon={<div className="icon">AIQ</div>}
items={[ items={[
{ title: "Automatically reconcile your transactions" }, { title: "Automatically reconcile your transactions" },
{ title: "Live wallet balances from providers" }, { title: "Live wallet balances from providers" },
@ -19,5 +15,6 @@ export const AccountIQ = () => {
{ title: "Learn more" }, { title: "Learn more" },
]} ]}
/> />
</Box>
); );
}; };

View File

@ -0,0 +1,12 @@
.date-range-picker-wrapper {
.date-typo {
font-size: 0.875rem;
cursor: pointer;
padding: 8px;
border-radius: 4px;
&:hover {
background-color: rgba(0, 0, 0, 0.04);
}
}
}

View File

@ -6,18 +6,20 @@ import { format } from "date-fns";
import "react-date-range/dist/styles.css"; import "react-date-range/dist/styles.css";
import "react-date-range/dist/theme/default.css"; import "react-date-range/dist/theme/default.css";
import "./DateRangePicker.scss";
export const DateRangePicker = () => { export const DateRangePicker = () => {
const [range, setRange] = useState<Range[]>([ const [range, setRange] = useState<Range[]>([
{ {
startDate: new Date(), startDate: new Date(),
endDate: new Date(), endDate: new Date(),
key: "selection" key: "selection",
} },
]); ]);
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null); const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
const handleSelect: DateRangeProps['onChange'] = (ranges) => { const handleSelect: DateRangeProps["onChange"] = (ranges) => {
if (ranges.selection) { if (ranges.selection) {
setRange([ranges.selection]); setRange([ranges.selection]);
if (ranges.selection.endDate !== ranges.selection.startDate) { if (ranges.selection.endDate !== ranges.selection.startDate) {
@ -35,22 +37,22 @@ export const DateRangePicker = () => {
}; };
const open = Boolean(anchorEl); const open = Boolean(anchorEl);
const id = open ? 'date-range-popover' : undefined; const id = open ? "date-range-popover" : undefined;
return ( return (
<Box> <Box className="date-range-picker-wrapper">
<Popover <Popover
id={id} id={id}
open={open} open={open}
anchorEl={anchorEl} anchorEl={anchorEl}
onClose={handleClose} onClose={handleClose}
anchorOrigin={{ anchorOrigin={{
vertical: 'bottom', vertical: "bottom",
horizontal: 'left', horizontal: "left",
}} }}
transformOrigin={{ transformOrigin={{
vertical: 'top', vertical: "top",
horizontal: 'left', horizontal: "left",
}} }}
> >
<Paper> <Paper>
@ -64,21 +66,11 @@ export const DateRangePicker = () => {
</Popover> </Popover>
<Box> <Box>
<Typography <Typography onClick={handleClick} className="date-typo">
onClick={handleClick} {format(range[0].startDate ?? new Date(), "PPP")} -{" "}
sx={{ {format(range[0].endDate ?? new Date(), "PPP")}
fontSize: '0.875rem',
cursor: 'pointer',
p: 1,
borderRadius: 1,
'&:hover': {
backgroundColor: 'action.hover',
}
}}
>
{format(range[0].startDate ?? new Date(), "PPP")} - {format(range[0].endDate ?? new Date(), "PPP")}
</Typography> </Typography>
</Box> </Box>
</Box> </Box>
); );
} };

View File

@ -0,0 +1,5 @@
.documentation-wrapper {
.icon {
height: auto;
}
}

View File

@ -1,12 +1,15 @@
import React from "react"; import React from "react";
import DescriptionIcon from "@mui/icons-material/Description"; import DescriptionIcon from "@mui/icons-material/Description";
import { SectionCard } from "../SectionCard/SectionCard"; import { SectionCard } from "../SectionCard/SectionCard";
import { Box } from "@mui/material";
import "./Documentation.scss";
export const Documentation = () => { export const Documentation = () => {
return ( return (
<Box className="documentation-wrapper">
<SectionCard <SectionCard
title="Documentation" title="Documentation"
icon={<DescriptionIcon fontSize="small" sx={{ height: "auto" }} />} icon={<DescriptionIcon className="icon" fontSize="small" />}
items={[ items={[
{ title: "Provider Integration Overview" }, { title: "Provider Integration Overview" },
{ title: "APIs Introduction" }, { title: "APIs Introduction" },
@ -14,5 +17,6 @@ export const Documentation = () => {
{ title: "How-Tos" }, { title: "How-Tos" },
]} ]}
/> />
</Box>
); );
}; };

View File

@ -0,0 +1,6 @@
.fetch-report-paper {
padding: 23px;
margin: 16px;
display: flex;
flex-direction: column;
}

View File

@ -16,6 +16,8 @@ import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
import MoreVertIcon from "@mui/icons-material/MoreVert"; import MoreVertIcon from "@mui/icons-material/MoreVert";
import { DateRangePicker } from "../DateRangePicker/DateRangePicker"; import { DateRangePicker } from "../DateRangePicker/DateRangePicker";
import "./FetchReport.scss";
export const FetchReport = () => { export const FetchReport = () => {
const [state, setState] = useState(""); const [state, setState] = useState("");
const [psp, setPsp] = useState(""); const [psp, setPsp] = useState("");
@ -29,15 +31,7 @@ export const FetchReport = () => {
const isDownloadEnabled = state && psp && reportType; const isDownloadEnabled = state && psp && reportType;
return ( return (
<Paper <Paper className="fetch-report-paper" elevation={3}>
elevation={3}
sx={{
padding: "23px",
margin: 2,
display: "flex",
flexDirection: "column",
}}
>
<Box sx={{ display: "flex", justifyContent: "space-between", mb: 2 }}> <Box sx={{ display: "flex", justifyContent: "space-between", mb: 2 }}>
<Typography variant="h6" fontWeight="bold"> <Typography variant="h6" fontWeight="bold">
Fetch Report Fetch Report

View File

@ -0,0 +1,18 @@
.general-health-card-wrapper {
.header {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
.right-side {
display: flex;
align-items: center;
}
}
.stat-items {
display: flex;
justify-content: space-around;
margin-top: 16px;
}
}

View File

@ -1,8 +1,10 @@
import { Box, Card, CardContent, Typography, IconButton } from "@mui/material"; import { Box, Card, CardContent, Typography, IconButton } from "@mui/material";
import MoreVertIcon from "@mui/icons-material/MoreVert"; import MoreVertIcon from "@mui/icons-material/MoreVert";
import CalendarTodayIcon from "@mui/icons-material/CalendarToday"; import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
import { DateRangePicker } from "../DateRangePicker/DateRangePicker"; import { DateRangePicker } from "../DateRangePicker/DateRangePicker";
import { StatItem } from "./components/StatItem";
import "./GeneralHealthCard.scss";
const stats = [ const stats = [
{ label: "TOTAL", value: 5, change: "-84.85%" }, { label: "TOTAL", value: 5, change: "-84.85%" },
@ -12,46 +14,15 @@ const stats = [
{ label: "ATV", value: "€0.00", change: "-100%" }, { label: "ATV", value: "€0.00", change: "-100%" },
]; ];
const StatItem = ({
label,
value,
change,
}: {
label: string;
value: string | number;
change: string;
}) => (
<Box sx={{ textAlign: "center", px: 2 }}>
<Typography variant="body2" fontWeight="bold" color="text.secondary">
{label}
</Typography>
<Typography variant="h6" fontWeight="bold" mt={0.5}>
{value}
</Typography>
<Box
sx={{
display: "flex",
alignItems: "center",
justifyContent: "center",
color: "error.main",
}}
>
<ArrowDropDownIcon fontSize="small" />
{/* <ArrowDropUp fontSize='small' /> */}
<Typography variant="caption">{change}</Typography>
</Box>
</Box>
);
export const GeneralHealthCard = () => { export const GeneralHealthCard = () => {
return ( return (
<Card sx={{ borderRadius: 3, p: 2 }}> <Card className="general-health-card-wrapper">
<CardContent> <CardContent>
<Box sx={{ display: "flex", justifyContent: "space-between", mb: 2 }}> <Box className="header">
<Typography variant="h5" fontWeight="bold"> <Typography variant="h5" fontWeight="bold">
General Health General Health
</Typography> </Typography>
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}> <Box className="right-side">
<CalendarTodayIcon fontSize="small" /> <CalendarTodayIcon fontSize="small" />
<Typography variant="body2"> <Typography variant="body2">
<DateRangePicker /> <DateRangePicker />
@ -61,7 +32,7 @@ export const GeneralHealthCard = () => {
</IconButton> </IconButton>
</Box> </Box>
</Box> </Box>
<Box sx={{ display: "flex", justifyContent: "space-around", mt: 2 }}> <Box className="stat-items">
{stats.map((item, i) => ( {stats.map((item, i) => (
<StatItem key={item.label + i} {...item} /> <StatItem key={item.label + i} {...item} />
))} ))}

View File

@ -0,0 +1,12 @@
.static-item-wrapper {
text-align: center;
padding-left: 16px;
padding-right: 16px;
.percentage {
display: flex;
align-items: center;
justify-content: center;
color: red;
}
}

View File

@ -0,0 +1,27 @@
import { Box, Typography } from "@mui/material";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
import "./StatItem.scss";
export const StatItem = ({
label,
value,
change,
}: {
label: string;
value: string | number;
change: string;
}) => (
<Box className="static-item-wrapper">
<Typography variant="body2" fontWeight="bold" color="text.secondary">
{label}
</Typography>
<Typography variant="h6" fontWeight="bold" mt={0.5}>
{value}
</Typography>
<Box className="percentage">
<ArrowDropDownIcon fontSize="small" />
{/* <ArrowDropUp fontSize='small' /> */}
<Typography variant="caption">{change}</Typography>
</Box>
</Box>
);

View File

@ -1,11 +1,11 @@
import { Box } from "@mui/material" import { Box } from "@mui/material";
import { GeneralHealthCard } from "../../GeneralHealthCard/GeneralHealthCard" import { GeneralHealthCard } from "../../GeneralHealthCard/GeneralHealthCard";
import { TransactionsOverview } from "../../TransactionsOverview/TransactionsOverview" import { TransactionsOverView } from "../../TransactionsOverView/TransactionsOverView";
import { TransactionsWaitingApproval } from "../../TransactionsWaitingApproval/TransactionsWaitingApproval" import { TransactionsWaitingApproval } from "../../TransactionsWaitingApproval/TransactionsWaitingApproval";
import { FetchReport } from "../../FetchReports/FetchReports" import { FetchReport } from "../../FetchReports/FetchReports";
import { Documentation } from "../../Documentation/Documentation" import { Documentation } from "../../Documentation/Documentation";
import { AccountIQ } from "../../AccountIQ/AccountIQ" import { AccountIQ } from "../../AccountIQ/AccountIQ";
import { WhatsNew } from "../../WhatsNew/WhatsNew" import { WhatsNew } from "../../WhatsNew/WhatsNew";
export const DashboardHomePage = () => { export const DashboardHomePage = () => {
return ( return (
@ -13,12 +13,12 @@ export const DashboardHomePage = () => {
<Box sx={{ p: 2 }}> <Box sx={{ p: 2 }}>
<GeneralHealthCard /> <GeneralHealthCard />
</Box> </Box>
<TransactionsOverview /> <TransactionsOverView />
<FetchReport /> <FetchReport />
<TransactionsWaitingApproval /> <TransactionsWaitingApproval />
<Documentation /> <Documentation />
<AccountIQ /> <AccountIQ />
<WhatsNew /> <WhatsNew />
</> </>
) );
} };

View File

@ -0,0 +1,8 @@
.pie-charts-wrapper {
width: 100%;
height: 300px;
@media (min-width: 960px) {
width: 60%;
}
}

View File

@ -1,12 +1,12 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { Box } from "@mui/material"; import { Box } from "@mui/material";
import { PieChart, Pie, Cell, ResponsiveContainer } from "recharts"; import { PieChart, Pie, Cell, ResponsiveContainer } from "recharts";
import "./PieCharts.scss";
const data = [ const data = [
{ name: "Group A", value: 100 }, { name: "Group A", value: 100 },
{ name: "Group B", value: 200 }, { name: "Group B", value: 200 },
{ name: "Group C", value: 400 }, { name: "Group C", value: 400 },
{ name: "Group D", value: 300 } { name: "Group D", value: 300 },
]; ];
const COLORS = ["#4caf50", "#ff9800", "#f44336", "#9e9e9e"]; const COLORS = ["#4caf50", "#ff9800", "#f44336", "#9e9e9e"];
@ -39,12 +39,7 @@ const renderCustomizedLabel = ({
}; };
export const PieCharts = () => { export const PieCharts = () => {
return ( return (
<Box sx={{ <Box className="pie-charts-wrapper">
width: {
xs: '100%',
md: '60%'
}, height: '300px'
}}>
<ResponsiveContainer width="100%" height="100%"> <ResponsiveContainer width="100%" height="100%">
<PieChart> <PieChart>
<Pie <Pie
@ -58,12 +53,14 @@ export const PieCharts = () => {
dataKey="value" dataKey="value"
> >
{data.map((entry, index) => ( {data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={COLORS[index % COLORS.length]} /> <Cell
key={`cell-${index}`}
fill={COLORS[index % COLORS.length]}
/>
))} ))}
</Pie> </Pie>
</PieChart> </PieChart>
</ResponsiveContainer> </ResponsiveContainer>
</Box> </Box>
); );
} };

View File

@ -0,0 +1,20 @@
.section-card-paper {
padding: 16px;
margin: 16px;
display: flex;
flex-direction: column;
.header {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
.title {
display: flex;
gap: 16px;
}
.icon-wrapper {
display: flex;
align-items: center;
gap: 16px;
}
}
}

View File

@ -13,20 +13,19 @@ import {
import MoreVertIcon from "@mui/icons-material/MoreVert"; import MoreVertIcon from "@mui/icons-material/MoreVert";
import { ISectionCardProps } from "./types"; import { ISectionCardProps } from "./types";
import "./SectionCard.scss";
export const SectionCard = ({ title, icon, items }: ISectionCardProps) => ( export const SectionCard = ({ title, icon, items }: ISectionCardProps) => (
<Paper <Paper className="section-card-paper" elevation={3}>
elevation={3}
sx={{ padding: 2, margin: 2, display: "flex", flexDirection: "column" }}
>
<CardContent> <CardContent>
<Box sx={{ display: "flex", justifyContent: "space-between", mb: 2 }}> <Box className="header">
<Box sx={{ display: "flex", gap: 1 }}> <Box className="title">
{icon} {icon}
<Typography variant="h6" fontWeight="bold"> <Typography variant="h6" fontWeight="bold">
{title} {title}
</Typography> </Typography>
</Box> </Box>
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}> <Box className="icon-wrapper">
<IconButton size="small"> <IconButton size="small">
<MoreVertIcon fontSize="small" /> <MoreVertIcon fontSize="small" />
</IconButton> </IconButton>
@ -36,12 +35,7 @@ export const SectionCard = ({ title, icon, items }: ISectionCardProps) => (
<List dense disablePadding> <List dense disablePadding>
{items.map((item, index) => ( {items.map((item, index) => (
<ListItem key={item.title + index} disableGutters> <ListItem key={item.title + index} disableGutters>
<ListItemText <ListItemText primary={item.title} secondary={item.date} />
primary={item.title}
secondary={item.date}
primaryTypographyProps={{ fontSize: 14 }}
secondaryTypographyProps={{ fontSize: 12 }}
/>
</ListItem> </ListItem>
))} ))}
</List> </List>

View File

@ -0,0 +1,28 @@
.transaction-overview-paper {
padding: 23px;
margin: 16px;
display: flex;
flex-direction: column;
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 8px;
padding-right: 8px;
}
.chart-table-wrapper {
padding: 16px;
margin: 16px;
display: flex;
flex-direction: row;
gap: 32px;
flex-wrap: wrap;
@media (min-width: 960px) {
flex-wrap: nowrap;
gap: 0;
}
}
}

View File

@ -0,0 +1,17 @@
.transactions-overview-table-wrapper {
.state-wrapper {
display: flex;
justify-content: flex-start;
align-items: center;
margin-left: auto;
margin-right: auto;
width: 73px;
.state {
width: 10px;
height: 10px;
border-radius: 50%;
margin-right: 8px;
}
}
}

View File

@ -10,6 +10,8 @@ import {
Button, Button,
} from "@mui/material"; } from "@mui/material";
import "./TransactionsOverViewTable.scss";
const data1 = [ const data1 = [
{ state: "Success", count: 120, percentage: "60%", color: "green" }, { state: "Success", count: 120, percentage: "60%", color: "green" },
{ state: "Pending", count: 50, percentage: "25%", color: "orange" }, { state: "Pending", count: 50, percentage: "25%", color: "orange" },
@ -17,9 +19,12 @@ const data1 = [
{ state: "Other", count: 10, percentage: "5%", color: "gray" }, { state: "Other", count: 10, percentage: "5%", color: "gray" },
]; ];
export const TransactionsOverviewTable = () => { export const TransactionsOverViewTable = () => {
return ( return (
<TableContainer component={Paper}> <TableContainer
className="transactions-overview-table-wrapper"
component={Paper}
>
<Table> <Table>
<TableHead> <TableHead>
<TableRow> <TableRow>
@ -33,22 +38,11 @@ export const TransactionsOverviewTable = () => {
{data1.map((row, i) => ( {data1.map((row, i) => (
<TableRow key={row.state + i}> <TableRow key={row.state + i}>
<TableCell align="center"> <TableCell align="center">
<Box className="state-wrapper">
<Box <Box
className="state"
sx={{ sx={{
display: "flex",
justifyContent: "flex-start",
alignItems: "center",
mx: "auto", // center the flexbox itself
width: "73px", // consistent width for alignment
}}
>
<Box
sx={{
width: 10,
height: 10,
borderRadius: "50%",
bgcolor: row.color, bgcolor: row.color,
mr: 1,
}} }}
/> />
{row.state} {row.state}

View File

@ -3,29 +3,16 @@ import { Box, Button, IconButton, Paper, Typography } from "@mui/material";
import { PieCharts } from "../PieCharts/PieCharts"; import { PieCharts } from "../PieCharts/PieCharts";
import MoreVertIcon from "@mui/icons-material/MoreVert"; import MoreVertIcon from "@mui/icons-material/MoreVert";
import { TransactionsOverviewTable } from "./TransactionsOverViewTable"; import { TransactionsOverViewTable } from "./components/TransactionsOverViewTable";
export const TransactionsOverview = () => { import "./TransactionsOverView.scss";
export const TransactionsOverView = () => {
const router = useRouter(); const router = useRouter();
return ( return (
<Paper <Paper className="transaction-overview-paper" elevation={3}>
elevation={3}
sx={{
padding: "23px",
margin: 2,
display: "flex",
flexDirection: "column",
}}
>
{/* Title and All Transactions Button */} {/* Title and All Transactions Button */}
<Box <Box className="header">
sx={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
px: 1,
}}
>
<Typography variant="h5" fontWeight="bold"> <Typography variant="h5" fontWeight="bold">
Transactions Overview (Last 24h) Transactions Overview (Last 24h)
</Typography> </Typography>
@ -44,24 +31,9 @@ export const TransactionsOverview = () => {
</Box> </Box>
{/* Chart and Table */} {/* Chart and Table */}
<Box <Box className="chart-table-wrapper">
sx={{
padding: 2,
margin: 2,
display: "flex",
flexDirection: "row",
flexWrap: {
xs: "wrap", // Wrap on small screens
md: "nowrap", // No wrap on medium and up
},
gap: {
xs: 4, // Add spacing on small screens
md: 0, // No spacing on larger screens
},
}}
>
<PieCharts /> <PieCharts />
<TransactionsOverviewTable /> <TransactionsOverViewTable />
</Box> </Box>
</Paper> </Paper>
); );

View File

@ -0,0 +1,6 @@
.transactions-waiting-approval-paper {
padding: 16px;
margin: 16px;
display: flex;
flex-direction: column;
}

View File

@ -16,6 +16,7 @@ import CancelIcon from "@mui/icons-material/Cancel";
import MoreVertIcon from "@mui/icons-material/MoreVert"; import MoreVertIcon from "@mui/icons-material/MoreVert";
import "./TransactionsWaitingApproval.scss";
const transactions = [ const transactions = [
{ {
id: "1049078821", id: "1049078821",
@ -119,7 +120,8 @@ export const TransactionsWaitingApproval = () => {
return ( return (
<Paper <Paper
elevation={3} elevation={3}
sx={{ padding: 2, margin: 2, display: "flex", flexDirection: "column" }} className="transactions-waiting-approval-paper"
// sx={{ padding: 2, margin: 2, display: "flex", flexDirection: "column" }}
> >
<Box sx={{ p: 3 }}> <Box sx={{ p: 3 }}>
<Box sx={{ display: "flex", justifyContent: "space-between", mb: 2 }}> <Box sx={{ display: "flex", justifyContent: "space-between", mb: 2 }}>

View File

@ -0,0 +1,5 @@
.whats-new-wrapper {
.icon {
height: auto;
}
}

View File

@ -1,11 +1,14 @@
import { Box } from "@mui/material";
import { SectionCard } from "../SectionCard/SectionCard"; import { SectionCard } from "../SectionCard/SectionCard";
import WifiIcon from "@mui/icons-material/Wifi"; import WifiIcon from "@mui/icons-material/Wifi";
import "./WhatsNew.scss";
export const WhatsNew = () => { export const WhatsNew = () => {
return ( return (
<Box className="whats-new-wrapper">
<SectionCard <SectionCard
title="Whats New" title="Whats New"
icon={<WifiIcon fontSize="small" sx={{ height: "auto" }} />} icon={<WifiIcon className="icon" fontSize="small" />}
items={[ items={[
{ {
title: "Sneak Peek Discover the New Rules Hub Feature", title: "Sneak Peek Discover the New Rules Hub Feature",
@ -23,5 +26,6 @@ export const WhatsNew = () => {
{ title: "Introducing Our New Status Page", date: "09 Sept 2024" }, { title: "Introducing Our New Status Page", date: "09 Sept 2024" },
]} ]}
/> />
</Box>
); );
}; };