dashboard
This commit is contained in:
Generated
+363
@@ -33,6 +33,7 @@
|
|||||||
"react-router-dom": "^7.8.2",
|
"react-router-dom": "^7.8.2",
|
||||||
"react-spinners": "^0.17.0",
|
"react-spinners": "^0.17.0",
|
||||||
"react-toastify": "^11.0.5",
|
"react-toastify": "^11.0.5",
|
||||||
|
"recharts": "^3.2.1",
|
||||||
"swiper": "^11.2.10",
|
"swiper": "^11.2.10",
|
||||||
"tailwind-merge": "^3.3.1",
|
"tailwind-merge": "^3.3.1",
|
||||||
"yup": "^1.7.0",
|
"yup": "^1.7.0",
|
||||||
@@ -1728,6 +1729,32 @@
|
|||||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@reduxjs/toolkit": {
|
||||||
|
"version": "2.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.9.0.tgz",
|
||||||
|
"integrity": "sha512-fSfQlSRu9Z5yBkvsNhYF2rPS8cGXn/TZVrlwN1948QyZ8xMZ0JvP50S2acZNaf+o63u6aEeMjipFyksjIcWrog==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@standard-schema/spec": "^1.0.0",
|
||||||
|
"@standard-schema/utils": "^0.3.0",
|
||||||
|
"immer": "^10.0.3",
|
||||||
|
"redux": "^5.0.1",
|
||||||
|
"redux-thunk": "^3.1.0",
|
||||||
|
"reselect": "^5.1.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.9.0 || ^17.0.0 || ^18 || ^19",
|
||||||
|
"react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"react-redux": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@rolldown/pluginutils": {
|
"node_modules/@rolldown/pluginutils": {
|
||||||
"version": "1.0.0-beta.34",
|
"version": "1.0.0-beta.34",
|
||||||
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.34.tgz",
|
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.34.tgz",
|
||||||
@@ -1995,6 +2022,18 @@
|
|||||||
"win32"
|
"win32"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"node_modules/@standard-schema/spec": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@standard-schema/utils": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz",
|
||||||
|
"integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@swc/helpers": {
|
"node_modules/@swc/helpers": {
|
||||||
"version": "0.5.17",
|
"version": "0.5.17",
|
||||||
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.17.tgz",
|
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.17.tgz",
|
||||||
@@ -2364,6 +2403,69 @@
|
|||||||
"@babel/types": "^7.28.2"
|
"@babel/types": "^7.28.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/d3-array": {
|
||||||
|
"version": "3.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz",
|
||||||
|
"integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@types/d3-color": {
|
||||||
|
"version": "3.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",
|
||||||
|
"integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@types/d3-ease": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@types/d3-interpolate": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz",
|
||||||
|
"integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/d3-color": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/d3-path": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@types/d3-scale": {
|
||||||
|
"version": "4.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz",
|
||||||
|
"integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/d3-time": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/d3-shape": {
|
||||||
|
"version": "3.1.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz",
|
||||||
|
"integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/d3-path": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/d3-time": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz",
|
||||||
|
"integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@types/d3-timer": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@types/estree": {
|
"node_modules/@types/estree": {
|
||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
|
||||||
@@ -2418,6 +2520,12 @@
|
|||||||
"@types/react": "^19.0.0"
|
"@types/react": "^19.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/use-sync-external-store": {
|
||||||
|
"version": "0.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",
|
||||||
|
"integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||||
"version": "8.41.0",
|
"version": "8.41.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.41.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.41.0.tgz",
|
||||||
@@ -3102,6 +3210,127 @@
|
|||||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
|
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/d3-array": {
|
||||||
|
"version": "3.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz",
|
||||||
|
"integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"internmap": "1 - 2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/d3-color": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/d3-ease": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/d3-format": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/d3-interpolate": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"d3-color": "1 - 3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/d3-path": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/d3-scale": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"d3-array": "2.10.0 - 3",
|
||||||
|
"d3-format": "1 - 3",
|
||||||
|
"d3-interpolate": "1.2.0 - 3",
|
||||||
|
"d3-time": "2.1.1 - 3",
|
||||||
|
"d3-time-format": "2 - 4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/d3-shape": {
|
||||||
|
"version": "3.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz",
|
||||||
|
"integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"d3-path": "^3.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/d3-time": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"d3-array": "2 - 3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/d3-time-format": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"d3-time": "1 - 3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/d3-timer": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.4.1",
|
"version": "4.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
|
||||||
@@ -3120,6 +3349,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/decimal.js-light": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/deep-is": {
|
"node_modules/deep-is": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
||||||
@@ -3239,6 +3474,16 @@
|
|||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/es-toolkit": {
|
||||||
|
"version": "1.39.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.39.10.tgz",
|
||||||
|
"integrity": "sha512-E0iGnTtbDhkeczB0T+mxmoVlT4YNweEKBLq7oaU4p11mecdsZpNWOglI4895Vh4usbQ+LsJiuLuI2L0Vdmfm2w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"workspaces": [
|
||||||
|
"docs",
|
||||||
|
"benchmarks"
|
||||||
|
]
|
||||||
|
},
|
||||||
"node_modules/esbuild": {
|
"node_modules/esbuild": {
|
||||||
"version": "0.25.9",
|
"version": "0.25.9",
|
||||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.9.tgz",
|
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.9.tgz",
|
||||||
@@ -3955,6 +4200,16 @@
|
|||||||
"node": ">= 4"
|
"node": ">= 4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/immer": {
|
||||||
|
"version": "10.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/immer/-/immer-10.1.3.tgz",
|
||||||
|
"integrity": "sha512-tmjF/k8QDKydUlm3mZU+tjM6zeq9/fFpPqH9SzWmBnVVKsPBg/V66qsMwb3/Bo90cgUN+ghdVBess+hPsxUyRw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/immer"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/import-fresh": {
|
"node_modules/import-fresh": {
|
||||||
"version": "3.3.1",
|
"version": "3.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
|
||||||
@@ -3982,6 +4237,15 @@
|
|||||||
"node": ">=0.8.19"
|
"node": ">=0.8.19"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/internmap": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/is-extglob": {
|
"node_modules/is-extglob": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||||
@@ -5003,6 +5267,29 @@
|
|||||||
"react-dom": "^16 || ^17 || ^18 || ^19"
|
"react-dom": "^16 || ^17 || ^18 || ^19"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-redux": {
|
||||||
|
"version": "9.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",
|
||||||
|
"integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/use-sync-external-store": "^0.0.6",
|
||||||
|
"use-sync-external-store": "^1.4.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/react": "^18.2.25 || ^19",
|
||||||
|
"react": "^18.0 || ^19",
|
||||||
|
"redux": "^5.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/react": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"redux": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-refresh": {
|
"node_modules/react-refresh": {
|
||||||
"version": "0.17.0",
|
"version": "0.17.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",
|
||||||
@@ -5143,6 +5430,54 @@
|
|||||||
"react-dom": "^18 || ^19"
|
"react-dom": "^18 || ^19"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/recharts": {
|
||||||
|
"version": "3.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/recharts/-/recharts-3.2.1.tgz",
|
||||||
|
"integrity": "sha512-0JKwHRiFZdmLq/6nmilxEZl3pqb4T+aKkOkOi/ZISRZwfBhVMgInxzlYU9D4KnCH3KINScLy68m/OvMXoYGZUw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@reduxjs/toolkit": "1.x.x || 2.x.x",
|
||||||
|
"clsx": "^2.1.1",
|
||||||
|
"decimal.js-light": "^2.5.1",
|
||||||
|
"es-toolkit": "^1.39.3",
|
||||||
|
"eventemitter3": "^5.0.1",
|
||||||
|
"immer": "^10.1.1",
|
||||||
|
"react-redux": "8.x.x || 9.x.x",
|
||||||
|
"reselect": "5.1.1",
|
||||||
|
"tiny-invariant": "^1.3.3",
|
||||||
|
"use-sync-external-store": "^1.2.2",
|
||||||
|
"victory-vendor": "^37.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
||||||
|
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
||||||
|
"react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/redux": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/redux-thunk": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"redux": "^5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/reselect": {
|
||||||
|
"version": "5.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz",
|
||||||
|
"integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/resolve-from": {
|
"node_modules/resolve-from": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||||
@@ -5393,6 +5728,12 @@
|
|||||||
"integrity": "sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==",
|
"integrity": "sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/tiny-invariant": {
|
||||||
|
"version": "1.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",
|
||||||
|
"integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/tiny-warning": {
|
"node_modules/tiny-warning": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
|
||||||
@@ -5655,6 +5996,28 @@
|
|||||||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/victory-vendor": {
|
||||||
|
"version": "37.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz",
|
||||||
|
"integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==",
|
||||||
|
"license": "MIT AND ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/d3-array": "^3.0.3",
|
||||||
|
"@types/d3-ease": "^3.0.0",
|
||||||
|
"@types/d3-interpolate": "^3.0.1",
|
||||||
|
"@types/d3-scale": "^4.0.2",
|
||||||
|
"@types/d3-shape": "^3.1.0",
|
||||||
|
"@types/d3-time": "^3.0.0",
|
||||||
|
"@types/d3-timer": "^3.0.0",
|
||||||
|
"d3-array": "^3.1.6",
|
||||||
|
"d3-ease": "^3.0.1",
|
||||||
|
"d3-interpolate": "^3.0.1",
|
||||||
|
"d3-scale": "^4.0.2",
|
||||||
|
"d3-shape": "^3.1.0",
|
||||||
|
"d3-time": "^3.0.0",
|
||||||
|
"d3-timer": "^3.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/vite": {
|
"node_modules/vite": {
|
||||||
"version": "7.1.7",
|
"version": "7.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.7.tgz",
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
"react-router-dom": "^7.8.2",
|
"react-router-dom": "^7.8.2",
|
||||||
"react-spinners": "^0.17.0",
|
"react-spinners": "^0.17.0",
|
||||||
"react-toastify": "^11.0.5",
|
"react-toastify": "^11.0.5",
|
||||||
|
"recharts": "^3.2.1",
|
||||||
"swiper": "^11.2.10",
|
"swiper": "^11.2.10",
|
||||||
"tailwind-merge": "^3.3.1",
|
"tailwind-merge": "^3.3.1",
|
||||||
"yup": "^1.7.0",
|
"yup": "^1.7.0",
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
import { type FC } from 'react'
|
||||||
|
import { useGetDashboard, useGetOrderChart } from './hooks/useDashboardData'
|
||||||
|
import { useLocation } from 'react-router-dom'
|
||||||
|
import PageLoading from '../../components/PageLoading'
|
||||||
|
import Error from '../../components/Error'
|
||||||
|
import DashboardOverview from './components/DashboardOverview'
|
||||||
|
import ProductsCountSection from './components/ProductsCountSection'
|
||||||
|
import OrdersCountSection from './components/OrdersCountSection'
|
||||||
|
import UnreadCommentsSection from './components/UnreadCommentsSection'
|
||||||
|
import UsersCountSection from './components/UsersCountSection'
|
||||||
|
import OrdersChartSection from './components/OrdersChartSection'
|
||||||
|
|
||||||
|
const Dashboard: FC = () => {
|
||||||
|
const location = useLocation()
|
||||||
|
const { data, isLoading, error } = useGetDashboard()
|
||||||
|
const { data: orderChartData } = useGetOrderChart()
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return (
|
||||||
|
<div className="flex justify-center items-center min-h-[400px]">
|
||||||
|
<PageLoading />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return (
|
||||||
|
<div className="flex justify-center items-center min-h-[400px]">
|
||||||
|
<Error errorText="خطا در بارگذاری اطلاعات داشبورد" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const renderDashboardContent = () => {
|
||||||
|
const path = location.pathname
|
||||||
|
|
||||||
|
if (path.includes('products-count')) {
|
||||||
|
return <ProductsCountSection data={data?.results} />
|
||||||
|
} else if (path.includes('orders-count')) {
|
||||||
|
return <OrdersCountSection data={data?.results} />
|
||||||
|
} else if (path.includes('unread-comments')) {
|
||||||
|
return <UnreadCommentsSection data={data?.results} />
|
||||||
|
} else if (path.includes('users-count')) {
|
||||||
|
return <UsersCountSection data={data?.results} />
|
||||||
|
} else if (path.includes('orders-chart')) {
|
||||||
|
return <OrdersChartSection
|
||||||
|
dashboardData={data?.results}
|
||||||
|
orderChartData={orderChartData?.results}
|
||||||
|
/>
|
||||||
|
} else {
|
||||||
|
// نمایش داشبورد کلی
|
||||||
|
return <DashboardOverview data={data?.results} />
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="p-6">
|
||||||
|
{renderDashboardContent()}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default Dashboard
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
import { type FC } from 'react'
|
||||||
|
import TitleLine from '../../../components/TitleLine'
|
||||||
|
import { type DashboardData } from '../types/Types'
|
||||||
|
import { Box, ShoppingCart, Message, User } from 'iconsax-react'
|
||||||
|
import StatCard from './StatCard'
|
||||||
|
|
||||||
|
const DashboardOverview: FC<{ data?: DashboardData }> = ({ data }) => {
|
||||||
|
if (!data) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6">
|
||||||
|
{/* دیباگ دادههای API */}
|
||||||
|
<div className="bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6">
|
||||||
|
<h4 className="text-sm font-medium text-blue-800 mb-2">ℹ️ وضعیت اتصال به API</h4>
|
||||||
|
<div className="text-xs text-blue-700 space-y-1">
|
||||||
|
<div><strong>دادههای واقعی API:</strong> {Array.isArray(data?.FiveDaysAgoSales) ? `✅ ${data.FiveDaysAgoSales.length} آیتم دریافت شد` : '❌ دادهای وجود ندارد'}</div>
|
||||||
|
<div><strong>نمودار:</strong> {Array.isArray(data?.FiveDaysAgoSales) && data.FiveDaysAgoSales.length > 0 ? '✅ نمایش دادههای واقعی API' : '⏳ در انتظار دادههای API'}</div>
|
||||||
|
<div><strong>منطق نمایش:</strong> فقط از دادههای واقعی API استفاده میشود</div>
|
||||||
|
</div>
|
||||||
|
{Array.isArray(data?.FiveDaysAgoSales) && data.FiveDaysAgoSales.length > 0 && (
|
||||||
|
<div className="mt-3 p-2 bg-white rounded text-xs">
|
||||||
|
<div className="font-medium mb-1">نمونه داده واقعی API:</div>
|
||||||
|
<pre className="text-gray-600 overflow-x-auto">
|
||||||
|
{JSON.stringify(data.FiveDaysAgoSales[0], null, 2)}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="mt-3 p-2 bg-green-50 rounded text-xs">
|
||||||
|
<div className="font-medium mb-1 text-green-800">🎯 نحوه عملکرد نمودار:</div>
|
||||||
|
<div className="text-green-700">
|
||||||
|
۱. فقط از دادههای واقعی API استفاده میشود<br />
|
||||||
|
۲. اگر داده وجود نداشته باشد، نمودار خالی نمایش داده میشود<br />
|
||||||
|
۳. هیچ داده نمونهای استفاده نمیشود<br />
|
||||||
|
۴. ساختار دادههای مورد انتظار: totalSales, totalOrders
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<TitleLine title="نمای کلی داشبورد" />
|
||||||
|
|
||||||
|
{/* آمار کلی */}
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||||
|
<StatCard
|
||||||
|
title="تعداد محصولات"
|
||||||
|
value={data.productCount}
|
||||||
|
icon={<Box size={24} color="#3B82F6" />}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
title="تعداد سفارشات"
|
||||||
|
value={data.proccessingOrders}
|
||||||
|
icon={<ShoppingCart size={24} color="#10B981" />}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
title="کامنت های خوانده نشده"
|
||||||
|
value={data.pendingComments}
|
||||||
|
icon={<Message size={24} color="#F59E0B" />}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
title="تعداد کاربران"
|
||||||
|
value={data.usersCount}
|
||||||
|
icon={<User size={24} color="#8B5CF6" />}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* آمار فروش روزانه */}
|
||||||
|
<div className="bg-white rounded-lg p-6 shadow-sm">
|
||||||
|
<h3 className="text-lg font-medium mb-4">آمار فروش روزانه</h3>
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="text-2xl font-bold text-blue-600">{data.dailySales.totalOrders}</div>
|
||||||
|
<div className="text-sm text-gray-600">تعداد سفارشات</div>
|
||||||
|
</div>
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="text-2xl font-bold text-green-600">{data.dailySales.totalSales.toLocaleString()} تومان</div>
|
||||||
|
<div className="text-sm text-gray-600">مجموع فروش</div>
|
||||||
|
</div>
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="text-2xl font-bold text-purple-600">{data.dailySales.itemsSold}</div>
|
||||||
|
<div className="text-sm text-gray-600">تعداد آیتم فروش رفته</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DashboardOverview
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
import { type FC } from 'react'
|
||||||
|
import TitleLine from '../../../components/TitleLine'
|
||||||
|
import { type DashboardData, type OrderChartData } from '../types/Types'
|
||||||
|
import { Chart } from 'iconsax-react'
|
||||||
|
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, BarChart, Bar } from 'recharts'
|
||||||
|
|
||||||
|
export interface OrdersChartSectionProps {
|
||||||
|
dashboardData?: DashboardData
|
||||||
|
orderChartData?: OrderChartData
|
||||||
|
}
|
||||||
|
|
||||||
|
const OrdersChartSection: FC<OrdersChartSectionProps> = ({
|
||||||
|
dashboardData,
|
||||||
|
orderChartData
|
||||||
|
}) => {
|
||||||
|
// پردازش دادههای Order Chart API
|
||||||
|
const processOrderChartData = (chartData?: OrderChartData) => {
|
||||||
|
if (chartData && chartData.xAxis && chartData.yAxis) {
|
||||||
|
return chartData.xAxis.map((xValue, index) => ({
|
||||||
|
name: xValue,
|
||||||
|
value: chartData.yAxis[index] || 0,
|
||||||
|
sales: chartData.yAxis[index] || 0,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
// پردازش دادههای ۵ روز گذشته برای نمودار (fallback)
|
||||||
|
const processDashboardChartData = (rawData: unknown) => {
|
||||||
|
if (Array.isArray(rawData) && rawData.length > 0) {
|
||||||
|
return (rawData as Array<Record<string, unknown>>).slice(-5).map((item, index: number) => ({
|
||||||
|
name: `${5 - index} روز پیش`,
|
||||||
|
sales: (item.totalSales as number) || (item.sales as number) || 0,
|
||||||
|
orders: (item.totalOrders as number) || (item.orders as number) || 0,
|
||||||
|
date: item.date || item.created_at || `روز ${5 - index}`,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
// اولویت با دادههای Order Chart API
|
||||||
|
const orderChartProcessed = processOrderChartData(orderChartData)
|
||||||
|
const dashboardChartProcessed = processDashboardChartData(dashboardData?.FiveDaysAgoSales)
|
||||||
|
|
||||||
|
// استفاده از دادههای Order Chart اگر موجود باشد، در غیر این صورت از Dashboard استفاده کن
|
||||||
|
const chartData = orderChartProcessed.length > 0 ? orderChartProcessed : dashboardChartProcessed
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6">
|
||||||
|
<TitleLine title="نمودار سفارشات" />
|
||||||
|
|
||||||
|
{/* نمودار فروش ۵ روز گذشته */}
|
||||||
|
<div className="bg-white rounded-lg p-6 shadow-sm">
|
||||||
|
<div className="flex items-center gap-3 mb-6">
|
||||||
|
<Chart size={24} color="#3B82F6" />
|
||||||
|
<h3 className="text-lg font-medium">آمار فروش ۵ روز گذشته</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="h-80 w-full">
|
||||||
|
{chartData.length > 0 ? (
|
||||||
|
<ResponsiveContainer width="100%" height="100%">
|
||||||
|
<LineChart data={chartData}>
|
||||||
|
<CartesianGrid strokeDasharray="3 3" />
|
||||||
|
<XAxis
|
||||||
|
dataKey="name"
|
||||||
|
tick={{ fontSize: 12 }}
|
||||||
|
axisLine={false}
|
||||||
|
tickLine={false}
|
||||||
|
/>
|
||||||
|
<YAxis
|
||||||
|
tick={{ fontSize: 12 }}
|
||||||
|
axisLine={false}
|
||||||
|
tickLine={false}
|
||||||
|
tickFormatter={(value) => orderChartData ? value.toLocaleString() : `${(value / 1000000).toFixed(1)}M`}
|
||||||
|
/>
|
||||||
|
<Tooltip
|
||||||
|
formatter={(value: number, name: string) => {
|
||||||
|
if (orderChartData) {
|
||||||
|
return [
|
||||||
|
`${value.toLocaleString()} ${orderChartData.unit || 'تومان'}`,
|
||||||
|
orderChartData.title || 'مقدار'
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
return [
|
||||||
|
name === 'sales' ? `${value.toLocaleString()} تومان` : value,
|
||||||
|
name === 'sales' ? 'فروش' : 'سفارشات'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
labelStyle={{ color: '#374151' }}
|
||||||
|
contentStyle={{
|
||||||
|
backgroundColor: '#ffffff',
|
||||||
|
border: '1px solid #e5e7eb',
|
||||||
|
borderRadius: '8px',
|
||||||
|
boxShadow: '0 4px 6px -1px rgb(0 0 0 / 0.1)'
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Line
|
||||||
|
type="monotone"
|
||||||
|
dataKey="sales"
|
||||||
|
stroke="#3B82F6"
|
||||||
|
strokeWidth={3}
|
||||||
|
dot={{ fill: '#3B82F6', strokeWidth: 2, r: 4 }}
|
||||||
|
activeDot={{ r: 6, stroke: '#3B82F6', strokeWidth: 2 }}
|
||||||
|
/>
|
||||||
|
</LineChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
) : (
|
||||||
|
<div className="flex items-center justify-center h-full">
|
||||||
|
<div className="text-center">
|
||||||
|
<Chart size={48} color="#9CA3AF" className="mx-auto mb-4" />
|
||||||
|
<div className="text-gray-500 text-sm">
|
||||||
|
دادهای برای نمایش نمودار وجود ندارد
|
||||||
|
</div>
|
||||||
|
<div className="text-gray-400 text-xs mt-1">
|
||||||
|
منتظر دریافت داده از API...
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* نمودار مقایسه فروش و سفارشات */}
|
||||||
|
<div className="bg-white rounded-lg p-6 shadow-sm">
|
||||||
|
<h3 className="text-lg font-medium mb-6">مقایسه فروش و تعداد سفارشات</h3>
|
||||||
|
|
||||||
|
<div className="h-80 w-full">
|
||||||
|
{chartData.length > 0 ? (
|
||||||
|
<ResponsiveContainer width="100%" height="100%">
|
||||||
|
<BarChart data={chartData}>
|
||||||
|
<CartesianGrid strokeDasharray="3 3" />
|
||||||
|
<XAxis
|
||||||
|
dataKey="name"
|
||||||
|
tick={{ fontSize: 12 }}
|
||||||
|
axisLine={false}
|
||||||
|
tickLine={false}
|
||||||
|
/>
|
||||||
|
<YAxis
|
||||||
|
yAxisId="left"
|
||||||
|
tick={{ fontSize: 12 }}
|
||||||
|
axisLine={false}
|
||||||
|
tickLine={false}
|
||||||
|
tickFormatter={(value) => orderChartData ? value.toLocaleString() : `${(value / 1000000).toFixed(1)}M`}
|
||||||
|
/>
|
||||||
|
<YAxis
|
||||||
|
yAxisId="right"
|
||||||
|
orientation="right"
|
||||||
|
tick={{ fontSize: 12 }}
|
||||||
|
axisLine={false}
|
||||||
|
tickLine={false}
|
||||||
|
/>
|
||||||
|
<Tooltip
|
||||||
|
formatter={(value: number, name: string) => {
|
||||||
|
if (orderChartData) {
|
||||||
|
return [
|
||||||
|
`${value.toLocaleString()} ${orderChartData.unit || 'تومان'}`,
|
||||||
|
orderChartData.title || 'مقدار'
|
||||||
|
]
|
||||||
|
} else {
|
||||||
|
return [
|
||||||
|
name === 'sales' ? `${value.toLocaleString()} تومان` : value,
|
||||||
|
name === 'sales' ? 'فروش' : 'سفارشات'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
labelStyle={{ color: '#374151' }}
|
||||||
|
contentStyle={{
|
||||||
|
backgroundColor: '#ffffff',
|
||||||
|
border: '1px solid #e5e7eb',
|
||||||
|
borderRadius: '8px',
|
||||||
|
boxShadow: '0 4px 6px -1px rgb(0 0 0 / 0.1)'
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Bar
|
||||||
|
yAxisId="left"
|
||||||
|
dataKey="sales"
|
||||||
|
fill="#10B981"
|
||||||
|
radius={[4, 4, 0, 0]}
|
||||||
|
/>
|
||||||
|
<Bar
|
||||||
|
yAxisId="right"
|
||||||
|
dataKey="orders"
|
||||||
|
fill="#8B5CF6"
|
||||||
|
radius={[4, 4, 0, 0]}
|
||||||
|
/>
|
||||||
|
</BarChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
) : (
|
||||||
|
<div className="flex items-center justify-center h-full">
|
||||||
|
<div className="text-center">
|
||||||
|
<Chart size={48} color="#9CA3AF" className="mx-auto mb-4" />
|
||||||
|
<div className="text-gray-500 text-sm">
|
||||||
|
دادهای برای نمایش نمودار مقایسه وجود ندارد
|
||||||
|
</div>
|
||||||
|
<div className="text-gray-400 text-xs mt-1">
|
||||||
|
منتظر دریافت داده از API...
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{chartData.length > 0 && (
|
||||||
|
<div className="flex justify-center gap-6 mt-4">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="w-4 h-4 bg-green-500 rounded"></div>
|
||||||
|
<span className="text-sm text-gray-600">فروش (تومان)</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<div className="w-4 h-4 bg-purple-500 rounded"></div>
|
||||||
|
<span className="text-sm text-gray-600">تعداد سفارشات</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* آمار ماهانه */}
|
||||||
|
<div className="bg-white rounded-lg p-6 shadow-sm">
|
||||||
|
<h3 className="text-lg font-medium mb-4">آمار فروش ماهانه</h3>
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="text-2xl font-bold text-blue-600">{dashboardData?.monthlySales?.totalOrders || 0}</div>
|
||||||
|
<div className="text-sm text-gray-600">تعداد سفارشات</div>
|
||||||
|
</div>
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="text-2xl font-bold text-green-600">{dashboardData?.monthlySales?.totalSales?.toLocaleString() || 0} تومان</div>
|
||||||
|
<div className="text-sm text-gray-600">مجموع فروش</div>
|
||||||
|
</div>
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="text-2xl font-bold text-purple-600">{dashboardData?.monthlySales?.itemsSold || 0}</div>
|
||||||
|
<div className="text-sm text-gray-600">تعداد آیتم فروش رفته</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default OrdersChartSection
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import { type FC } from 'react'
|
||||||
|
import TitleLine from '../../../components/TitleLine'
|
||||||
|
import { type DashboardData } from '../types/Types'
|
||||||
|
import { ShoppingCart } from 'iconsax-react'
|
||||||
|
import StatCard from './StatCard'
|
||||||
|
|
||||||
|
const OrdersCountSection: FC<{ data?: DashboardData }> = ({ data }) => {
|
||||||
|
if (!data) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6">
|
||||||
|
<TitleLine title="آمار سفارشات" />
|
||||||
|
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
|
<StatCard
|
||||||
|
title="سفارشات در حال پردازش"
|
||||||
|
value={data.proccessingOrders}
|
||||||
|
icon={<ShoppingCart size={24} color="#10B981" />}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
title="درخواستهای برداشت وجه"
|
||||||
|
value={data.withdrawalRequests}
|
||||||
|
icon={<ShoppingCart size={24} color="#F59E0B" />}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* آمار فروش روزانه */}
|
||||||
|
<div className="bg-white rounded-lg p-6 shadow-sm">
|
||||||
|
<h3 className="text-lg font-medium mb-4">آمار فروش روزانه</h3>
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="text-2xl font-bold text-blue-600">{data.dailySales.totalOrders}</div>
|
||||||
|
<div className="text-sm text-gray-600">تعداد سفارشات</div>
|
||||||
|
</div>
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="text-2xl font-bold text-green-600">{data.dailySales.totalSales.toLocaleString()} تومان</div>
|
||||||
|
<div className="text-sm text-gray-600">مجموع فروش</div>
|
||||||
|
</div>
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="text-2xl font-bold text-purple-600">{data.dailySales.itemsSold}</div>
|
||||||
|
<div className="text-sm text-gray-600">تعداد آیتم فروش رفته</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default OrdersCountSection
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { type FC } from 'react'
|
||||||
|
import TitleLine from '../../../components/TitleLine'
|
||||||
|
import { type DashboardData } from '../types/Types'
|
||||||
|
import { Box, Shop } from 'iconsax-react'
|
||||||
|
import StatCard from './StatCard'
|
||||||
|
|
||||||
|
const ProductsCountSection: FC<{ data?: DashboardData }> = ({ data }) => {
|
||||||
|
if (!data) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6">
|
||||||
|
<TitleLine title="آمار محصولات" />
|
||||||
|
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||||
|
<StatCard
|
||||||
|
title="کل محصولات"
|
||||||
|
value={data.productCount}
|
||||||
|
icon={<Box size={24} color="#3B82F6" />}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
title="محصولات در انتظار تایید"
|
||||||
|
value={data.pendingProductCount}
|
||||||
|
icon={<Box size={24} color="#F59E0B" />}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
title="برندهای در انتظار تایید"
|
||||||
|
value={data.pendingBrandsCount}
|
||||||
|
icon={<Shop size={24} color="#8B5CF6" />}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ProductsCountSection
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { type FC } from 'react'
|
||||||
|
|
||||||
|
interface StatCardProps {
|
||||||
|
title: string
|
||||||
|
value: number
|
||||||
|
icon: React.ReactNode
|
||||||
|
}
|
||||||
|
|
||||||
|
const StatCard: FC<StatCardProps> = ({ title, value, icon }) => {
|
||||||
|
return (
|
||||||
|
<div className="bg-white rounded-lg p-6 shadow-sm hover:shadow-md transition-shadow cursor-pointer">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<p className="text-sm text-gray-600">{title}</p>
|
||||||
|
<p className="text-2xl font-bold text-gray-900">{value?.toLocaleString() || 0}</p>
|
||||||
|
</div>
|
||||||
|
<div className="p-3 bg-gray-50 rounded-full">
|
||||||
|
{icon}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StatCard
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { type FC } from 'react'
|
||||||
|
import TitleLine from '../../../components/TitleLine'
|
||||||
|
import { type DashboardData } from '../types/Types'
|
||||||
|
import { Message } from 'iconsax-react'
|
||||||
|
import StatCard from './StatCard'
|
||||||
|
|
||||||
|
const UnreadCommentsSection: FC<{ data?: DashboardData }> = ({ data }) => {
|
||||||
|
if (!data) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6">
|
||||||
|
<TitleLine title="کامنتها و پرسشها" />
|
||||||
|
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
|
<StatCard
|
||||||
|
title="کامنت های خوانده نشده"
|
||||||
|
value={data.pendingComments}
|
||||||
|
icon={<Message size={24} color="#F59E0B" />}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
title="پرسش های خوانده نشده"
|
||||||
|
value={data.pendingQuestions}
|
||||||
|
icon={<Message size={24} color="#8B5CF6" />}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UnreadCommentsSection
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { type FC } from 'react'
|
||||||
|
import TitleLine from '../../../components/TitleLine'
|
||||||
|
import { type DashboardData } from '../types/Types'
|
||||||
|
import { User, Shop } from 'iconsax-react'
|
||||||
|
import StatCard from './StatCard'
|
||||||
|
|
||||||
|
const UsersCountSection: FC<{ data?: DashboardData }> = ({ data }) => {
|
||||||
|
if (!data) return null
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-6">
|
||||||
|
<TitleLine title="آمار کاربران" />
|
||||||
|
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||||
|
<StatCard
|
||||||
|
title="کل کاربران"
|
||||||
|
value={data.usersCount}
|
||||||
|
icon={<User size={24} color="#8B5CF6" />}
|
||||||
|
/>
|
||||||
|
<StatCard
|
||||||
|
title="تعداد فروشندگان"
|
||||||
|
value={data.sellersCount}
|
||||||
|
icon={<Shop size={24} color="#10B981" />}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UsersCountSection
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
import * as api from "../service/Service";
|
||||||
|
|
||||||
|
export const useGetDashboard = () => {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["dashboard"],
|
||||||
|
queryFn: api.getDashboard,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useGetOrderChart = () => {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ["order-chart"],
|
||||||
|
queryFn: api.getOrderChart,
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import axios from "@/config/axios";
|
||||||
|
import type { DashboardResponse, OrderChartResponse } from "../types/Types";
|
||||||
|
|
||||||
|
export const getDashboard = async (): Promise<DashboardResponse> => {
|
||||||
|
const { data } = await axios.get<DashboardResponse>(`/admin/reports`);
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getOrderChart = async (): Promise<OrderChartResponse> => {
|
||||||
|
const { data } = await axios.get<OrderChartResponse>(`/admin/orders/chart`);
|
||||||
|
return data;
|
||||||
|
};
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
// تایپهای مربوط به فروش
|
||||||
|
interface SalesStats {
|
||||||
|
_id: string | null;
|
||||||
|
totalSales: number;
|
||||||
|
totalNetSales: number;
|
||||||
|
itemsSold: number;
|
||||||
|
totalOrders: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// تایپهای مربوط به فروش حمل و نقل
|
||||||
|
interface ShipmentSalesStats {
|
||||||
|
_id: string | null;
|
||||||
|
totalShipmentCost: number;
|
||||||
|
itemsSold: number;
|
||||||
|
totalOrders: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// تایپ فروشگاه
|
||||||
|
interface Shop {
|
||||||
|
_id: string;
|
||||||
|
shopName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// تایپ جزئیات محصول
|
||||||
|
interface ProductDetails {
|
||||||
|
_id: number;
|
||||||
|
title_fa: string;
|
||||||
|
title_en: string;
|
||||||
|
model: string;
|
||||||
|
description: string;
|
||||||
|
shop: Shop;
|
||||||
|
}
|
||||||
|
|
||||||
|
// تایپ محصولات برتر
|
||||||
|
interface TopProduct {
|
||||||
|
totalSold: number;
|
||||||
|
productDetails: ProductDetails;
|
||||||
|
productId: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// تایپ فروش ۵ روز گذشته (ساختار دقیق مشخص نیست، فعلاً unknown استفاده میکنیم)
|
||||||
|
type FiveDaysAgoSales = unknown[];
|
||||||
|
|
||||||
|
// تایپ اصلی داشبورد
|
||||||
|
export interface DashboardData {
|
||||||
|
dailySales: SalesStats;
|
||||||
|
weeklySales: SalesStats;
|
||||||
|
monthlySales: SalesStats | null;
|
||||||
|
yearlySales: SalesStats;
|
||||||
|
dailyShipmentSales: ShipmentSalesStats;
|
||||||
|
weeklyShipmentSales: ShipmentSalesStats;
|
||||||
|
monthlyShipmentSales: ShipmentSalesStats;
|
||||||
|
yearlyShipmentSales: ShipmentSalesStats;
|
||||||
|
withdrawalRequests: number;
|
||||||
|
FiveDaysAgoSales: FiveDaysAgoSales;
|
||||||
|
topProducts: TopProduct[];
|
||||||
|
proccessingOrders: number;
|
||||||
|
pendingComments: number;
|
||||||
|
pendingQuestions: number;
|
||||||
|
sellersCount: number;
|
||||||
|
usersCount: number;
|
||||||
|
wholesaleRequestCount: number;
|
||||||
|
pendingBrandsCount: number;
|
||||||
|
pendingWarranties: number;
|
||||||
|
productCount: number;
|
||||||
|
pendingProductCount: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// تایپ دادههای نمودار سفارش
|
||||||
|
export interface OrderChartData {
|
||||||
|
chartType: string;
|
||||||
|
title: string;
|
||||||
|
unit: string;
|
||||||
|
granularity: string;
|
||||||
|
xAxis: string[];
|
||||||
|
yAxis: number[];
|
||||||
|
totalSales: number;
|
||||||
|
_debug: {
|
||||||
|
aggregatedPeriods: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// تایپ پاسخ API نمودار سفارش
|
||||||
|
export interface OrderChartResponse {
|
||||||
|
status: number;
|
||||||
|
success: boolean;
|
||||||
|
results: OrderChartData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// تایپ پاسخ API
|
||||||
|
export interface DashboardResponse {
|
||||||
|
status: number;
|
||||||
|
success: boolean;
|
||||||
|
results: DashboardData;
|
||||||
|
}
|
||||||
@@ -61,6 +61,7 @@ import SiteSetting from '@/pages/setting/SiteSetting'
|
|||||||
import JobsList from '@/pages/jobs/List'
|
import JobsList from '@/pages/jobs/List'
|
||||||
import Resumes from '@/pages/jobs/Resume'
|
import Resumes from '@/pages/jobs/Resume'
|
||||||
import ContactUsList from '@/pages/contactUs/List'
|
import ContactUsList from '@/pages/contactUs/List'
|
||||||
|
import Dashboard from '@/pages/dashboard/Dashboard'
|
||||||
|
|
||||||
const MainRouter: FC = () => {
|
const MainRouter: FC = () => {
|
||||||
|
|
||||||
@@ -149,6 +150,13 @@ const MainRouter: FC = () => {
|
|||||||
<Route path={Pages.jobs.resumes} element={<Resumes />} />
|
<Route path={Pages.jobs.resumes} element={<Resumes />} />
|
||||||
|
|
||||||
<Route path={Pages.contactUs.list} element={<ContactUsList />} />
|
<Route path={Pages.contactUs.list} element={<ContactUsList />} />
|
||||||
|
|
||||||
|
<Route path={Pages.dashboard} element={<Dashboard />} />
|
||||||
|
<Route path="/dashboard/products-count" element={<Dashboard />} />
|
||||||
|
<Route path="/dashboard/orders-count" element={<Dashboard />} />
|
||||||
|
<Route path="/dashboard/unread-comments" element={<Dashboard />} />
|
||||||
|
<Route path="/dashboard/users-count" element={<Dashboard />} />
|
||||||
|
<Route path="/dashboard/orders-chart" element={<Dashboard />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user