Skip to content

Commit 745a350

Browse files
committed
Merge branch 'dev' into e2e-integrate
2 parents 319bcc7 + 115a01d commit 745a350

73 files changed

Lines changed: 5926 additions & 3925 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ cypress
2929
.prettierignore
3030
.prettierrc
3131
mysqlToPostgres.js
32-
/docs
32+
/docs
33+
extensions

package-lock.json

Lines changed: 3753 additions & 3182 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"webpack-bundle-analyzer": "^4.10.2"
5454
},
5555
"dependencies": {
56+
"@sendgrid/mail": "^8.1.6",
5657
"@types/react-slick": "^0.23.13",
5758
"@types/uuid": "^10.0.0",
5859
"uuid": "^13.0.0"

packages/evershop/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"import": "./dist/lib/helpers.js",
2424
"types": "./dist/lib/helpers.d.ts"
2525
},
26+
"./lib/mail/*": {
27+
"import": "./dist/lib/mail/*.js",
28+
"types": "./dist/lib/mail/*.d.ts"
29+
},
2630
"./lib/util/*": {
2731
"import": "./dist/lib/util/*.js",
2832
"types": "./dist/lib/util/*.d.ts"
@@ -183,6 +187,7 @@
183187
"graphql": "^16.6.0",
184188
"graphql-tag": "^2.12.6",
185189
"graphql-type-json": "^0.3.2",
190+
"handlebars": "^4.7.8",
186191
"html-entities": "^2.3.3",
187192
"html-webpack-plugin": "^5.5.0",
188193
"immer": "^10.1.1",
@@ -210,6 +215,7 @@
210215
"react-slick": "^0.31.0",
211216
"react-toastify": "^6.2.0",
212217
"recharts": "^2.0.9",
218+
"sanitize-html": "^2.17.0",
213219
"sass": "^1.53.0",
214220
"sass-loader": "^13.0.2",
215221
"semver": "^7.6.3",
@@ -245,6 +251,7 @@
245251
"@types/node": "^22.14.1",
246252
"@types/pg": "^8.15.2",
247253
"@types/react": "^19.1.2",
254+
"@types/sanitize-html": "^2.16.0",
248255
"copyfiles": "^2.4.1",
249256
"typescript": "^5.8.3"
250257
}

packages/evershop/src/bin/theme/twizz.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ async function getOverrideCandidates(): Promise<string[]> {
255255
}
256256

