changed dashboard
This commit is contained in:
104
.kombai/canvas/dashboard_light.canvas
Normal file
104
.kombai/canvas/dashboard_light.canvas
Normal file
File diff suppressed because one or more lines are too long
@@ -49,7 +49,6 @@ A full-featured internal banking administration panel built with **React 19 + Vi
|
||||
| Notifications | Sonner | ^2.0 |
|
||||
| i18n | i18next + react-i18next | ^26 / ^17 |
|
||||
| Charts | Recharts | ^3.8 |
|
||||
| Rich Text | Tiptap | ^3.23 |
|
||||
| Icons | Lucide React | ^1.14 |
|
||||
| Fonts | Geist + Inter (variable) | ^5.2 |
|
||||
|
||||
@@ -445,7 +444,7 @@ Toolbar placed above `DataTable`. Provides: search input, dynamic filter dropdow
|
||||
|
||||
### `FormInput` (`src/components/formInput.tsx`)
|
||||
|
||||
Comprehensive single-step form builder. Renders `text`, `select`, `date`, `textarea`, `rich-text` (Tiptap), and `file-upload` fields from a config array. Always paired with RHF + Zod.
|
||||
Comprehensive single-step form builder. Renders `text`, `select`, `date`, `textarea`, and `file-upload` fields from a config array. Always paired with RHF + Zod.
|
||||
|
||||
### `StepBarV2` (`src/components/stepBarV2.tsx`)
|
||||
|
||||
|
||||
610
package-lock.json
generated
610
package-lock.json
generated
@@ -14,9 +14,6 @@
|
||||
"@tailwindcss/container-queries": "^0.1.1",
|
||||
"@tanstack/react-query": "^5.100.8",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"@tiptap/extension-link": "^3.23.2",
|
||||
"@tiptap/react": "^3.23.2",
|
||||
"@tiptap/starter-kit": "^3.23.2",
|
||||
"axios": "^1.15.2",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
@@ -38,7 +35,6 @@
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^3.5.0",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"vaul": "^1.1.2",
|
||||
"zod": "^4.4.3",
|
||||
"zustand": "^5.0.12"
|
||||
},
|
||||
@@ -3516,434 +3512,6 @@
|
||||
"url": "https://github.com/sponsors/tannerlinsley"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/core": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/core/-/core-3.23.2.tgz",
|
||||
"integrity": "sha512-yjv2N7gaQMbIVfsSZHBMscLoybgetcTraXsSMrELAerl/jfRipg5S1dBXMFvgRy8Kh48+TGoH+5nqshxdOEGoQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/pm": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-blockquote": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-blockquote/-/extension-blockquote-3.23.2.tgz",
|
||||
"integrity": "sha512-BBN22/nUErRzUr1HI/Q4iPFBNavWoNC5Fx0KXp9oDOCCrCvj55rtGwLn2dB3r4vLfhjYvhEZ38wN+r7Y9RhORA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-bold": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-bold/-/extension-bold-3.23.2.tgz",
|
||||
"integrity": "sha512-onPFP260enNkjMGhR7sDSqaF80A4sgvMZ/VZLxp7zGa6DAfcuN4PyUQhZN61KmYgbUdr+qrAAMx+tPuid22F4g==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-bubble-menu": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-bubble-menu/-/extension-bubble-menu-3.23.2.tgz",
|
||||
"integrity": "sha512-S0LZg6EMdkr5CiYAGmOwzuNPd2T18ZR5pWrgHHHZjt0IFqU01tBJa3zLzC1Vd7noPCec64ygW9S8+p8CHBgOIA==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@floating-ui/dom": "^1.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2",
|
||||
"@tiptap/pm": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-bullet-list": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-bullet-list/-/extension-bullet-list-3.23.2.tgz",
|
||||
"integrity": "sha512-jhvu1qa8F53r//6DrLdA2OkTbRgY73NkQL51Ruozzi+JrfVIo3IfaTNRq01BXO5qcvNH7P/aDBF5cByvuiUMzQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/extension-list": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-code": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-code/-/extension-code-3.23.2.tgz",
|
||||
"integrity": "sha512-5yHYavvBEkxgWL6DCPYNHujxBXF7c812MFNoU62ljNJjIYDc2Mu8ftOie/ajNJbMLqwSVzCuGfG9swEuEKxY5g==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-code-block": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-code-block/-/extension-code-block-3.23.2.tgz",
|
||||
"integrity": "sha512-oWwjsLi+m7zHTqM0kYnnogjS3vFENCaLk3ue/1XE9ccpZlmmPzmK70hodB/UPylFJmgr3g726rhxViYv9LRS7A==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2",
|
||||
"@tiptap/pm": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-document": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-document/-/extension-document-3.23.2.tgz",
|
||||
"integrity": "sha512-Ff/MAaWPzFtb7nhPG6ETdu7/OqkD6cAmJfViBAiRqh9PPULH98fGDaMBm3TGa1s3XB7hGO7c/xVKxEdjYij5rg==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-dropcursor": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-dropcursor/-/extension-dropcursor-3.23.2.tgz",
|
||||
"integrity": "sha512-T7pVfIF5uDj043CDJlurNoMAmXPy36EjBz/YQVYrVMSSUbvUlOaL3xxoDODRmir29jVrmCROjaKwVExqooQTqQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/extensions": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-floating-menu": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-floating-menu/-/extension-floating-menu-3.23.2.tgz",
|
||||
"integrity": "sha512-1rfxx5X52h44jSS9R1fUx8sOaRpNq8CM0IR3EdjpthVvaRZ9XD1tKX4h5EcwGFqNiwtWXxNne2mV7ZJuH2UYsQ==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@floating-ui/dom": "^1.0.0",
|
||||
"@tiptap/core": "3.23.2",
|
||||
"@tiptap/pm": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-gapcursor": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-gapcursor/-/extension-gapcursor-3.23.2.tgz",
|
||||
"integrity": "sha512-I3LKYVwyxRaiVaJxss98QWOXzZZrHmsJD3RgAZ0Uoguu3pL29Krn2tXfwp4FAd9NG79wdQHj20c+XuqJLNkAbw==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/extensions": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-hard-break": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-hard-break/-/extension-hard-break-3.23.2.tgz",
|
||||
"integrity": "sha512-3p00oC2caRAVtkOweJ9IjTgjhzm34R9tNyMCykzMRygC8CdO08Jv2JKvUaOeMVVmWZI+O9wkGUpaA2Drg6pY4g==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-heading": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-heading/-/extension-heading-3.23.2.tgz",
|
||||
"integrity": "sha512-ldQh38ZWTIedSY6XsOkn1ULtk+mD/mezLogrvcVv8neez0qM/S25vyMZKqP7i2/x4i4ds1JYIJLw9y3HX/B69Q==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-horizontal-rule": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-horizontal-rule/-/extension-horizontal-rule-3.23.2.tgz",
|
||||
"integrity": "sha512-LbLACqe/OiTdYIq3zbsY7Ue7WOP+mYTGufNDfs8rSGcUbWI2GwUwoGRrTPBbLIesnuCdH6FyMB60Tg/HzjKaYw==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2",
|
||||
"@tiptap/pm": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-italic": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-italic/-/extension-italic-3.23.2.tgz",
|
||||
"integrity": "sha512-pauWOkom8riyZoIGn8I8uFE//uRgE6kL46Pd6PdSd5Wt6w/ao/le9Ju2Ln947NGjz/6whaDiFnBrkSbZEAhpmw==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-link": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-link/-/extension-link-3.23.2.tgz",
|
||||
"integrity": "sha512-h0D3Lwom0hGDsbpZ6tW0+DRKgBP0qSl4rO/iBfGk3Krb2CoyEn1yII3pSTd1PwAld7bHt/buURi6DWudQsIhgg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"linkifyjs": "^4.3.2"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2",
|
||||
"@tiptap/pm": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-list": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-list/-/extension-list-3.23.2.tgz",
|
||||
"integrity": "sha512-tRbbjpOPrY4ApIHtn3ctnKIhkkioewMsZa5gJzqVB47LJFNyzLXLo/aID4sJRKTIMi1wd1fA9TiBKPe6KqczPA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2",
|
||||
"@tiptap/pm": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-list-item": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-list-item/-/extension-list-item-3.23.2.tgz",
|
||||
"integrity": "sha512-I9Yed0mmBE6AAhc4Cc5UhZLZUMCft9XdPkdBM/wjcjpLwdMhdzelVQXEhNDyPfRkA1TTGs5VHlc6twjCPCTgLg==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/extension-list": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-list-keymap": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-list-keymap/-/extension-list-keymap-3.23.2.tgz",
|
||||
"integrity": "sha512-aE4PzCy+OWXXFc8UsrrYjcfEbyXCh8f7LuGgFPl8jf0JjgIK0FHmzWDg3912zWb5Ww66AF2j0KJzTB9NFOMWlw==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/extension-list": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-ordered-list": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-ordered-list/-/extension-ordered-list-3.23.2.tgz",
|
||||
"integrity": "sha512-ZhMejT4jXfOEECqI60AVBzULl8AVN8BXk/9vjVnJHxBtcQxW+tIu5GHVZ4DPaCfTX7mH+hsceFMhQ2BvV7qvbg==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/extension-list": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-paragraph": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-paragraph/-/extension-paragraph-3.23.2.tgz",
|
||||
"integrity": "sha512-UzHx5zOi9fjhC9TAqHeD7BV5eJIA3t65pa2Mq8b54V9nrIg1yAlgiafU0WDWoom11TF+IWxz5JBsjlW0/P/VeQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-strike": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-strike/-/extension-strike-3.23.2.tgz",
|
||||
"integrity": "sha512-m1BN3EXwYagzVdReGoI7McvuZFyolFwuXLgzU6c+RN7E+u+K68EY+2U3pJI5ee8UgPYGW4eBs/3BT/5k+0so3Q==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-text": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-text/-/extension-text-3.23.2.tgz",
|
||||
"integrity": "sha512-Ny4FC+BivfwACTuJO3QPe+BXtVFfzWQVBcfhlFlA7xTaeBktFeBavH2cEyXR8Qbez3Wio/Hn+bibT4d44EBLyg==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extension-underline": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extension-underline/-/extension-underline-3.23.2.tgz",
|
||||
"integrity": "sha512-HdPX1nZarOF8UkDccu6gBy6brZd4vDFCa5Mz1liw3B3D6UBiC+8vzE1YGHtggO+KEBBQYf4GgjT3qqIgOcsTEQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/extensions": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/extensions/-/extensions-3.23.2.tgz",
|
||||
"integrity": "sha512-kRHQ3nSbAfkFdxj9FtDdr4hpREndGgWFA6ZEAwlLeGUxf8QYTpuF9zb2yxdBPBlTc5+JsbPcskNt+u1PazGKYw==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2",
|
||||
"@tiptap/pm": "3.23.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/pm": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/pm/-/pm-3.23.2.tgz",
|
||||
"integrity": "sha512-1kvsBqGNu2ZJ0P/lkxN0pAMqSyUcpkMIzE4xwGUIyAiD0pZV6dr+OCMwGWOTLllSyrn91xI5K7OLk3pYeCPKqA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-changeset": "^2.3.0",
|
||||
"prosemirror-commands": "^1.6.2",
|
||||
"prosemirror-dropcursor": "^1.8.1",
|
||||
"prosemirror-gapcursor": "^1.3.2",
|
||||
"prosemirror-history": "^1.4.1",
|
||||
"prosemirror-keymap": "^1.2.2",
|
||||
"prosemirror-model": "^1.24.1",
|
||||
"prosemirror-schema-list": "^1.5.0",
|
||||
"prosemirror-state": "^1.4.3",
|
||||
"prosemirror-tables": "^1.6.4",
|
||||
"prosemirror-transform": "^1.10.2",
|
||||
"prosemirror-view": "^1.38.1"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/react": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/react/-/react-3.23.2.tgz",
|
||||
"integrity": "sha512-qfl70xRDQbwov8y5QvK+EiYk6JyoyzUimNtOmLSfeun2NjQwv67hW1iQ+c3geDbcwfUY5+h3XYMy1Lm+Bt46NQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/use-sync-external-store": "^0.0.6",
|
||||
"fast-equals": "^5.3.3",
|
||||
"use-sync-external-store": "^1.4.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@tiptap/extension-bubble-menu": "^3.23.2",
|
||||
"@tiptap/extension-floating-menu": "^3.23.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "3.23.2",
|
||||
"@tiptap/pm": "3.23.2",
|
||||
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
||||
"@types/react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
||||
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
||||
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tiptap/starter-kit": {
|
||||
"version": "3.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-3.23.2.tgz",
|
||||
"integrity": "sha512-t0o//bLmlUW/3j9ke1wIrrKkvfVYcBiC/cowCUNwN/YQx9Bc3S++yInkR6hat4qI4+O49+NRknVeaF/Sp247QA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tiptap/core": "^3.23.2",
|
||||
"@tiptap/extension-blockquote": "^3.23.2",
|
||||
"@tiptap/extension-bold": "^3.23.2",
|
||||
"@tiptap/extension-bullet-list": "^3.23.2",
|
||||
"@tiptap/extension-code": "^3.23.2",
|
||||
"@tiptap/extension-code-block": "^3.23.2",
|
||||
"@tiptap/extension-document": "^3.23.2",
|
||||
"@tiptap/extension-dropcursor": "^3.23.2",
|
||||
"@tiptap/extension-gapcursor": "^3.23.2",
|
||||
"@tiptap/extension-hard-break": "^3.23.2",
|
||||
"@tiptap/extension-heading": "^3.23.2",
|
||||
"@tiptap/extension-horizontal-rule": "^3.23.2",
|
||||
"@tiptap/extension-italic": "^3.23.2",
|
||||
"@tiptap/extension-link": "^3.23.2",
|
||||
"@tiptap/extension-list": "^3.23.2",
|
||||
"@tiptap/extension-list-item": "^3.23.2",
|
||||
"@tiptap/extension-list-keymap": "^3.23.2",
|
||||
"@tiptap/extension-ordered-list": "^3.23.2",
|
||||
"@tiptap/extension-paragraph": "^3.23.2",
|
||||
"@tiptap/extension-strike": "^3.23.2",
|
||||
"@tiptap/extension-text": "^3.23.2",
|
||||
"@tiptap/extension-underline": "^3.23.2",
|
||||
"@tiptap/extensions": "^3.23.2",
|
||||
"@tiptap/pm": "^3.23.2"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ueberdosis"
|
||||
}
|
||||
},
|
||||
"node_modules/@ts-morph/common": {
|
||||
"version": "0.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.27.0.tgz",
|
||||
@@ -4063,6 +3631,7 @@
|
||||
"version": "19.2.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz",
|
||||
"integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"csstype": "^3.2.2"
|
||||
@@ -4072,6 +3641,7 @@
|
||||
"version": "19.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz",
|
||||
"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.2.0"
|
||||
@@ -5152,6 +4722,7 @@
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
||||
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
|
||||
"devOptional": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/d3-array": {
|
||||
@@ -5974,15 +5545,6 @@
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fast-equals": {
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.4.0.tgz",
|
||||
"integrity": "sha512-jt2DW/aNFNwke7AUd+Z+e6pz39KO5rzdbbFCg2sGafS4mk13MI7Z8O5z9cADNn5lhGODIgLwug6TZO2ctf7kcw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-glob": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
|
||||
@@ -7380,12 +6942,6 @@
|
||||
"integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/linkifyjs": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/linkifyjs/-/linkifyjs-4.3.2.tgz",
|
||||
"integrity": "sha512-NT1CJtq3hHIreOianA8aSXn6Cw0JzYOuDQbOrSPe7gqFnCpKP++MQe3ODgO3oh2GJFORkAAdqredOa60z63GbA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lint-staged": {
|
||||
"version": "16.4.0",
|
||||
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-16.4.0.tgz",
|
||||
@@ -8070,12 +7626,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/orderedmap": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/orderedmap/-/orderedmap-2.1.1.tgz",
|
||||
"integrity": "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/outvariant": {
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/outvariant/-/outvariant-1.4.3.tgz",
|
||||
@@ -8346,135 +7896,6 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-changeset": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-changeset/-/prosemirror-changeset-2.4.1.tgz",
|
||||
"integrity": "sha512-96WBLhOaYhJ+kPhLg3uW359Tz6I/MfcrQfL4EGv4SrcqKEMC1gmoGrXHecPE8eOwTVCJ4IwgfzM8fFad25wNfw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-transform": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-commands": {
|
||||
"version": "1.7.1",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-commands/-/prosemirror-commands-1.7.1.tgz",
|
||||
"integrity": "sha512-rT7qZnQtx5c0/y/KlYaGvtG411S97UaL6gdp6RIZ23DLHanMYLyfGBV5DtSnZdthQql7W+lEVbpSfwtO8T+L2w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-model": "^1.0.0",
|
||||
"prosemirror-state": "^1.0.0",
|
||||
"prosemirror-transform": "^1.10.2"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-dropcursor": {
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-dropcursor/-/prosemirror-dropcursor-1.8.2.tgz",
|
||||
"integrity": "sha512-CCk6Gyx9+Tt2sbYk5NK0nB1ukHi2ryaRgadV/LvyNuO3ena1payM2z6Cg0vO1ebK8cxbzo41ku2DE5Axj1Zuiw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-state": "^1.0.0",
|
||||
"prosemirror-transform": "^1.1.0",
|
||||
"prosemirror-view": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-gapcursor": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-gapcursor/-/prosemirror-gapcursor-1.4.1.tgz",
|
||||
"integrity": "sha512-pMdYaEnjNMSwl11yjEGtgTmLkR08m/Vl+Jj443167p9eB3HVQKhYCc4gmHVDsLPODfZfjr/MmirsdyZziXbQKw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-keymap": "^1.0.0",
|
||||
"prosemirror-model": "^1.0.0",
|
||||
"prosemirror-state": "^1.0.0",
|
||||
"prosemirror-view": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-history": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.5.0.tgz",
|
||||
"integrity": "sha512-zlzTiH01eKA55UAf1MEjtssJeHnGxO0j4K4Dpx+gnmX9n+SHNlDqI2oO1Kv1iPN5B1dm5fsljCfqKF9nFL6HRg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-state": "^1.2.2",
|
||||
"prosemirror-transform": "^1.0.0",
|
||||
"prosemirror-view": "^1.31.0",
|
||||
"rope-sequence": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-keymap": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-keymap/-/prosemirror-keymap-1.2.3.tgz",
|
||||
"integrity": "sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-state": "^1.0.0",
|
||||
"w3c-keyname": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-model": {
|
||||
"version": "1.25.4",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-model/-/prosemirror-model-1.25.4.tgz",
|
||||
"integrity": "sha512-PIM7E43PBxKce8OQeezAs9j4TP+5yDpZVbuurd1h5phUxEKIu+G2a+EUZzIC5nS1mJktDJWzbqS23n1tsAf5QA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"orderedmap": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-schema-list": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-schema-list/-/prosemirror-schema-list-1.5.1.tgz",
|
||||
"integrity": "sha512-927lFx/uwyQaGwJxLWCZRkjXG0p48KpMj6ueoYiu4JX05GGuGcgzAy62dfiV8eFZftgyBUvLx76RsMe20fJl+Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-model": "^1.0.0",
|
||||
"prosemirror-state": "^1.0.0",
|
||||
"prosemirror-transform": "^1.7.3"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-state": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-state/-/prosemirror-state-1.4.4.tgz",
|
||||
"integrity": "sha512-6jiYHH2CIGbCfnxdHbXZ12gySFY/fz/ulZE333G6bPqIZ4F+TXo9ifiR86nAHpWnfoNjOb3o5ESi7J8Uz1jXHw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-model": "^1.0.0",
|
||||
"prosemirror-transform": "^1.0.0",
|
||||
"prosemirror-view": "^1.27.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-tables": {
|
||||
"version": "1.8.5",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-tables/-/prosemirror-tables-1.8.5.tgz",
|
||||
"integrity": "sha512-V/0cDCsHKHe/tfWkeCmthNUcEp1IVO3p6vwN8XtwE9PZQLAZJigbw3QoraAdfJPir4NKJtNvOB8oYGKRl+t0Dw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-keymap": "^1.2.3",
|
||||
"prosemirror-model": "^1.25.4",
|
||||
"prosemirror-state": "^1.4.4",
|
||||
"prosemirror-transform": "^1.10.5",
|
||||
"prosemirror-view": "^1.41.4"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-transform": {
|
||||
"version": "1.12.0",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-transform/-/prosemirror-transform-1.12.0.tgz",
|
||||
"integrity": "sha512-GxboyN4AMIsoHNtz5uf2r2Ru551i5hWeCMD6E2Ib4Eogqoub0NflniaBPVQ4MrGE5yZ8JV9tUHg9qcZTTrcN4w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-model": "^1.21.0"
|
||||
}
|
||||
},
|
||||
"node_modules/prosemirror-view": {
|
||||
"version": "1.41.8",
|
||||
"resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.41.8.tgz",
|
||||
"integrity": "sha512-TnKDdohEatgyZNGCDWIdccOHXhYloJwbwU+phw/a23KBvJIR9lWQWW7WHHK3vBdOLDNuF7TaX98GObUZOWkOnA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"prosemirror-model": "^1.20.0",
|
||||
"prosemirror-state": "^1.0.0",
|
||||
"prosemirror-transform": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-addr": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||
@@ -9062,12 +8483,6 @@
|
||||
"node_modules/root": {
|
||||
"resolved": "git+ssh://git@github.com/tanstack/react-query.git#9800c8f1a3f7907956410c23426a26d981e7d694"
|
||||
},
|
||||
"node_modules/rope-sequence": {
|
||||
"version": "1.3.4",
|
||||
"resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.4.tgz",
|
||||
"integrity": "sha512-UT5EDe2cu2E/6O4igUr5PSFs23nvvukicWHx6GnOPlHAiiYbzNuCRQCuiUdHJQcqKalLKlrYJnjY0ySGsXNQXQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/router": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
|
||||
@@ -9972,19 +9387,6 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/vaul": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vaul/-/vaul-1.1.2.tgz",
|
||||
"integrity": "sha512-ZFkClGpWyI2WUQjdLJ/BaGuV6AVQiJ3uELGk3OYtP+B6yCO7Cmn9vPFXVJkRaGkOJu3m8bQMgtyzNHixULceQA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@radix-ui/react-dialog": "^1.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc"
|
||||
}
|
||||
},
|
||||
"node_modules/victory-vendor": {
|
||||
"version": "37.3.6",
|
||||
"resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz",
|
||||
@@ -10094,12 +9496,6 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/w3c-keyname": {
|
||||
"version": "2.2.8",
|
||||
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz",
|
||||
"integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/web-streams-polyfill": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
||||
|
||||
@@ -18,9 +18,6 @@
|
||||
"@tailwindcss/container-queries": "^0.1.1",
|
||||
"@tanstack/react-query": "^5.100.8",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"@tiptap/extension-link": "^3.23.2",
|
||||
"@tiptap/react": "^3.23.2",
|
||||
"@tiptap/starter-kit": "^3.23.2",
|
||||
"axios": "^1.15.2",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
@@ -42,7 +39,6 @@
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^3.5.0",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"vaul": "^1.1.2",
|
||||
"zod": "^4.4.3",
|
||||
"zustand": "^5.0.12"
|
||||
},
|
||||
|
||||
@@ -236,7 +236,6 @@ function PhoneInput({
|
||||
className,
|
||||
phonePrefix = "+993",
|
||||
}: FormInputProps) {
|
||||
// Gelen veride ülke kodu (+993) veya boşluklar olsa bile temiz 8 haneyi elde et
|
||||
const cleanedDigits = cleanPhoneNumber(value);
|
||||
|
||||
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
@@ -470,8 +469,6 @@ export function DigitsInput({
|
||||
function DateInput({ value = "", onChange, error, disabled, required, label, className, placeholder = "Sene saýlaň" }: FormInputProps) {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
// value backend'den 'yyyy-MM-dd' veya 'yyyy-MM-ddTHH:mm:ssZ' gelebilir
|
||||
// Sadece ilk 10 karakteri (yyyy-MM-dd) alarak parse et
|
||||
const rawDate = value ? value.trim().slice(0, 10) : "";
|
||||
const parsed = rawDate ? parse(rawDate, "yyyy-MM-dd", new Date()) : undefined;
|
||||
const selected = parsed && isValid(parsed) ? parsed : undefined;
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { AlertCircle, RefreshCw } from "lucide-react";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { AlertCircle, Info, RefreshCw } from "lucide-react";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { ElementType, ReactNode } from "react";
|
||||
import { formatNumber } from "./analyticsFormat";
|
||||
|
||||
// ─── Section card with its own loading / error state ─────────────────────────
|
||||
// ─── Register panel ───────────────────────────────────────────────────────────
|
||||
// One bordered surface whose regions are divided by hairlines instead of being
|
||||
// separate floating cards. This is the base container for every dashboard block.
|
||||
|
||||
interface RegisterPanelProps {
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function RegisterPanel({ children, className }: RegisterPanelProps) {
|
||||
return <div className={cn("overflow-hidden rounded-panel border border-border bg-card", className)}>{children}</div>;
|
||||
}
|
||||
|
||||
// ─── One cell of a register (title + optional description + content) ─────────
|
||||
|
||||
interface SectionCardProps {
|
||||
title: string;
|
||||
@@ -15,6 +27,7 @@ interface SectionCardProps {
|
||||
isLoading?: boolean;
|
||||
isError?: boolean;
|
||||
onRetry?: () => void;
|
||||
/** Border classes that draw the cell dividers inside the parent register. */
|
||||
className?: string;
|
||||
contentClassName?: string;
|
||||
action?: ReactNode;
|
||||
@@ -36,26 +49,26 @@ export function SectionCard({
|
||||
}: SectionCardProps) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Card className={className}>
|
||||
<CardHeader className="flex flex-row items-start justify-between gap-2 space-y-0">
|
||||
<div className="space-y-1">
|
||||
<CardTitle>{title}</CardTitle>
|
||||
{description && <CardDescription>{description}</CardDescription>}
|
||||
<div className={cn("px-5 py-4 lg:px-6 lg:py-5", className)}>
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="min-w-0">
|
||||
<p className="text-[14px] font-semibold tracking-tight">{title}</p>
|
||||
{description && <p className="mt-1 text-[12.5px] text-muted-foreground">{description}</p>}
|
||||
</div>
|
||||
{action}
|
||||
</CardHeader>
|
||||
<CardContent className={contentClassName}>
|
||||
</div>
|
||||
<div className={cn("mt-5", contentClassName)}>
|
||||
{isLoading ? (
|
||||
<Skeleton className="w-full rounded-lg" style={{ height: skeletonHeight }} />
|
||||
<Skeleton className="w-full rounded-md" style={{ height: skeletonHeight }} />
|
||||
) : isError ? (
|
||||
<div className="flex flex-col items-center justify-center gap-3 py-8 text-center" style={{ minHeight: skeletonHeight }}>
|
||||
<div className="flex h-10 w-10 items-center justify-center rounded-full bg-destructive/10 text-destructive">
|
||||
<AlertCircle className="h-5 w-5" />
|
||||
<div className="flex size-10 items-center justify-center rounded-full bg-destructive/10 text-destructive">
|
||||
<AlertCircle className="size-5" aria-hidden="true" />
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">{t("dashboard.errorTitle", "Maglumatlary ýükläp bolmady")}</p>
|
||||
{onRetry && (
|
||||
<Button variant="outline" size="sm" className="gap-2" onClick={onRetry}>
|
||||
<RefreshCw className="h-3.5 w-3.5" />
|
||||
<RefreshCw className="size-3.5" aria-hidden="true" />
|
||||
{t("common.retry", "Täzeden synanyş")}
|
||||
</Button>
|
||||
)}
|
||||
@@ -63,73 +76,23 @@ export function SectionCard({
|
||||
) : (
|
||||
children
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function EmptyState({ height = 160 }: { height?: number }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex items-center justify-center text-xs text-muted-foreground" style={{ height }}>
|
||||
<div className="flex items-center justify-center text-[13px] text-muted-foreground" style={{ height }}>
|
||||
{t("dashboard.noData", "Maglumat ýok")}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// ─── KPI tile ─────────────────────────────────────────────────────────────────
|
||||
|
||||
interface KpiTileProps {
|
||||
label: string;
|
||||
value: string;
|
||||
hint?: string;
|
||||
icon: ElementType;
|
||||
accent: string;
|
||||
tone?: "default" | "good" | "warn" | "bad";
|
||||
isLoading?: boolean;
|
||||
}
|
||||
|
||||
export function KpiTile({ label, value, hint, icon: Icon, accent, tone = "default", isLoading }: KpiTileProps) {
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between gap-2 space-y-0 pb-2">
|
||||
<CardTitle className="min-w-0 text-sm font-medium text-muted-foreground">{label}</CardTitle>
|
||||
<div className={cn("flex h-9 w-9 shrink-0 items-center justify-center rounded-lg", accent)}>
|
||||
<Icon size={16} />
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="@container/kpi">
|
||||
{isLoading ? (
|
||||
<>
|
||||
<Skeleton className="h-8 w-28" />
|
||||
<Skeleton className="mt-2 h-3 w-36" />
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p
|
||||
className={cn(
|
||||
"text-xl font-semibold tracking-tight tabular-nums @[14rem]/kpi:text-2xl @[18rem]/kpi:text-3xl",
|
||||
tone === "good" && "text-emerald-600 dark:text-emerald-400",
|
||||
tone === "warn" && "text-amber-600 dark:text-amber-400",
|
||||
tone === "bad" && "text-destructive",
|
||||
)}
|
||||
>
|
||||
{value}
|
||||
</p>
|
||||
{hint && (
|
||||
<p className="mt-1 flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<span className="inline-block h-1.5 w-1.5 rounded-full bg-muted-foreground/40" />
|
||||
{hint}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Horizontal bar list (label · bar · value) ───────────────────────────────
|
||||
// ─── Horizontal bar list (label · measured rule · value) ────────────────────
|
||||
// The unfilled remainder is a 1px rule in the track tone and the value is a 3px
|
||||
// bar sitting on it, so the chart reads like a measuring line, not a pill.
|
||||
|
||||
export interface BarListRow {
|
||||
key: string;
|
||||
@@ -156,33 +119,35 @@ export function BarList({ rows, color = "var(--chart-1)", hideEmpty }: BarListPr
|
||||
const hidden = rows.length - visible.length;
|
||||
const max = Math.max(1, ...rows.map((r) => r.value));
|
||||
if (visible.length === 0) return <EmptyState height={120} />;
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<div className="space-y-4">
|
||||
{visible.map((row) => (
|
||||
<div key={row.key} className="space-y-1">
|
||||
<div className="flex items-baseline justify-between gap-3 text-sm">
|
||||
<div key={row.key}>
|
||||
<div className="flex items-baseline justify-between gap-3 text-[13.5px]">
|
||||
<span className="min-w-0 truncate text-foreground" title={row.label}>
|
||||
{row.label}
|
||||
</span>
|
||||
<span className="shrink-0 tabular-nums">{row.valueText ?? formatNumber(row.value)}</span>
|
||||
</div>
|
||||
<div className="h-2 w-full overflow-hidden rounded-full bg-muted">
|
||||
<div className="relative mt-2.5 h-[2px] bg-track">
|
||||
<div
|
||||
className="h-full rounded-full transition-[width] duration-500"
|
||||
className="absolute -top-[1.5px] left-0 h-[5px] rounded-[2px] transition-[width] duration-500"
|
||||
style={{ width: `${row.share ?? (row.value / max) * 100}%`, background: color }}
|
||||
/>
|
||||
</div>
|
||||
{row.sub && <div className="text-xs text-muted-foreground">{row.sub}</div>}
|
||||
{row.sub && <div className="mt-2 text-[11.5px] text-muted-foreground">{row.sub}</div>}
|
||||
</div>
|
||||
))}
|
||||
{hidden > 0 && (
|
||||
<p
|
||||
className="border-t pt-2 text-xs text-muted-foreground"
|
||||
className="flex items-center gap-2 border-t border-border pt-3 text-[11.5px] text-muted-foreground"
|
||||
title={rows
|
||||
.filter((r) => r.value === 0)
|
||||
.map((r) => r.label)
|
||||
.join(", ")}
|
||||
>
|
||||
<Info className="size-3.5 shrink-0" aria-hidden="true" />
|
||||
{t("analytics.emptyRows", "+{{count}} görnüşde sargyt ýok", { count: hidden })}
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -3,13 +3,12 @@ import { useTranslation } from "react-i18next";
|
||||
import type { TFunction } from "i18next";
|
||||
import { Info } from "lucide-react";
|
||||
import { Cell, Pie, PieChart } from "recharts";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { getEducationLabel, getMarriageLabel } from "@/constants/formOptions";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { ChartContainer, ChartTooltip, ChartTooltipContent } from "@/components/ui/chart";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { ApprovalCount, CountItem, CustomersData, ProductsData } from "../api/analyticsApi";
|
||||
import { BarList, EmptyState, SectionCard, type BarListRow } from "./analyticsShared";
|
||||
import { BarList, EmptyState, RegisterPanel, SectionCard, type BarListRow } from "./analyticsShared";
|
||||
import { formatNumber, formatPercent, useLocalizedName } from "./analyticsFormat";
|
||||
|
||||
interface QueryProps<T> {
|
||||
@@ -19,16 +18,31 @@ interface QueryProps<T> {
|
||||
onRetry: () => void;
|
||||
}
|
||||
|
||||
// One meaning per color across the dashboard: blue = loans, green = cards / good, amber = waiting, red = rejected.
|
||||
// One meaning per colour across the dashboard: teal = loans / approved,
|
||||
// mid teal = cards, light teal = secondary share, sand = waiting, clay = rejected.
|
||||
const LOAN_COLOR = "var(--chart-1)";
|
||||
const CARD_COLOR = "var(--chart-2)";
|
||||
const GOOD_COLOR = "var(--chart-2)";
|
||||
const SHARE_COLOR = "var(--chart-3)";
|
||||
const GOOD_COLOR = "var(--chart-1)";
|
||||
const WAIT_COLOR = "var(--chart-4)";
|
||||
const BAD_COLOR = "var(--chart-5)";
|
||||
|
||||
/** Below this many decided orders an approval rate is shown but flagged as unreliable. */
|
||||
const MIN_DECIDED = 5;
|
||||
|
||||
/** Shared 2×2 cell dividers: vertical rule + row rule, collapsing to stacked rows on mobile. */
|
||||
const CELL_BORDERS = [
|
||||
"border-b border-border md:border-r",
|
||||
"border-b border-border",
|
||||
"border-b border-border md:border-b-0 md:border-r",
|
||||
"border-b-0",
|
||||
];
|
||||
|
||||
/** Donut geometry — the empty remainder is drawn as a static ring behind the chart. */
|
||||
const DONUT_SIZE = 164;
|
||||
const DONUT_INNER = 56;
|
||||
const DONUT_OUTER = 72;
|
||||
|
||||
/** "3 sargyt · 60%" — count first, share muted. */
|
||||
function CountShare({ count, percent }: { count: number; percent: number }) {
|
||||
const { t } = useTranslation();
|
||||
@@ -42,12 +56,12 @@ function CountShare({ count, percent }: { count: number; percent: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
function InfoHint({ children }: { children: ReactNode }) {
|
||||
function InfoHint({ children, className }: { children: ReactNode; className?: string }) {
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button type="button" className="inline-flex cursor-help text-muted-foreground hover:text-foreground">
|
||||
<Info className="h-3.5 w-3.5" />
|
||||
<button type="button" className={cn("inline-flex cursor-help", className ?? "text-muted-foreground hover:text-foreground")}>
|
||||
<Info className="size-3.5" aria-hidden="true" />
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="max-w-xs leading-relaxed">{children}</TooltipContent>
|
||||
@@ -66,7 +80,7 @@ interface DonutRow {
|
||||
function TotalDonut({ items, rows: rowDefs }: { items: CountItem[]; rows: DonutRow[] }) {
|
||||
const { t } = useTranslation();
|
||||
const byKey = new Map(items.map((it) => [it.key, it]));
|
||||
// Fixed row order and colors, so "unpaid" is always amber and never swaps with "paid".
|
||||
// Fixed row order and colors, so "unpaid" is always sand and never swaps with "paid".
|
||||
const known = new Set(rowDefs.map((r) => r.key));
|
||||
const extra = items.filter((it) => !known.has(it.key)).map((it) => ({ key: it.key, label: it.key, color: "var(--muted-foreground)" }));
|
||||
const rows = [...rowDefs, ...extra].map((r) => ({
|
||||
@@ -77,14 +91,36 @@ function TotalDonut({ items, rows: rowDefs }: { items: CountItem[]; rows: DonutR
|
||||
const total = rows.reduce((s, r) => s + r.count, 0);
|
||||
if (total === 0) return <EmptyState height={140} />;
|
||||
const config = Object.fromEntries(rows.map((r) => [r.label, { label: r.label, color: r.color }]));
|
||||
// Recharts derives its own slice angles; a pre-computed `percent` on the datum
|
||||
// would be read as geometry, so the chart rows carry the count only.
|
||||
const chartRows = rows.map(({ key, label, color, count }) => ({ key, label, color, count }));
|
||||
const ringRadius = (DONUT_INNER + DONUT_OUTER) / 2;
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-5">
|
||||
<div className="relative h-[132px] w-[132px] shrink-0">
|
||||
<ChartContainer config={config} className="h-full w-full">
|
||||
<div className="flex flex-col items-start gap-6 sm:flex-row sm:items-center">
|
||||
<div className="relative shrink-0" style={{ width: DONUT_SIZE, height: DONUT_SIZE }}>
|
||||
<svg viewBox={`0 0 ${DONUT_SIZE} ${DONUT_SIZE}`} className="absolute inset-0 size-full" aria-hidden="true">
|
||||
<circle
|
||||
cx={DONUT_SIZE / 2}
|
||||
cy={DONUT_SIZE / 2}
|
||||
r={ringRadius}
|
||||
fill="none"
|
||||
stroke="var(--track)"
|
||||
strokeWidth={DONUT_OUTER - DONUT_INNER}
|
||||
/>
|
||||
</svg>
|
||||
<ChartContainer config={config} className="aspect-square h-full w-full">
|
||||
<PieChart>
|
||||
<Pie data={rows} dataKey="count" nameKey="label" innerRadius={44} outerRadius={64} strokeWidth={2} stroke="var(--card)">
|
||||
{rows.map((r) => (
|
||||
<Pie
|
||||
data={chartRows}
|
||||
dataKey="count"
|
||||
nameKey="label"
|
||||
innerRadius={DONUT_INNER}
|
||||
outerRadius={DONUT_OUTER}
|
||||
strokeWidth={3}
|
||||
stroke="var(--card)"
|
||||
>
|
||||
{chartRows.map((r) => (
|
||||
<Cell key={r.key} fill={r.color} />
|
||||
))}
|
||||
</Pie>
|
||||
@@ -92,20 +128,20 @@ function TotalDonut({ items, rows: rowDefs }: { items: CountItem[]; rows: DonutR
|
||||
</PieChart>
|
||||
</ChartContainer>
|
||||
<div className="pointer-events-none absolute inset-0 flex flex-col items-center justify-center">
|
||||
<span className="text-2xl font-semibold tabular-nums leading-none">{formatNumber(total)}</span>
|
||||
<span className="text-[26px] font-semibold leading-none tabular-nums tracking-tight">{formatNumber(total)}</span>
|
||||
<span className="mt-1 text-[11px] text-muted-foreground">{t("analytics.kpi.orders", "sargyt")}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="min-w-0 flex-1 space-y-3">
|
||||
<div className="min-w-0 flex-1 space-y-4">
|
||||
{rows.map((r) => (
|
||||
<div key={r.key} className="space-y-0.5">
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<span className="h-2.5 w-2.5 shrink-0 rounded-full" style={{ background: r.color }} />
|
||||
<span className="truncate">{r.label}</span>
|
||||
</div>
|
||||
<div className="pl-[18px] text-sm tabular-nums">
|
||||
<CountShare count={r.count} percent={r.percent} />
|
||||
<div key={r.key}>
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="size-2.5 shrink-0 rounded-[3px]" style={{ background: r.color }} aria-hidden="true" />
|
||||
<span className="truncate text-[13.5px]">{r.label}</span>
|
||||
</div>
|
||||
<p className="mt-1.5 pl-5 text-[12.5px] tabular-nums text-muted-foreground">
|
||||
{formatNumber(r.count)} <span className="text-muted-foreground/70">{formatNumber(r.percent, 1)}%</span>
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -118,7 +154,7 @@ function TotalDonut({ items, rows: rowDefs }: { items: CountItem[]; rows: DonutR
|
||||
export function ProductsSection({ data, isLoading, isError, onRetry }: QueryProps<ProductsData>) {
|
||||
const { t } = useTranslation();
|
||||
const localized = useLocalizedName();
|
||||
const common = { isLoading, isError, onRetry, skeletonHeight: 150 };
|
||||
const common = { isLoading, isError, onRetry, skeletonHeight: 170 };
|
||||
|
||||
const toRows = (items: ProductsData["loanTypes"]): BarListRow[] =>
|
||||
items.map((it) => ({
|
||||
@@ -130,60 +166,66 @@ export function ProductsSection({ data, isLoading, isError, onRetry }: QueryProp
|
||||
}));
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4">
|
||||
<SectionCard
|
||||
title={t("analytics.products.sources", "Karz: Web we mobil")}
|
||||
description={t("analytics.products.sourcesDesc", "Karz sargytlary nireden iberildi")}
|
||||
{...common}
|
||||
>
|
||||
<TotalDonut
|
||||
items={data?.loanSources ?? []}
|
||||
rows={[
|
||||
{ key: "mobile", label: t("analytics.source.mobile", "Mobil"), color: LOAN_COLOR },
|
||||
{ key: "web", label: t("analytics.source.web", "Web"), color: "var(--chart-3)" },
|
||||
]}
|
||||
/>
|
||||
</SectionCard>
|
||||
<SectionCard
|
||||
title={t("analytics.products.cardPaid", "Kart sargytlary: töleg")}
|
||||
description={t("analytics.products.cardPaidDesc", "Kart sargytlarynyň näçesi tölendi")}
|
||||
{...common}
|
||||
>
|
||||
<TotalDonut
|
||||
items={data?.cardOrderPay ?? []}
|
||||
rows={[
|
||||
{ key: "paid", label: t("analytics.paid", "Tölenen"), color: GOOD_COLOR },
|
||||
{ key: "unpaid", label: t("analytics.unpaid", "Tölenmedik"), color: WAIT_COLOR },
|
||||
]}
|
||||
/>
|
||||
</SectionCard>
|
||||
<SectionCard
|
||||
title={t("analytics.products.loanTypes", "Karz görnüşleri")}
|
||||
description={t("analytics.products.loanTypesDesc", "Her görnüşiň ähli karz sargytlaryndaky paýy")}
|
||||
{...common}
|
||||
>
|
||||
<BarList rows={toRows(data?.loanTypes ?? [])} color={LOAN_COLOR} hideEmpty />
|
||||
</SectionCard>
|
||||
<SectionCard
|
||||
title={t("analytics.products.cardTypes", "Kart görnüşleri")}
|
||||
description={t("analytics.products.cardTypesDesc", "Her görnüşiň ähli kart sargytlaryndaky paýy")}
|
||||
{...common}
|
||||
>
|
||||
<BarList rows={toRows(data?.cardTypes ?? [])} color={CARD_COLOR} hideEmpty />
|
||||
</SectionCard>
|
||||
</div>
|
||||
<RegisterPanel>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2">
|
||||
<SectionCard
|
||||
className={CELL_BORDERS[0]}
|
||||
title={t("analytics.products.sources", "Karz: Web we mobil")}
|
||||
description={t("analytics.products.sourcesDesc", "Karz sargytlary nireden iberildi")}
|
||||
{...common}
|
||||
>
|
||||
<TotalDonut
|
||||
items={data?.loanSources ?? []}
|
||||
rows={[
|
||||
{ key: "mobile", label: t("analytics.source.mobile", "Mobil"), color: LOAN_COLOR },
|
||||
{ key: "web", label: t("analytics.source.web", "Web"), color: SHARE_COLOR },
|
||||
]}
|
||||
/>
|
||||
</SectionCard>
|
||||
<SectionCard
|
||||
className={CELL_BORDERS[1]}
|
||||
title={t("analytics.products.cardPaid", "Kart sargytlary: töleg")}
|
||||
description={t("analytics.products.cardPaidDesc", "Kart sargytlarynyň näçesi tölendi")}
|
||||
{...common}
|
||||
>
|
||||
<TotalDonut
|
||||
items={data?.cardOrderPay ?? []}
|
||||
rows={[
|
||||
{ key: "paid", label: t("analytics.paid", "Tölenen"), color: GOOD_COLOR },
|
||||
{ key: "unpaid", label: t("analytics.unpaid", "Tölenmedik"), color: WAIT_COLOR },
|
||||
]}
|
||||
/>
|
||||
</SectionCard>
|
||||
<SectionCard
|
||||
className={CELL_BORDERS[2]}
|
||||
title={t("analytics.products.loanTypes", "Karz görnüşleri")}
|
||||
description={t("analytics.products.loanTypesDesc", "Her görnüşiň ähli karz sargytlaryndaky paýy")}
|
||||
{...common}
|
||||
>
|
||||
<BarList rows={toRows(data?.loanTypes ?? [])} color={LOAN_COLOR} hideEmpty />
|
||||
</SectionCard>
|
||||
<SectionCard
|
||||
className={CELL_BORDERS[3]}
|
||||
title={t("analytics.products.cardTypes", "Kart görnüşleri")}
|
||||
description={t("analytics.products.cardTypesDesc", "Her görnüşiň ähli kart sargytlaryndaky paýy")}
|
||||
{...common}
|
||||
>
|
||||
<BarList rows={toRows(data?.cardTypes ?? [])} color={CARD_COLOR} hideEmpty />
|
||||
</SectionCard>
|
||||
</div>
|
||||
</RegisterPanel>
|
||||
);
|
||||
}
|
||||
|
||||
// ─── Customers ────────────────────────────────────────────────────────────────
|
||||
|
||||
/** Approved / rejected / waiting counts as colored dots, then the approval rate. */
|
||||
/** Approved / rejected / waiting counts as marked dots, then the approval rate. */
|
||||
function Outcome({ item, t }: { item: ApprovalCount; t: TFunction }) {
|
||||
const decided = item.approved + item.rejected;
|
||||
const parts = [
|
||||
{ n: item.approved, color: GOOD_COLOR, label: t("analytics.outcome.approved", "tassyklandy") },
|
||||
{ n: item.rejected, color: BAD_COLOR, label: t("analytics.outcome.rejected", "ret edildi") },
|
||||
{ n: item.open, color: WAIT_COLOR, label: t("analytics.outcome.open", "garaşýar") },
|
||||
{ n: item.open, color: WAIT_COLOR, label: t("analytics.outcome.open", "garaşýar"), pending: true },
|
||||
].filter((p) => p.n > 0);
|
||||
|
||||
const fewData = decided > 0 && decided < MIN_DECIDED;
|
||||
@@ -194,7 +236,11 @@ function Outcome({ item, t }: { item: ApprovalCount; t: TFunction }) {
|
||||
<span className="flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-0.5">
|
||||
{parts.map((p) => (
|
||||
<span key={p.label} className="inline-flex items-center gap-1 whitespace-nowrap">
|
||||
<span className="h-1.5 w-1.5 rounded-full" style={{ background: p.color }} />
|
||||
<span
|
||||
className={cn("size-2 shrink-0 rounded-full", p.pending && "border border-dashed bg-transparent")}
|
||||
style={p.pending ? { borderColor: p.color } : { background: p.color }}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{formatNumber(p.n)} {p.label}
|
||||
</span>
|
||||
))}
|
||||
@@ -214,7 +260,7 @@ function Outcome({ item, t }: { item: ApprovalCount; t: TFunction }) {
|
||||
>
|
||||
{formatPercent(item.approvalRate)}
|
||||
</span>
|
||||
<span className="text-muted-foreground">
|
||||
<span className="text-muted-foreground/80">
|
||||
{formatNumber(item.approved)}/{formatNumber(decided)}
|
||||
</span>
|
||||
</span>
|
||||
@@ -241,62 +287,103 @@ function approvalRows(items: ApprovalCount[], labelFor: (key: string) => string,
|
||||
}));
|
||||
}
|
||||
|
||||
function SummaryStat({ label, value, color, hint }: { label: string; value: string; color?: string; hint?: ReactNode }) {
|
||||
// ─── Anchor band: the five headline customer metrics on one dark surface ────
|
||||
|
||||
function BandStat({ label, value, color, pending }: { label: string; value: string; color?: string; pending?: boolean }) {
|
||||
return (
|
||||
<div className="min-w-0 space-y-1">
|
||||
<p className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
{color && <span className="h-2 w-2 shrink-0 rounded-full" style={{ background: color }} />}
|
||||
<div className="min-w-0">
|
||||
<p className="flex items-center gap-1.5 text-[11.5px] font-medium uppercase tracking-[0.07em] text-surface-strong-muted">
|
||||
{color && (
|
||||
<span
|
||||
className={cn("size-2 shrink-0 rounded-full", pending && "border border-dashed bg-transparent")}
|
||||
style={pending ? { borderColor: color } : { background: color }}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
)}
|
||||
<span className="truncate">{label}</span>
|
||||
{hint && <InfoHint>{hint}</InfoHint>}
|
||||
</p>
|
||||
<p className="text-2xl font-semibold tabular-nums tracking-tight">{value}</p>
|
||||
<p className="mt-2.5 text-[28px] font-semibold leading-none tracking-tight tabular-nums text-surface-strong-foreground">{value}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function CustomersSummary({ data, isLoading }: { data?: CustomersData; isLoading: boolean }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
// The endpoint reports totals per dimension but may omit the headline counts.
|
||||
// When they are absent, ages are the one dimension that covers every applicant,
|
||||
// so they are the honest source for the band.
|
||||
const fromGroups = data?.ageGroups?.length
|
||||
? data.ageGroups.reduce(
|
||||
(acc, g) => ({
|
||||
approved: acc.approved + (g.approved ?? 0),
|
||||
rejected: acc.rejected + (g.rejected ?? 0),
|
||||
open: acc.open + (g.open ?? 0),
|
||||
}),
|
||||
{ approved: 0, rejected: 0, open: 0 },
|
||||
)
|
||||
: undefined;
|
||||
|
||||
const approved = data?.approved ?? fromGroups?.approved;
|
||||
const rejected = data?.rejected ?? fromGroups?.rejected;
|
||||
const open = data?.open ?? fromGroups?.open;
|
||||
const decided = (approved ?? 0) + (rejected ?? 0);
|
||||
const approvalRate = data?.approvalRate ?? (decided > 0 ? ((approved ?? 0) / decided) * 100 : null);
|
||||
|
||||
const rateValue = formatPercent(approvalRate);
|
||||
const width = typeof approvalRate === "number" ? `${Math.min(100, Math.max(0, approvalRate))}%` : "0%";
|
||||
const rateHint = t(
|
||||
"analytics.customers.approvalHint",
|
||||
"Tassyklama derejesi = tassyklanan ÷ (tassyklanan + ret edilen). Garaşýan sargytlar hasaba alynmaýar.",
|
||||
"Tassyklama derejesi = tassyklanan ÷ (tasyklanan + ret edilen). Garaşýan sargytlar hasaba alynmaýar.",
|
||||
);
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardContent className="grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3 lg:grid-cols-5">
|
||||
{isLoading ? (
|
||||
Array.from({ length: 5 }, (_, i) => <Skeleton key={i} className="h-12 w-full" />)
|
||||
) : (
|
||||
<>
|
||||
<SummaryStat label={t("analytics.customers.totalOrders", "Jemi karz sargytlary")} value={formatNumber(data?.total)} />
|
||||
<SummaryStat
|
||||
label={t("analytics.outcome.approvedTitle", "Tassyklandy")}
|
||||
value={formatNumber(data?.approved)}
|
||||
color={GOOD_COLOR}
|
||||
/>
|
||||
<SummaryStat
|
||||
label={t("analytics.outcome.rejectedTitle", "Ret edildi")}
|
||||
value={formatNumber(data?.rejected)}
|
||||
color={BAD_COLOR}
|
||||
/>
|
||||
<SummaryStat label={t("analytics.outcome.openTitle", "Garaşýar")} value={formatNumber(data?.open)} color={WAIT_COLOR} />
|
||||
<SummaryStat
|
||||
label={t("analytics.customers.approvalRate", "Tassyklama derejesi")}
|
||||
value={formatPercent(data?.approvalRate)}
|
||||
hint={rateHint}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
<div className="rounded-panel bg-surface-strong px-5 py-[18px] lg:px-7">
|
||||
{isLoading ? (
|
||||
<div className="grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3 lg:grid-cols-5">
|
||||
{Array.from({ length: 5 }, (_, i) => (
|
||||
<div key={i} className="h-10 animate-pulse rounded-md bg-surface-strong-foreground/10" />
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="grid grid-cols-2 gap-x-6 gap-y-4 sm:grid-cols-3 lg:grid-cols-5 lg:items-end">
|
||||
<BandStat label={t("analytics.customers.totalOrders", "Jemi karz sargytlary")} value={formatNumber(data?.total)} />
|
||||
<BandStat label={t("analytics.outcome.approvedTitle", "Tassyklandy")} value={formatNumber(approved)} color="var(--chart-3)" />
|
||||
<BandStat label={t("analytics.outcome.rejectedTitle", "Ret edildi")} value={formatNumber(rejected)} color="var(--chart-5)" />
|
||||
<BandStat label={t("analytics.outcome.openTitle", "Garaşýar")} value={formatNumber(open)} color="var(--chart-4)" pending />
|
||||
<div className="min-w-0">
|
||||
<p className="flex items-center gap-1.5 text-[11.5px] font-medium uppercase tracking-[0.07em] text-surface-strong-muted">
|
||||
<span className="truncate">{t("analytics.customers.approvalRate", "Tassyklama derejesi")}</span>
|
||||
<InfoHint className="text-surface-strong-muted hover:text-surface-strong-foreground">{rateHint}</InfoHint>
|
||||
</p>
|
||||
<p className="mt-2.5 text-[28px] font-semibold leading-none tracking-tight tabular-nums text-surface-strong-foreground">
|
||||
{rateValue}
|
||||
</p>
|
||||
<span className="mt-3 block h-1 w-full overflow-hidden rounded-full bg-surface-strong-foreground/15">
|
||||
<span className="block h-full rounded-full bg-surface-strong-foreground/70" style={{ width }} />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function CustomersSection({ data, isLoading, isError, onRetry }: QueryProps<CustomersData>) {
|
||||
interface CustomersSectionProps extends QueryProps<CustomersData> {
|
||||
/** Product breakdown is a sibling query, passed in so both blocks refresh together. */
|
||||
products: QueryProps<ProductsData>;
|
||||
}
|
||||
|
||||
export function CustomersSection({ data, isLoading, isError, onRetry, products }: CustomersSectionProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
// One error card instead of four identical ones.
|
||||
if (isError) {
|
||||
return <SectionCard title={t("analytics.customers.title", "Müşderiler")} isError onRetry={onRetry} skeletonHeight={160} />;
|
||||
return (
|
||||
<RegisterPanel>
|
||||
<SectionCard title={t("analytics.customers.title", "Müşderiler")} isError onRetry={onRetry} skeletonHeight={160} />
|
||||
</RegisterPanel>
|
||||
);
|
||||
}
|
||||
|
||||
const unknown = t("analytics.unknown", "Näbelli");
|
||||
@@ -319,20 +406,34 @@ export function CustomersSection({ data, isLoading, isError, onRetry }: QueryPro
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{t("analytics.customers.desc", "Saýlanan döwürde karz sargydyny berenleriň profili")}
|
||||
</p>
|
||||
<CustomersSummary data={data} isLoading={isLoading} />
|
||||
</div>
|
||||
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 2xl:grid-cols-4">
|
||||
{cards.map((c) => (
|
||||
<SectionCard key={c.title} title={c.title} isLoading={isLoading} skeletonHeight={180}>
|
||||
<BarList rows={approvalRows(c.items ?? [], c.label, t)} color={LOAN_COLOR} />
|
||||
</SectionCard>
|
||||
))}
|
||||
</div>
|
||||
<div className="space-y-3.5">
|
||||
<CustomersSummary data={data} isLoading={isLoading} />
|
||||
|
||||
<ProductsSection {...products} />
|
||||
|
||||
<RegisterPanel>
|
||||
<div className="flex flex-col gap-1 border-b border-border px-5 py-3.5 sm:flex-row sm:items-baseline sm:justify-between lg:px-6">
|
||||
<p className="text-[13px] text-muted-foreground">
|
||||
{t("analytics.customers.desc", "Saýlanan döwürde karz sargydyny berenleriň profili")}
|
||||
</p>
|
||||
<span className="flex items-center gap-1.5 text-[11.5px] text-muted-foreground/80">
|
||||
{t("analytics.customers.approvalRate", "Tassyklama derejesi")}
|
||||
<InfoHint>
|
||||
{t(
|
||||
"analytics.customers.approvalHint",
|
||||
"Tassyklama derejesi = tassyklanan ÷ (tasyklanan + ret edilen). Garaşýan sargytlar hasaba alynmaýar.",
|
||||
)}
|
||||
</InfoHint>
|
||||
</span>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2">
|
||||
{cards.map((c, i) => (
|
||||
<SectionCard key={c.title} className={CELL_BORDERS[i]} title={c.title} isLoading={isLoading} skeletonHeight={180}>
|
||||
<BarList rows={approvalRows(c.items ?? [], c.label, t)} color={LOAN_COLOR} />
|
||||
</SectionCard>
|
||||
))}
|
||||
</div>
|
||||
</RegisterPanel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -179,6 +179,12 @@ function PayForm({ id, isPaying, onSubmit, onCancel }: PayFormProps) {
|
||||
<dd>{quote.tvebFeeTmt} TMT</dd>
|
||||
</div>
|
||||
)}
|
||||
{quote.maxAmountTmt != null && (
|
||||
<div className="flex justify-between gap-4">
|
||||
<dt className="text-muted-foreground">{t("intlPayment.pay.maxAmount", "Iň ýokary möçberi")}</dt>
|
||||
<dd>{quote.maxAmountTmt} TMT</dd>
|
||||
</div>
|
||||
)}
|
||||
</dl>
|
||||
) : null}
|
||||
|
||||
|
||||
170
src/index.css
170
src/index.css
@@ -47,6 +47,11 @@
|
||||
--color-card: var(--card);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-background: var(--background);
|
||||
--color-track: var(--track);
|
||||
--color-positive: var(--positive);
|
||||
--color-surface-strong: var(--surface-strong);
|
||||
--color-surface-strong-foreground: var(--surface-strong-foreground);
|
||||
--color-surface-strong-muted: var(--surface-strong-muted);
|
||||
--radius-sm: calc(var(--radius) * 0.6);
|
||||
--radius-md: calc(var(--radius) * 0.8);
|
||||
--radius-lg: var(--radius);
|
||||
@@ -54,6 +59,7 @@
|
||||
--radius-2xl: calc(var(--radius) * 1.8);
|
||||
--radius-3xl: calc(var(--radius) * 2.2);
|
||||
--radius-4xl: calc(var(--radius) * 2.6);
|
||||
--radius-panel: calc(var(--radius) * 1.1);
|
||||
}
|
||||
|
||||
:root {
|
||||
@@ -81,6 +87,12 @@
|
||||
--chart-3: #7c3aed; /* registered — daha doygun mor */
|
||||
--chart-4: #d97706; /* pending — daha koyu amber, açık zeminde okunaklı */
|
||||
--chart-5: #dc2626; /* cancelled/rejected — daha koyu kırmızı */
|
||||
/* Data-surface tokens (used by the dashboard scope below) */
|
||||
--track: oklch(0.92 0.004 286.32);
|
||||
--positive: #059669;
|
||||
--surface-strong: #0b3634;
|
||||
--surface-strong-foreground: #eff7f5;
|
||||
--surface-strong-muted: #7ea8a2;
|
||||
--radius: 0.625rem;
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
||||
@@ -125,6 +137,61 @@
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.552 0.016 285.938);
|
||||
--link-color: #4cb2a1;
|
||||
}
|
||||
|
||||
/* ─── Dashboard palette (scoped) ───────────────────────────────────────────────
|
||||
The dashboard's tonal surface system lives here instead of in `:root`, so every
|
||||
other page keeps the default theme. The tokens are applied by the
|
||||
`.dashboard-surface` class on the dashboard route's <main>.
|
||||
Surfaces: the card sits one tonal step BELOW the page and carries no shadow,
|
||||
so panels never glare against the canvas. Hues: teal = loans / approved,
|
||||
mid teal = cards, light teal = secondary share, sand = waiting, clay = rejected.
|
||||
────────────────────────────────────────────────────────────────────────────── */
|
||||
|
||||
html:not(.dark) .dashboard-surface {
|
||||
--background: #f8fbfa;
|
||||
--foreground: #0f211f;
|
||||
--card: #eff5f4;
|
||||
--card-foreground: #0f211f;
|
||||
--popover: #ffffff;
|
||||
--popover-foreground: #0f211f;
|
||||
--primary: #0c7a6b;
|
||||
--primary-foreground: #ffffff;
|
||||
--secondary: #e6efed;
|
||||
--secondary-foreground: #0f211f;
|
||||
--muted: #e6efed;
|
||||
--muted-foreground: #57706d;
|
||||
--accent: #e6efed;
|
||||
--accent-foreground: #0f211f;
|
||||
--border: #dfe8e6;
|
||||
--input: #dfe8e6;
|
||||
--ring: #8ba19d;
|
||||
--chart-1: #0c7a6b;
|
||||
--chart-2: #3f8e80;
|
||||
--chart-3: #7fb8ab;
|
||||
--chart-4: #b58a4a;
|
||||
--chart-5: #a05a48;
|
||||
--track: #dbe6e3;
|
||||
--positive: #0c7a6b;
|
||||
--surface-strong: #0b3634;
|
||||
--surface-strong-foreground: #eff7f5;
|
||||
--surface-strong-muted: #7ea8a2;
|
||||
--link-color: #0c7a6b;
|
||||
}
|
||||
|
||||
.dark .dashboard-surface {
|
||||
--chart-1: #4cb2a1;
|
||||
--chart-2: #79c1b4;
|
||||
--chart-3: #a5d5cc;
|
||||
--chart-4: #d3ab72;
|
||||
--chart-5: #c98a76;
|
||||
--track: oklch(1 0 0 / 12%);
|
||||
--positive: #4cb2a1;
|
||||
--surface-strong: #103935;
|
||||
--surface-strong-foreground: #e6f2f0;
|
||||
--surface-strong-muted: #8fb8b2;
|
||||
--link-color: #4cb2a1;
|
||||
}
|
||||
|
||||
@layer base {
|
||||
@@ -139,109 +206,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* ─── ProseMirror / Tiptap editor content styles ────────────────────────────
|
||||
Tailwind v4 preflight resets list-style, margins, and blockquote on all
|
||||
elements. We restore them explicitly so toolbar actions are visible.
|
||||
─────────────────────────────────────────────────────────────────────────── */
|
||||
|
||||
.ProseMirror {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.ProseMirror > * + * {
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
/* ── Lists ── */
|
||||
.ProseMirror ul {
|
||||
list-style-type: disc;
|
||||
padding-left: 1.5rem;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
.ProseMirror ol {
|
||||
list-style-type: decimal;
|
||||
padding-left: 1.5rem;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
.ProseMirror li {
|
||||
margin: 0.2rem 0;
|
||||
}
|
||||
|
||||
.ProseMirror li p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* ── Blockquote ── */
|
||||
.ProseMirror blockquote {
|
||||
border-left: 3px solid var(--border);
|
||||
padding-left: 1rem;
|
||||
color: var(--muted-foreground);
|
||||
font-style: italic;
|
||||
margin: 0.75rem 0;
|
||||
}
|
||||
|
||||
/* ── Headings ── */
|
||||
.ProseMirror h1 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 0.75rem 0 0.25rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.ProseMirror h2 {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
margin: 0.75rem 0 0.25rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.ProseMirror h3 {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
margin: 0.75rem 0 0.25rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
/* ── Inline code ── */
|
||||
.ProseMirror code {
|
||||
background: var(--muted);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.1rem 0.35rem;
|
||||
font-size: 0.85em;
|
||||
font-family: ui-monospace, monospace;
|
||||
}
|
||||
|
||||
/* ── Code block ── */
|
||||
.ProseMirror pre {
|
||||
background: var(--muted);
|
||||
border-radius: 0.375rem;
|
||||
padding: 0.75rem 1rem;
|
||||
overflow-x: auto;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
.ProseMirror pre code {
|
||||
background: none;
|
||||
padding: 0;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
/* ── Horizontal rule ── */
|
||||
.ProseMirror hr {
|
||||
border: none;
|
||||
border-top: 1px solid var(--border);
|
||||
margin: 0.75rem 0;
|
||||
}
|
||||
|
||||
/* ── Links ── */
|
||||
.ProseMirror a {
|
||||
color: var(--primary);
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* ── Custom Scrollbar Styles ── */
|
||||
.scrollbar-thin,
|
||||
[data-slot="select-content"],
|
||||
|
||||
@@ -759,6 +759,11 @@ function DashboardHeader() {
|
||||
// ─── Layout ───────────────────────────────────────────────────────────────────
|
||||
|
||||
export function DashboardLayout() {
|
||||
const { pathname } = useLocation();
|
||||
// The dashboard owns its own tonal palette (see `.dashboard-surface` in index.css);
|
||||
// every other route keeps the default theme.
|
||||
const isDashboardRoute = pathname.replace(/\/+$/, "").endsWith("/dashboard");
|
||||
|
||||
return (
|
||||
<TooltipProvider>
|
||||
<SidebarProvider>
|
||||
@@ -768,7 +773,7 @@ export function DashboardLayout() {
|
||||
<div className="flex-1 p-0 md:p-2 flex bg-sidebar flex-col min-w-0">
|
||||
<DashboardHeader />
|
||||
|
||||
<main className="flex-1 p-4 rounded-b-md mb-1 bg-background">
|
||||
<main className={cn("flex-1 p-4 rounded-b-md mb-1 bg-background", isDashboardRoute && "dashboard-surface")}>
|
||||
<Outlet />
|
||||
</main>
|
||||
|
||||
|
||||
@@ -4,76 +4,87 @@ import { useMemo, useState, type ElementType } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { AlertCircle, ArrowDownRight, ArrowUpRight, CreditCard, DollarSign, FileText, RefreshCw, Users } from "lucide-react";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { StatItem } from "@/features/dashboard/api/dashboardApi";
|
||||
import { DASHBOARD_OVERVIEW_KEY, useDashboardOverview } from "@/features/dashboard/hooks/useDashboard";
|
||||
import { ANALYTICS_KEY, useAnalyticsCustomers } from "@/features/dashboard/hooks/useAnalytics";
|
||||
import { ANALYTICS_KEY, useAnalyticsCustomers, useAnalyticsProducts } from "@/features/dashboard/hooks/useAnalytics";
|
||||
import { CustomersSection } from "@/features/dashboard/components/productsCustomersSection";
|
||||
import { formatNumber } from "@/features/dashboard/components/analyticsFormat";
|
||||
|
||||
// ─── Stat card ────────────────────────────────────────────────────────────────
|
||||
/**
|
||||
* KPI register cell dividers: a 2×2 grid on small screens, one row of four on lg.
|
||||
* Each cell owns its own rules, so the panel never needs a negative-margin trick.
|
||||
*/
|
||||
const KPI_CELL_BORDERS = [
|
||||
"border-b border-r border-border lg:border-b-0",
|
||||
"border-b border-border lg:border-b-0 lg:border-r",
|
||||
"border-r border-border",
|
||||
"",
|
||||
];
|
||||
|
||||
interface StatCardProps {
|
||||
// ─── Stat cell ────────────────────────────────────────────────────────────────
|
||||
|
||||
interface StatCellProps {
|
||||
title: string;
|
||||
stat?: StatItem;
|
||||
icon: ElementType;
|
||||
accent: string;
|
||||
footnote: string;
|
||||
comparedTo: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
function StatCard({ title, stat, icon: Icon, accent, footnote, comparedTo }: StatCardProps) {
|
||||
function StatCell({ title, stat, icon: Icon, footnote, comparedTo, className }: StatCellProps) {
|
||||
const change = stat?.changePercent;
|
||||
const hasChange = change !== null && change !== undefined;
|
||||
const positive = (change ?? 0) >= 0;
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium text-muted-foreground">{title}</CardTitle>
|
||||
<div className={cn("flex h-9 w-9 items-center justify-center rounded-lg", accent)}>
|
||||
<Icon size={16} />
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-3xl font-semibold tracking-tight tabular-nums">{formatNumber(stat?.count ?? 0)}</p>
|
||||
{hasChange ? (
|
||||
<p
|
||||
className={cn(
|
||||
"mt-1 flex items-center gap-1 text-xs font-medium",
|
||||
positive ? "text-emerald-600 dark:text-emerald-400" : "text-destructive",
|
||||
)}
|
||||
>
|
||||
{positive ? <ArrowUpRight size={13} /> : <ArrowDownRight size={13} />}
|
||||
{formatNumber(Math.abs(change), 1)}% {comparedTo}
|
||||
</p>
|
||||
) : (
|
||||
<p className="mt-1 flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<span className="inline-block h-1.5 w-1.5 rounded-full bg-muted-foreground/40" />
|
||||
{footnote}
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
<div className={cn("px-5 py-5 lg:px-7 lg:py-6", className)}>
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<p className="text-[13px] font-medium text-muted-foreground">{title}</p>
|
||||
<Icon className="size-[18px] shrink-0 text-muted-foreground/60" aria-hidden="true" />
|
||||
</div>
|
||||
|
||||
<p className="mt-3.5 text-[34px] font-semibold leading-none tracking-tight tabular-nums">{formatNumber(stat?.count ?? 0)}</p>
|
||||
|
||||
{hasChange ? (
|
||||
<p
|
||||
className={cn(
|
||||
"mt-3 flex flex-wrap items-center gap-x-1 text-[12.5px] font-medium",
|
||||
positive ? "text-positive" : "text-destructive",
|
||||
)}
|
||||
>
|
||||
{positive ? (
|
||||
<ArrowUpRight className="size-3 shrink-0" aria-hidden="true" />
|
||||
) : (
|
||||
<ArrowDownRight className="size-3 shrink-0" aria-hidden="true" />
|
||||
)}
|
||||
<span className="tabular-nums">{formatNumber(Math.abs(change), 1)}%</span>
|
||||
<span className="font-normal text-muted-foreground">{comparedTo}</span>
|
||||
</p>
|
||||
) : (
|
||||
<p className="mt-3 flex items-center gap-2 text-[12.5px] text-muted-foreground">
|
||||
<span className="inline-block size-2 shrink-0 rounded-full bg-muted-foreground/40" aria-hidden="true" />
|
||||
{footnote}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function StatCardSkeleton() {
|
||||
function StatCellSkeleton({ className }: { className?: string }) {
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<Skeleton className="h-4 w-28" />
|
||||
<Skeleton className="h-9 w-9 rounded-lg" />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Skeleton className="h-8 w-24" />
|
||||
<Skeleton className="mt-2 h-3 w-36" />
|
||||
</CardContent>
|
||||
</Card>
|
||||
<div className={cn("px-5 py-5 lg:px-7 lg:py-6", className)}>
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<Skeleton className="h-3.5 w-24" />
|
||||
<Skeleton className="size-[18px] rounded-sm" />
|
||||
</div>
|
||||
<Skeleton className="mt-3.5 h-7 w-24" />
|
||||
<Skeleton className="mt-2.5 h-3 w-32" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,8 +100,9 @@ export default function DashboardPage({ isLoading: propLoading = false }: { isLo
|
||||
|
||||
const overview = useDashboardOverview({ year: selectedYear });
|
||||
const customers = useAnalyticsCustomers(analyticsParams);
|
||||
const products = useAnalyticsProducts(analyticsParams);
|
||||
|
||||
const isFetching = overview.isFetching || customers.isFetching;
|
||||
const isFetching = overview.isFetching || customers.isFetching || products.isFetching;
|
||||
const showStatSkeleton = propLoading || overview.isLoading;
|
||||
|
||||
const handleRefresh = () => {
|
||||
@@ -102,78 +114,83 @@ export default function DashboardPage({ isLoading: propLoading = false }: { isLo
|
||||
const comparedTo = t("dashboard.comparedToLastMonth", "geçen aýa garanyňda");
|
||||
const stats = overview.data?.stats;
|
||||
|
||||
const statCards: Omit<StatCardProps, "comparedTo">[] = [
|
||||
const statCards: Omit<StatCellProps, "comparedTo" | "className">[] = [
|
||||
{
|
||||
title: t("dashboard.loanOrders", "Karz sargytlary"),
|
||||
stat: stats?.loanOrders,
|
||||
icon: FileText,
|
||||
accent: "bg-[var(--chart-1)]/12 text-[var(--chart-1)]",
|
||||
footnote: t("dashboard.totalLoanOrders", "Jemi karz sargytlar"),
|
||||
},
|
||||
{
|
||||
title: t("dashboard.activeCards", "Işjeň kartlar"),
|
||||
stat: stats?.activeCards,
|
||||
icon: CreditCard,
|
||||
accent: "bg-[var(--chart-3)]/12 text-[var(--chart-3)]",
|
||||
footnote: t("dashboard.totalActiveCards", "Işjeň kartlaryň sany"),
|
||||
},
|
||||
{
|
||||
title: t("dashboard.activeClients", "Işjeň müşderiler"),
|
||||
stat: stats?.activeCustomers,
|
||||
icon: Users,
|
||||
accent: "bg-[var(--chart-4)]/12 text-[var(--chart-4)]",
|
||||
footnote: t("dashboard.totalActiveCustomers", "Hasaba alnan müşderiler"),
|
||||
},
|
||||
{
|
||||
title: t("dashboard.onlinePayments", "Onlaýn tölegler"),
|
||||
stat: stats?.onlinePayments,
|
||||
icon: DollarSign,
|
||||
accent: "bg-[var(--chart-2)]/12 text-[var(--chart-2)]",
|
||||
footnote: t("dashboard.totalOnlinePayments", "Amala aşyrylan tölegler"),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="w-full space-y-6">
|
||||
<div className="w-full space-y-3.5">
|
||||
{/* Header */}
|
||||
<div className="flex flex-col justify-between gap-4 sm:flex-row sm:items-center">
|
||||
<div className="flex flex-col justify-between gap-4 sm:flex-row sm:items-end">
|
||||
<div>
|
||||
<h1 className="text-2xl font-semibold tracking-tight">{t("dashboard.title", "Baş sahypa")}</h1>
|
||||
<p className="mt-0.5 text-sm text-muted-foreground">{t("dashboard.overviewSubtitle", "Ähli amallaryň gysgaça görünüşi")}</p>
|
||||
<h1 className="text-[28px] font-semibold tracking-tight">{t("dashboard.title", "Baş sahypa")}</h1>
|
||||
<p className="mt-2 text-[13.5px] text-muted-foreground">{t("dashboard.overviewSubtitle", "Ähli amallaryň gysgaça görünüşi")}</p>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 self-start sm:self-auto">
|
||||
<div className="flex items-center self-start rounded-md border border-border bg-card p-0.5 sm:self-auto">
|
||||
<Select value={String(selectedYear)} onValueChange={(val) => setSelectedYear(Number(val))}>
|
||||
<SelectTrigger className="h-9 w-[120px] cursor-pointer">
|
||||
<SelectValue placeholder={String(selectedYear)} />
|
||||
<SelectTrigger
|
||||
aria-label={t("common.year", "ýyl")}
|
||||
className="h-9 w-[110px] cursor-pointer rounded-[5px] border-0 bg-transparent px-2.5 text-[13.5px] shadow-none focus-visible:border-transparent focus-visible:ring-0"
|
||||
>
|
||||
<SelectValue />
|
||||
<span className="text-[11.5px] text-muted-foreground" aria-hidden="true">
|
||||
{t("common.year", "ýyl")}
|
||||
</span>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectContent align="end">
|
||||
{yearOptions.map((y) => (
|
||||
<SelectItem key={y} value={String(y)} className="cursor-pointer">
|
||||
{y} {t("common.year", "ýyl")}
|
||||
<SelectItem key={y} value={String(y)} className="cursor-pointer tabular-nums">
|
||||
{y}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<span className="h-4 w-px bg-border" aria-hidden="true" />
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={handleRefresh}
|
||||
disabled={isFetching}
|
||||
aria-label={t("common.refresh", "Täzele")}
|
||||
title={t("common.refresh", "Täzele")}
|
||||
className="h-9 w-9 cursor-pointer"
|
||||
className="rounded-[5px]"
|
||||
>
|
||||
<RefreshCw className={cn("h-4 w-4", isFetching && "animate-spin")} />
|
||||
<RefreshCw className={cn("size-4", isFetching && "animate-spin")} />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Stat cards */}
|
||||
{/* KPI register */}
|
||||
{overview.isError && !showStatSkeleton ? (
|
||||
<div className="flex w-full flex-col items-center justify-center space-y-4 rounded-xl border bg-card p-12 text-center">
|
||||
<div className="flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 text-destructive">
|
||||
<AlertCircle className="h-6 w-6" />
|
||||
<div className="flex w-full flex-col items-center justify-center space-y-4 rounded-panel border border-border bg-card p-12 text-center">
|
||||
<div className="flex size-12 items-center justify-center rounded-full bg-destructive/10 text-destructive">
|
||||
<AlertCircle className="size-6" aria-hidden="true" />
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold">{t("dashboard.errorTitle", "Maglumatlary ýükläp bolmady")}</h3>
|
||||
@@ -184,15 +201,15 @@ export default function DashboardPage({ isLoading: propLoading = false }: { isLo
|
||||
</p>
|
||||
</div>
|
||||
<Button onClick={() => overview.refetch()} variant="outline" className="gap-2">
|
||||
<RefreshCw className="h-4 w-4" />
|
||||
<RefreshCw className="size-4" aria-hidden="true" />
|
||||
{t("common.retry", "Täzeden synanyş")}
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="grid grid-cols-2 gap-4 lg:grid-cols-4">
|
||||
<div className="grid grid-cols-2 overflow-hidden rounded-panel border border-border bg-card lg:grid-cols-4">
|
||||
{showStatSkeleton
|
||||
? Array.from({ length: 4 }, (_, i) => <StatCardSkeleton key={i} />)
|
||||
: statCards.map((card) => <StatCard key={card.title} {...card} comparedTo={comparedTo} />)}
|
||||
? Array.from({ length: 4 }, (_, i) => <StatCellSkeleton key={i} className={KPI_CELL_BORDERS[i]} />)
|
||||
: statCards.map((card, i) => <StatCell key={card.title} {...card} comparedTo={comparedTo} className={KPI_CELL_BORDERS[i]} />)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -202,6 +219,12 @@ export default function DashboardPage({ isLoading: propLoading = false }: { isLo
|
||||
isLoading={customers.isLoading}
|
||||
isError={customers.isError}
|
||||
onRetry={() => customers.refetch()}
|
||||
products={{
|
||||
data: products.data,
|
||||
isLoading: products.isLoading,
|
||||
isError: products.isError,
|
||||
onRetry: () => products.refetch(),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user