umwd-components 0.1.656 → 0.1.657

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.656",
3
+ "version": "0.1.657",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/src/index.js",
@@ -1,15 +1,13 @@
1
1
  "use client";
2
2
 
3
3
  import React, { useEffect } from "react";
4
- import Paper from "@mui/material/Paper";
5
4
  import Box from "@mui/material/Box";
6
5
  import Stack from "@mui/material/Stack";
7
- import Alert from "@mui/material/Alert";
8
6
  import TextField from "@mui/material/TextField";
9
7
  import Typography from "@mui/material/Typography";
8
+ import { Button } from "@mui/material";
10
9
  import { SubmitButton } from "../../SubmitButton";
11
10
  import { useFormState } from "react-dom";
12
- import { StrapiErrors } from "../../StrapiErrors";
13
11
  import { createCategoryAction } from "../../../data/actions/e-commerce/categories/createCategoryAction";
14
12
  import Grid from "@mui/material/Grid";
15
13
  import ProductSelector from "../products/ProductSelector";
@@ -43,7 +41,6 @@ export function AddCategoryForm({
43
41
  );
44
42
 
45
43
  const { handleAddMessage } = useSnackbar();
46
-
47
44
  useEffect(() => {
48
45
  if (formState?.message) {
49
46
  handleAddMessage({
@@ -52,10 +49,6 @@ export function AddCategoryForm({
52
49
  });
53
50
 
54
51
  if (formState.severity === "success") {
55
- handleAddMessage({
56
- message: formState.message || "Category created successfully",
57
- severity: formState.severity || "success",
58
- });
59
52
  revalidateCallback && revalidateCallback();
60
53
  handleClose && handleClose();
61
54
  }
@@ -75,6 +68,18 @@ export function AddCategoryForm({
75
68
  <Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
76
69
  <form action={formAction}>
77
70
  <Grid container spacing={2}>
71
+ <Grid item xs={12}>
72
+ <Stack spacing={2}>
73
+ <Typography variant="h3" component={"h1"}>
74
+ Add Category
75
+ </Typography>
76
+ <Typography variant="body2">
77
+ Create a new category for your products. You can add products to
78
+ this category later.
79
+ </Typography>
80
+ </Stack>
81
+ </Grid>
82
+
78
83
  <Grid item xs={12}>
79
84
  <Stack spacing={2}>
80
85
  <TextField
@@ -96,19 +101,27 @@ export function AddCategoryForm({
96
101
  currentValue={[]}
97
102
  />
98
103
  </Grid>
104
+
105
+ <Grid item xs={12}>
106
+ <Stack
107
+ direction={"row"}
108
+ justifyContent={"space-between"}
109
+ alignItems={"center"}
110
+ sx={{ pt: 2 }}
111
+ >
112
+ {handleClose && (
113
+ <Button onClick={handleClose} variant="outlined">
114
+ Cancel
115
+ </Button>
116
+ )}
117
+ <SubmitButton
118
+ text="Create category"
119
+ loadingText="Loading..."
120
+ variant="contained"
121
+ />
122
+ </Stack>
123
+ </Grid>
99
124
  </Grid>
100
- {/* <Grid item xs={12}>
101
- <Stack
102
- direction="row-reverse"
103
- spacing={2}
104
- alignItems={"center"}
105
- sx={{
106
- py: 1,
107
- }}
108
- >
109
- <SubmitButton text="create category" loadingText="loading" />
110
- </Stack>
111
- </Grid> */}
112
125
  </form>
113
126
  </Box>
114
127
  );
@@ -1,3 +1,8 @@
1
+ /*
2
+ TODO, This file is not used becuz a AddCategoryForm.tsx was created instead.
3
+ For the moment it's commented out to avoid confusion.
4
+ If this does not lead to any issues, we can remove it later.
5
+
1
6
  "use client";
2
7
 
3
8
  import { useFormState } from "react-dom";
@@ -104,3 +109,4 @@ export default function CreateCategoryForm({
104
109
  </Box>
105
110
  );
106
111
  }
112
+ */
@@ -114,25 +114,25 @@ export function EditCategoryForm({
114
114
  currentValue={[...initialProducts.map((prod) => prod.id)]}
115
115
  />
116
116
  </Grid>
117
- </Grid>
118
- <Grid item xs={12}>
119
- <Stack
120
- direction={"row"}
121
- justifyContent={"space-between"}
122
- alignItems={"center"}
123
- sx={{ pt: 2 }}
124
- >
125
- {handleClose && (
126
- <Button onClick={handleClose} variant="outlined">
127
- Cancel
128
- </Button>
129
- )}
130
- <SubmitButton
131
- text="Update category"
132
- loadingText="Loading..."
133
- variant="contained"
134
- />
135
- </Stack>
117
+
118
+ <Grid item xs={12}>
119
+ <Stack
120
+ direction={"row"}
121
+ justifyContent={"space-between"}
122
+ alignItems={"center"}
123
+ >
124
+ {handleClose && (
125
+ <Button onClick={handleClose} variant="outlined">
126
+ Cancel
127
+ </Button>
128
+ )}
129
+ <SubmitButton
130
+ text="Update category"
131
+ loadingText="Loading..."
132
+ variant="contained"
133
+ />
134
+ </Stack>
135
+ </Grid>
136
136
  </Grid>
137
137
  </form>
138
138
  </Box>
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import { ProductName } from "../../../types/e-commerce/product/types";
3
- import { SxProps } from "@mui/material/styles";
4
- export default function CreateCategoryForm({ productNamesArray, revalidateCallback, handleClose, sx, }: {
5
- productNamesArray: ProductName[];
6
- revalidateCallback?: () => void;
7
- handleClose?: () => void;
8
- sx?: SxProps;
9
- }): import("react").JSX.Element;