257257
function getCurrentTheme(): string {
258-
const theme = getConfig<string>('system.theme');
258+
const theme = getConfig('system.theme');
259259
if (theme) {
260260
return theme;
261261
} else {

packages/evershop/src/components/admin/FileBrowser.tsx

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,6 @@ const FileBrowser: React.FC<{
234234
};
235235

236236
// Create a function to fetch files and folders to avoid code duplication
237-
const [apiReady, setApiReady] = React.useState(false);
238-
239237
const fetchFilesAndFolders = React.useCallback(() => {
240238
if (!browserApiRef.current) {
241239
return;
@@ -259,20 +257,6 @@ const FileBrowser: React.FC<{
259257
.finally(() => setLoading(false));
260258
}, [currentPath]);
261259

262-
// Track when the browserApiRef becomes available
263-
React.useEffect(() => {
264-
if (browserApiRef.current && browserApiRef.current !== '' && !apiReady) {
265-
setApiReady(true);
266-
}
267-
}, [browserApiRef.current, apiReady]);
268-
269-
// Fetch data when either the path changes or the API becomes ready
270-
React.useEffect(() => {
271-
if (apiReady) {
272-
fetchFilesAndFolders();
273-
}
274-
}, [apiReady, currentPath, fetchFilesAndFolders]);
275-
276260
const [result] = useQuery({
277261
query: GetApisQuery
278262
});
@@ -296,6 +280,12 @@ const FileBrowser: React.FC<{
296280
deleteApiRef.current = data.deleteApi;
297281
uploadApiRef.current = data.uploadApi;
298282
folderCreateApiRef.current = data.folderCreateApi;
283+
284+
// Fetch files and folders when APIs are ready
285+
React.useEffect(() => {
286+
fetchFilesAndFolders();
287+
}, [currentPath, fetchFilesAndFolders]);
288+
299289
return (
300290
<div className="file-browser">
301291
{loading === true && (
@@ -342,20 +332,22 @@ const FileBrowser: React.FC<{
342332
Root
343333
</a>
344334
</div>
345-
{currentPath.map((f, index) => (
346-
<div key={index}>
347-
<span>/</span>
348-
<a
349-
className="text-primary hover:underline"
350-
href="#"
351-
onClick={(e) =>
352-
onSelectFolderFromBreadcrumb(e, f.index)
353-
}
354-
>
355-
{f.name}
356-
</a>
357-
</div>
358-
))}
335+
{currentPath
336+
.filter((f) => f.name !== '')
337+
.map((f, index) => (
338+
<div key={index}>
339+
<span>/</span>
340+
<a
341+
className="text-primary hover:underline"
342+
href="#"
343+
onClick={(e) =>
344+
onSelectFolderFromBreadcrumb(e, f.index)
345+
}
346+
>
347+
{f.name}
348+
</a>
349+
</div>
350+
))}
359351
</div>
360352
</div>
361353
<ul className="mt-4 mb-4">

packages/evershop/src/components/admin/ImageUploader.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,11 @@ const Upload: React.FC<{
8585
const id = uniqid();
8686
return (
8787
<div className="uploader grid-item">
88-
<div className="uploader-icon text-primary">
89-
<label htmlFor={id}>
88+
<div className="uploader-icon text-primary w-full h-full">
89+
<label
90+
htmlFor={id}
91+
className="w-full h-full flex items-center justify-center cursor-pointer"
92+
>
9093
{uploading ? (
9194
<Spinner
9295
width={isSingleMode ? 40 : 25}

packages/evershop/src/components/admin/NavigationItem.tsx

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,39 @@ export interface NavigationItemProps {
99

1010
export function NavigationItem({ Icon, url, title }: NavigationItemProps) {
1111
const [isActive, setIsActive] = React.useState(false);
12+
1213
React.useEffect(() => {
13-
const currentUrl = window.location.href;
14-
const baseUrl = window.location.origin;
15-
const check = currentUrl.split(baseUrl + url);
16-
if (check.length === 2 && url.indexOf('products/new') === -1) {
17-
// TODO: Fix me
18-
if (url.split('/').length === 2) {
19-
if (check[1] === '' || !/^\/[a-zA-Z1-9]/.test(check[1])) {
14+
const checkActive = () => {
15+
const currentUrl = window.location.href;
16+
const currentUrlObj = new URL(currentUrl);
17+
const menuUrlObj = new URL(url);
18+
19+
const currentPath = currentUrlObj.pathname;
20+
const menuPath = menuUrlObj.pathname;
21+
22+
if (currentPath === menuPath) {
23+
setIsActive(true);
24+
return;
25+
}
26+
27+
const menuSegments = menuPath.split('/').filter(Boolean);
28+
29+
if (menuSegments.length >= 2 && currentPath.startsWith(menuPath + '/')) {
30+
const remainingPath = currentPath.substring(menuPath.length + 1);
31+
const nextSegment = remainingPath.split('/')[0];
32+
33+
const actionWords = ['new', 'create', 'add'];
34+
if (!actionWords.includes(nextSegment.toLowerCase())) {
2035
setIsActive(true);
36+
return;
2137
}
22-
} else {
23-
setIsActive(true);
2438
}
25-
}
26-
}, []);
39+
40+
setIsActive(false);
41+
};
42+
43+
checkActive();
44+
}, [url]);
2745

2846
return (
2947
<li className={isActive ? 'active nav-item' : 'nav-item'}>

packages/evershop/src/components/common/ExtendableTable.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function TableContent<T = any>({
188188
emptyMessage: string;
189189
className: string;
190190
}) {
191-
const { columns, tableData, tableName } = useTableContext<T>();
191+
const { columns, tableData } = useTableContext<T>();
192192

193193
const handleSort = (key: string) => {
194194
if (!onSort) return;
@@ -218,14 +218,12 @@ function TableContent<T = any>({
218218
onClick={() => col.sortable && handleSort(col.key)}
219219
style={{ width: col.width }}
220220
>
221-
<div className="flex items-center space-x-1">
222-
<span>{col.header.label}</span>
223-
{col.sortable && currentSort?.key === col.key && (
224-
<span className="text-blue-500">
225-
{currentSort.direction === 'asc' ? '↑' : '↓'}
226-
</span>
227-
)}
228-
</div>
221+
<span>{col.header.label}</span>
222+
{col.sortable && currentSort?.key === col.key && (
223+
<span className="text-blue-500">
224+
{currentSort.direction === 'asc' ? '↑' : '↓'}
225+
</span>
226+
)}
229227
</TableHead>
230228
))}
231229
</TableRow>

packages/evershop/src/components/common/form/DateField.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export function DateField<T extends FieldValues = FieldValues>({
3737
className,
3838
min,
3939
max,
40+
defaultValue,
4041
...props
4142
}: DateFieldProps<T>) {
4243
const {
@@ -90,6 +91,7 @@ export function DateField<T extends FieldValues = FieldValues>({
9091
<Controller
9192
name={name}
9293
control={control}
94+
defaultValue={defaultValue as any}
9395
rules={validationRules}
9496
render={({ field }) => (
9597
<InputGroup>

0 commit comments

Comments
 (0)