Feat: Add export to CSV support (#292)

* install json2csv package

* add necessary labels

* add support convert the JSON to redable CSV format and export

* add a popover to export btton and provide options for exporting to JSON and CSV

* Use a DropdownMenu

* Translations

---------

Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
This commit is contained in:
Yuvaraj Sai
2025-04-19 23:41:38 +05:30
committed by GitHub
parent f9307fd22d
commit 6c5c9d5bed
17 changed files with 235 additions and 11 deletions

23
package-lock.json generated
View File

@@ -11,6 +11,7 @@
"dependencies": {
"@formatjs/intl-localematcher": "^0.5.4",
"@hookform/resolvers": "^3.3.2",
"@json2csv/plainjs": "^7.0.6",
"@prisma/client": "^5.6.0",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-collapsible": "^1.0.3",
@@ -5320,6 +5321,22 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/@json2csv/formatters": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/@json2csv/formatters/-/formatters-7.0.6.tgz",
"integrity": "sha512-hjIk1H1TR4ydU5ntIENEPgoMGW+Q7mJ+537sDFDbsk+Y3EPl2i4NfFVjw0NJRgT+ihm8X30M67mA8AS6jPidSA==",
"license": "MIT"
},
"node_modules/@json2csv/plainjs": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/@json2csv/plainjs/-/plainjs-7.0.6.tgz",
"integrity": "sha512-4Md7RPDCSYpmW1HWIpWBOqCd4vWfIqm53S3e/uzQ62iGi7L3r34fK/8nhOMEe+/eVfCx8+gdSCt1d74SlacQHw==",
"license": "MIT",
"dependencies": {
"@json2csv/formatters": "^7.0.6",
"@streamparser/json": "^0.0.20"
}
},
"node_modules/@next/env": {
"version": "14.2.5",
"resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.5.tgz",
@@ -8930,6 +8947,12 @@
"node": ">=16.0.0"
}
},
"node_modules/@streamparser/json": {
"version": "0.0.20",
"resolved": "https://registry.npmjs.org/@streamparser/json/-/json-0.0.20.tgz",
"integrity": "sha512-VqAAkydywPpkw63WQhPVKCD3SdwXuihCUVZbbiY3SfSTGQyHmwRoq27y4dmJdZuJwd5JIlQoMPyGvMbUPY0RKQ==",
"license": "MIT"
},
"node_modules/@swc/counter": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz",