index.js 967 B

12345678910111213141516171819202122232425262728
  1. import { Box, Paper, Stack, Typography } from "@mui/material";
  2. import { connect } from "react-redux";
  3. import { DashboardOrder } from "./DashboardOrder";
  4. import { CProfileForm } from "./ProfileForm";
  5. export const DashboardPage = ({ orders = [] }) => {
  6. return (
  7. <Stack className="DashboardPage" spacing={4}>
  8. <Paper className="Paper">
  9. <CProfileForm />
  10. </Paper>
  11. {!!orders.length ? (
  12. <Box mt={2}>
  13. <Typography pb={2} variant="h5">
  14. Замовлення
  15. </Typography>
  16. {orders.map((order) => (
  17. <DashboardOrder order={order} key={order._id} />
  18. ))}
  19. </Box>
  20. ) : (
  21. ""
  22. )}
  23. </Stack>
  24. );
  25. };
  26. export const CDashboardPage = connect((state) => ({ orders: state.promise?.orders?.payload || [] }))(DashboardPage);