diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..6cde745
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+ "files.exclude": {
+ "": true
+ }
+}
\ No newline at end of file
diff --git a/next-env.d.js b/next-env.d.js
deleted file mode 100644
index 1b3be08..0000000
--- a/next-env.d.js
+++ /dev/null
@@ -1,5 +0,0 @@
-///
-///
-
-// NOTE: This file should not be edited
-// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/package-lock.json b/package-lock.json
index 7189527..9016261 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -25,6 +25,7 @@
"next-pwa": "^5.6.0",
"react": "^19.2.3",
"react-dom": "^19.2.3",
+ "swr": "^2.5.1",
"tailwind-merge": "^3.3.1",
"tailwindcss-animate": "^1.0.7"
},
@@ -42,7 +43,7 @@
"eslint-config-next": "15.4.6",
"jest": "^30.0.5",
"jest-environment-jsdom": "^30.0.5",
- "tailwindcss": "^4.1.14",
+ "tailwindcss": "^4.3.3",
"typescript": "^5"
}
},
@@ -5535,6 +5536,12 @@
"node": ">= 10"
}
},
+ "node_modules/@tailwindcss/vite/node_modules/tailwindcss": {
+ "version": "4.1.14",
+ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.14.tgz",
+ "integrity": "sha512-b7pCxjGO98LnxVkKjaZSDeNuljC4ueKUddjENJOADtubtdo8llTaJy7HwBMeLNSSo2N5QIAgklslK1+Ir8r6CA==",
+ "license": "MIT"
+ },
"node_modules/@testing-library/dom": {
"version": "10.4.1",
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz",
@@ -7374,61 +7381,6 @@
"node": "*"
}
},
- "node_modules/bl": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
- "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "buffer": "^5.5.0",
- "inherits": "^2.0.4",
- "readable-stream": "^3.4.0"
- }
- },
- "node_modules/bl/node_modules/buffer": {
- "version": "5.7.1",
- "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
- "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "base64-js": "^1.3.1",
- "ieee754": "^1.1.13"
- }
- },
- "node_modules/bl/node_modules/readable-stream": {
- "version": "3.6.2",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
- "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "inherits": "^2.0.3",
- "string_decoder": "^1.1.1",
- "util-deprecate": "^1.0.1"
- },
- "engines": {
- "node": ">= 6"
- }
- },
"node_modules/brace-expansion": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
@@ -8144,23 +8096,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/decompress-response": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
- "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "mimic-response": "^3.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/dedent": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/dedent/-/dedent-1.6.0.tgz",
@@ -8176,17 +8111,6 @@
}
}
},
- "node_modules/deep-extend": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
- "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "engines": {
- "node": ">=4.0.0"
- }
- },
"node_modules/deep-is": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
@@ -8326,9 +8250,7 @@
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
"integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
- "dev": true,
"license": "MIT",
- "peer": true,
"engines": {
"node": ">=6"
}
@@ -8462,17 +8384,6 @@
"node": ">= 4"
}
},
- "node_modules/end-of-stream": {
- "version": "1.4.5",
- "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
- "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "once": "^1.4.0"
- }
- },
"node_modules/enhanced-resolve": {
"version": "5.20.1",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.20.1.tgz",
@@ -9261,17 +9172,6 @@
"node": ">= 0.8.0"
}
},
- "node_modules/expand-template": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
- "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
- "license": "(MIT OR WTFPL)",
- "optional": true,
- "peer": true,
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/expect": {
"version": "30.0.5",
"resolved": "https://registry.npmjs.org/expect/-/expect-30.0.5.tgz",
@@ -9601,14 +9501,6 @@
}
}
},
- "node_modules/fs-constants": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
- "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
- "license": "MIT",
- "optional": true,
- "peer": true
- },
"node_modules/fs-extra": {
"version": "9.1.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",
@@ -9815,14 +9707,6 @@
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
- "node_modules/github-from-package": {
- "version": "0.0.0",
- "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
- "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
- "license": "MIT",
- "optional": true,
- "peer": true
- },
"node_modules/glob": {
"version": "10.4.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
@@ -10232,14 +10116,6 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"license": "ISC"
},
- "node_modules/ini": {
- "version": "1.3.8",
- "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
- "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
- "license": "ISC",
- "optional": true,
- "peer": true
- },
"node_modules/internal-slot": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz",
@@ -11969,22 +11845,6 @@
"node": ">=18.0.0"
}
},
- "node_modules/kerberos": {
- "version": "7.0.0",
- "resolved": "https://registry.npmjs.org/kerberos/-/kerberos-7.0.0.tgz",
- "integrity": "sha512-Q8yUNeCM5fSXkURaa05WugXFsH6c57hDHDmsupMFCPaQEPym9FGwFp/2XSTcMuLldtEeBOsQ/9VGQ55lfHTT3Q==",
- "hasInstallScript": true,
- "license": "Apache-2.0",
- "optional": true,
- "peer": true,
- "dependencies": {
- "node-addon-api": "^8.5.0",
- "prebuild-install": "^7.1.3"
- },
- "engines": {
- "node": ">=20.19.0"
- }
- },
"node_modules/keyv": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
@@ -12511,20 +12371,6 @@
"node": ">=6"
}
},
- "node_modules/mimic-response": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
- "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/min-indent": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
@@ -12551,7 +12397,7 @@
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
- "devOptional": true,
+ "dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
@@ -12585,14 +12431,6 @@
"deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)",
"license": "MIT"
},
- "node_modules/mkdirp-classic": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
- "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
- "license": "MIT",
- "optional": true,
- "peer": true
- },
"node_modules/mongodb": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.1.1.tgz",
@@ -12736,14 +12574,6 @@
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
- "node_modules/napi-build-utils": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz",
- "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==",
- "license": "MIT",
- "optional": true,
- "peer": true
- },
"node_modules/napi-postinstall": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/napi-postinstall/-/napi-postinstall-0.3.2.tgz",
@@ -12872,31 +12702,6 @@
"node": "^10 || ^12 || >=14"
}
},
- "node_modules/node-abi": {
- "version": "3.89.0",
- "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.89.0.tgz",
- "integrity": "sha512-6u9UwL0HlAl21+agMN3YAMXcKByMqwGx+pq+P76vii5f7hTPtKDp08/H9py6DY+cfDw7kQNTGEj/rly3IgbNQA==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "semver": "^7.3.5"
- },
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/node-addon-api": {
- "version": "8.7.0",
- "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.7.0.tgz",
- "integrity": "sha512-9MdFxmkKaOYVTV+XVRG8ArDwwQ77XIgIPyKASB1k3JPq3M8fGQQQE3YpMOrKm6g//Ktx8ivZr8xo1Qmtqub+GA==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "engines": {
- "node": "^18 || ^20 || >= 21"
- }
- },
"node_modules/node-fetch": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
@@ -13546,35 +13351,6 @@
"node": "^10 || ^12 || >=14"
}
},
- "node_modules/prebuild-install": {
- "version": "7.1.3",
- "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz",
- "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==",
- "deprecated": "No longer maintained. Please contact the author of the relevant native addon; alternatives are available.",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "detect-libc": "^2.0.0",
- "expand-template": "^2.0.3",
- "github-from-package": "0.0.0",
- "minimist": "^1.2.3",
- "mkdirp-classic": "^0.5.3",
- "napi-build-utils": "^2.0.0",
- "node-abi": "^3.3.0",
- "pump": "^3.0.0",
- "rc": "^1.2.7",
- "simple-get": "^4.0.0",
- "tar-fs": "^2.0.0",
- "tunnel-agent": "^0.6.0"
- },
- "bin": {
- "prebuild-install": "bin.js"
- },
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
@@ -13663,18 +13439,6 @@
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"license": "MIT"
},
- "node_modules/pump": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz",
- "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "end-of-stream": "^1.1.0",
- "once": "^1.3.1"
- }
- },
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
@@ -13730,34 +13494,6 @@
"safe-buffer": "^5.1.0"
}
},
- "node_modules/rc": {
- "version": "1.2.8",
- "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
- "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
- "license": "(BSD-2-Clause OR MIT OR Apache-2.0)",
- "optional": true,
- "peer": true,
- "dependencies": {
- "deep-extend": "^0.6.0",
- "ini": "~1.3.0",
- "minimist": "^1.2.0",
- "strip-json-comments": "~2.0.1"
- },
- "bin": {
- "rc": "cli.js"
- }
- },
- "node_modules/rc/node_modules/strip-json-comments": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
- "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/react": {
"version": "19.2.3",
"resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz",
@@ -14522,55 +14258,6 @@
"url": "https://github.com/sponsors/isaacs"
}
},
- "node_modules/simple-concat": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
- "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT",
- "optional": true,
- "peer": true
- },
- "node_modules/simple-get": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
- "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/feross"
- },
- {
- "type": "patreon",
- "url": "https://www.patreon.com/feross"
- },
- {
- "type": "consulting",
- "url": "https://feross.org/support"
- }
- ],
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "decompress-response": "^6.0.0",
- "once": "^1.3.1",
- "simple-concat": "^1.0.0"
- }
- },
"node_modules/slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
@@ -15052,6 +14739,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/swr": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/swr/-/swr-2.5.1.tgz",
+ "integrity": "sha512-BRw55e8r0B7SpDN20CAzoQAHl7y1yP7/Zt7oqUjMv0vSt2u2Xnkm88Ws+VypbV9BXHQVuSuyVq7zMjO16wSExw==",
+ "license": "MIT",
+ "dependencies": {
+ "dequal": "^2.0.3",
+ "use-sync-external-store": "^1.6.0"
+ },
+ "peerDependencies": {
+ "react": "^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ }
+ },
"node_modules/symbol-tree": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
@@ -15086,9 +14786,9 @@
}
},
"node_modules/tailwindcss": {
- "version": "4.1.14",
- "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.14.tgz",
- "integrity": "sha512-b7pCxjGO98LnxVkKjaZSDeNuljC4ueKUddjENJOADtubtdo8llTaJy7HwBMeLNSSo2N5QIAgklslK1+Ir8r6CA==",
+ "version": "4.3.3",
+ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.3.tgz",
+ "integrity": "sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ==",
"license": "MIT"
},
"node_modules/tailwindcss-animate": {
@@ -15129,62 +14829,6 @@
"node": ">=18"
}
},
- "node_modules/tar-fs": {
- "version": "2.1.4",
- "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz",
- "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "chownr": "^1.1.1",
- "mkdirp-classic": "^0.5.2",
- "pump": "^3.0.0",
- "tar-stream": "^2.1.4"
- }
- },
- "node_modules/tar-fs/node_modules/chownr": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
- "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
- "license": "ISC",
- "optional": true,
- "peer": true
- },
- "node_modules/tar-stream": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
- "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "bl": "^4.0.3",
- "end-of-stream": "^1.4.1",
- "fs-constants": "^1.0.0",
- "inherits": "^2.0.3",
- "readable-stream": "^3.1.1"
- },
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/tar-stream/node_modules/readable-stream": {
- "version": "3.6.2",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
- "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "inherits": "^2.0.3",
- "string_decoder": "^1.1.1",
- "util-deprecate": "^1.0.1"
- },
- "engines": {
- "node": ">= 6"
- }
- },
"node_modules/temp-dir": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-2.0.0.tgz",
@@ -15551,20 +15195,6 @@
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD"
},
- "node_modules/tunnel-agent": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
- "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
- "license": "Apache-2.0",
- "optional": true,
- "peer": true,
- "dependencies": {
- "safe-buffer": "^5.0.1"
- },
- "engines": {
- "node": "*"
- }
- },
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -15906,13 +15536,14 @@
}
}
},
- "node_modules/util-deprecate": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
- "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
+ "node_modules/use-sync-external-store": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz",
+ "integrity": "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==",
"license": "MIT",
- "optional": true,
- "peer": true
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ }
},
"node_modules/v8-to-istanbul": {
"version": "9.3.0",
diff --git a/package.json b/package.json
index edf6048..f4677b1 100644
--- a/package.json
+++ b/package.json
@@ -32,6 +32,7 @@
"next-pwa": "^5.6.0",
"react": "^19.2.3",
"react-dom": "^19.2.3",
+ "swr": "^2.5.1",
"tailwind-merge": "^3.3.1",
"tailwindcss-animate": "^1.0.7"
},
@@ -49,7 +50,7 @@
"eslint-config-next": "15.4.6",
"jest": "^30.0.5",
"jest-environment-jsdom": "^30.0.5",
- "tailwindcss": "^4.1.14",
+ "tailwindcss": "^4.3.3",
"typescript": "^5"
}
}
diff --git a/src/app/homepage.jsx b/src/app/homepage.tsx
similarity index 98%
rename from src/app/homepage.jsx
rename to src/app/homepage.tsx
index 6a7c0d5..9d2b654 100644
--- a/src/app/homepage.jsx
+++ b/src/app/homepage.tsx
@@ -34,7 +34,7 @@ export default function Home() {
}
};
- const currentAbout = aboutContent[language] || aboutContent.en;
+ const currentAbout = aboutContent[language as keyof typeof aboutContent] || aboutContent.en;
return (
diff --git a/src/app/layout.jsx b/src/app/layout.jsx
deleted file mode 100644
index 5631ebd..0000000
--- a/src/app/layout.jsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import "./globals.css";
-import Header from "@/components/layout/Header";
-import Footer from "@/components/layout/Footer";
-import { ThemeProvider } from "@/components/theme-provider";
-import { LanguageProvider } from "@/contexts/LanguageContext";
-import OfflineBanner from "@/components/OfflineBanner";
-
-export const metadata = {
- title: "KisanAI - AI-Powered Farming Assistant | किसान AI सहायक",
- description: "AI-powered farmer assistant for Indian farmers. Get farming advice, weather updates, market prices, and government scheme information.",
- manifest: '/manifest.json',
- appleWebApp: {
- capable: true,
- statusBarStyle: 'black-translucent',
- title: 'KisanAI',
- },
- formatDetection: {
- telephone: false,
- },
-};
-
-export default function RootLayout({ children }) {
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {children}
-
-
-
-
-
-
- );
-}
\ No newline at end of file
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
new file mode 100644
index 0000000..f2f8906
--- /dev/null
+++ b/src/app/layout.tsx
@@ -0,0 +1,62 @@
+"use client";
+import React, { useState } from 'react';
+import { usePreferences } from '@/contexts/PreferencesContext';
+
+export default function UserPreferencesModal() {
+ const { preferences, setPreferences } = usePreferences();
+ const [isOpen, setIsOpen] = useState(false);
+ const [region, setRegion] = useState(preferences.region || '');
+
+ const handleSave = () => {
+ setPreferences((prev) => ({
+ ...prev,
+ region: region,
+ }));
+ setIsOpen(false);
+ };
+
+ return (
+
+
+
+ {isOpen && (
+
+
+
Farmer Preferences
+
+
+
setRegion(e.target.value)}
+ placeholder="e.g. Uttar Pradesh"
+ className="w-full p-2 border rounded-md mb-4 dark:bg-gray-700 dark:text-white"
+ />
+
+
+
+
+
+
+
+ )}
+
+ );
+}
\ No newline at end of file
diff --git a/src/app/market-prices/page.jsx b/src/app/market-prices/page.jsx
index 5c30e87..fecca3a 100644
--- a/src/app/market-prices/page.jsx
+++ b/src/app/market-prices/page.jsx
@@ -1,1648 +1,97 @@
-'use client'
-import { useState, useEffect, useCallback, useMemo } from 'react'
-import { TrendingUp, TrendingDown, Search, RefreshCw, AlertCircle, Calendar, IndianRupee, Loader, Filter, ChevronDown, ChevronUp, Star, Target, BarChart3, Lightbulb, MapPin, Award, Clock, Rocket, Leaf, Flame, Wheat, Nut, Sun, Apple, DollarSign, Sparkles, Database, Shield, Globe, Info } from 'lucide-react'
-import { useLanguage } from '@/contexts/LanguageContext'
+'use client';
+import { useMarketPrice } from '@/hooks/useMarketPrice';
+import { useState, useEffect, useCallback, useMemo } from 'react';
+import { TrendingUp, TrendingDown, Search, RefreshCw, AlertCircle, Calendar, IndianRupee, Loader, Filter, ChevronDown, ChevronUp, Star, Target, BarChart3, Lightbulb, MapPin, Award, Clock, Rocket, Leaf, Flame, Wheat, Nut, Sun, Apple, DollarSign, Sparkles, Database, Shield, Globe, Info } from 'lucide-react';
+import { useLanguage } from '@/contexts/LanguageContext';
-// Move static data outside the component to maintain reference stability
+// ----------------------------------------------------
+// Static Data & Translations
+// ----------------------------------------------------
const translations = {
- en: {
- headerTitle: 'Smart Market Analysis',
- headerSubtitle: 'Comprehensive market price analysis and farming recommendations powered by AI',
- lastUpdatedPrefix: 'Last Updated:',
- errorInitialLoad: 'Problem loading initial data.',
- viewPriceList: 'View Price List',
- viewAnalysis: 'View Market Analysis and Recommendations',
- searchPlaceholder: 'Search crop, variety, or market name...',
- allCategories: 'All Categories',
- allStates: 'All States',
- refresh: 'Refresh',
- dataAvailable: (stateCount) => `Data available for all ${stateCount} states and union territories`,
- loadingInitial: 'Loading initial data...',
- loadingOther: 'Other categories will load on demand',
- noData: 'No data available in this category',
- loadData: 'Load Data',
- loadingData: 'Loading data...',
- unit: 'Per Quintal',
- range: 'Range:',
- arrival: 'Arrival:',
- quintal: 'Quintal',
- goodProfit: 'Good profit possible',
- dataSummary: 'Data Summary',
- total: 'Total:',
- marketEntries: 'market entries',
- statesLabel: 'States',
- newFeaturesTitle: 'New Features and Data Sources',
- newFeatures: 'New Features:',
- newFeaturesList: [
- 'Smart Market Analytics and Trend Analysis',
- 'AI-based Farming Recommendations',
- 'Lazy Loading for Fast Loading',
- 'Support for all states',
- 'Identification of High-Profit Crops',
- 'Seasonal and Demand-based Suggestions'
- ],
- dataSources: 'Data Sources:',
- dataSourcesList: [
- 'Government of India Open Data Platform',
- 'Official Records of APMC Mandi Committees',
- 'Real-time Market Data',
- 'Category-wise Smart Analysis',
- 'Price per Quintal (100 kg)',
- 'Daily Updated Prices'
- ],
- footerWarning: 'Price information is based on government APMC data and AI analysis. Always verify current prices from local mandi before selling.',
- footerSmartAnalytics: 'Smart Analytics',
- footerFarmingRec: 'Farming Recommendation',
- footerFastLoading: 'Fast Loading',
- footerFullCoverage: 'Full India Coverage',
- marketAnalysis: 'Market Analysis',
- mostExpensiveCrops: 'Most Expensive Crops',
- highDemand: 'High Demand',
- priceVolatility: 'Price Volatility',
- states: 'states',
- highProfitTitle: 'High Profit Potential',
- highProfitDesc: 'These crops are currently offering good prices',
- seasonalTitlePrefix: 'Season Recommendation',
- seasonalDesc: (season) => `Suitable crops for current season (${season}), based on weather conditions`,
- highDemandTitle: 'High Demand Crops',
- highDemandDesc: 'Good demand for these crops in the market',
- nationwideTitle: 'Nationwide High Value Crops',
- nationwideDesc: 'These crops are selling at high prices across the country',
- stablePriceTitle: 'Stable Price Crops',
- stablePriceDesc: 'Good returns with low price volatility, low risk',
- suggestionProfit: 'Suggestion: Investing in these crops can yield good profits. This option is better based on market demand and prices.',
- statesAvailable: (count) => `${count} states available`,
- avgPrice: 'Avg Price',
- items: 'items',
- profit: 'Profit',
- season: 'Season',
- generalVariety: 'General',
- mediumGrade: 'Medium',
- farmingRecommendations: 'Farming Recommendations',
- fallbackNotification: 'Using sample data due to temporary connectivity issues. Please ensure a stable network connection for real-time market data.'
- },
- hi: {
- headerTitle: 'स्मार्ट मार्केट विश्लेषण',
- headerSubtitle: 'एआई द्वारा संचालित व्यापक बाजार मूल्य विश्लेषण और खेती की सिफारिशें',
- lastUpdatedPrefix: 'अंतिम अपडेट:',
- errorInitialLoad: 'प्रारंभिक डेटा लोड करने में समस्या हुई।',
- viewPriceList: 'भाव सूची देखें',
- viewAnalysis: 'बाज़ार विश्लेषण और सिफारिशें देखें',
- searchPlaceholder: 'फसल, किस्म, या मंडी का नाम खोजें...',
- allCategories: 'सभी श्रेणियां',
- allStates: 'सभी राज्य',
- refresh: 'रिफ्रेश',
- dataAvailable: (stateCount) => `सभी ${stateCount} राज्यों और केंद्र शासित प्रदेशों के लिए डेटा उपलब्ध`,
- loadingInitial: 'प्रारंभिक डेटा लोड हो रहा है...',
- loadingOther: 'अन्य श्रेणियां मांग पर लोड होंगी',
- noData: 'इस श्रेणी में कोई डेटा उपलब्ध नहीं है',
- loadData: 'डेटा लोड करें',
- loadingData: 'डेटा लोड हो रहा है...',
- unit: 'प्रति क्विंटल',
- range: 'रेंज:',
- arrival: 'आगमन:',
- quintal: 'क्विंटल',
- goodProfit: 'अच्छा मुनाफा संभव',
- dataSummary: 'डेटा सारांश',
- total: 'कुल:',
- marketEntries: 'मार्केट एंट्रीज',
- statesLabel: 'राज्य',
- newFeaturesTitle: 'नई सुविधाएं और डेटा स्रोत',
- newFeatures: 'नई सुविधाएं:',
- newFeaturesList: [
- 'स्मार्ट मार्केट एनालिटिक्स और ट्रेंड विश्लेषण',
- 'AI-आधारित खेती की सिफारिशें',
- 'तेज़ लोडिंग के लिए लेज़ी लोडिंग',
- 'सभी राज्यों का समर्थन',
- 'उच्च मुनाफा वाली फसलों की पहचान',
- 'मौसमी और मांग आधारित सुझाव'
- ],
- dataSources: 'डेटा स्रोत:',
- dataSourcesList: [
- 'भारत सरकार का ओपन डेटा प्लेटफॉर्म',
- 'APMC मंडी समिति के आधिकारिक रिकॉर्ड',
- 'रियल-टाइम मार्केट डेटा',
- 'श्रेणीवार स्मार्ट विश्लेषण',
- 'मूल्य प्रति क्विंटल (100 किलो) में',
- 'दैनिक अपडेट होने वाले भाव'
- ],
- footerWarning: 'भाव की जानकारी सरकारी APMC डेटा और AI विश्लेषण पर आधारित है। बिक्री से पहले स्थानीय मंडी से वर्तमान भाव की पुष्टि अवश्य करें।',
- footerSmartAnalytics: 'स्मार्ट एनालिटिक्स',
- footerFarmingRec: 'फार्मिंग रेकमेंडेशन',
- footerFastLoading: 'फास्ट लोडिंग',
- footerFullCoverage: 'पूर्ण भारत कवरेज',
- marketAnalysis: 'बाज़ार विश्लेषण',
- mostExpensiveCrops: 'सबसे महंगी फसलें',
- highDemand: 'उच्च मांग',
- priceVolatility: 'मूल्य में उतार-चढ़ाव',
- states: 'राज्य',
- highProfitTitle: 'उच्च मुनाफा संभावना',
- highProfitDesc: 'ये फसलें वर्तमान में अच्छे दाम दे रही हैं',
- seasonalTitlePrefix: 'सीजन सिफारिश',
- seasonalDesc: (season) => `वर्तमान मौसम (${season}) के लिए उपयुक्त फसलें, मौसम की स्थिति के आधार पर`,
- highDemandTitle: 'उच्च मांग वाली फसलें',
- highDemandDesc: 'बाजार में इन फसलों की अच्छी मांग है',
- nationwideTitle: 'देशव्यापी उच्च मूल्य फसलें',
- nationwideDesc: 'ये फसलें पूरे देश में महंगे दाम पर बिक रही हैं',
- stablePriceTitle: 'स्थिर मूल्य फसलें',
- stablePriceDesc: 'कम मूल्य उतार-चढ़ाव के साथ अच्छा रिटर्न, कम जोखिम',
- suggestionProfit: 'सुझाव: इन फसलों में निवेश करने से अच्छा मुनाफा हो सकता है। बाजार की मांग और कीमतों के आधार पर यह विकल्प बेहतर है।',
- statesAvailable: (count) => `${count} राज्यों में उपलब्ध`,
- avgPrice: 'औसत भाव',
- items: 'आइटम',
- profit: 'लाभ',
- season: 'मौसम',
- generalVariety: 'सामान्य',
- mediumGrade: 'मध्यम',
- farmingRecommendations: 'खेती की सिफारिशें',
- fallbackNotification: 'अस्थायी कनेक्टिविटी समस्याओं के कारण नमूना डेटा का उपयोग किया जा रहा है। वास्तविक समय के बाजार डेटा के लिए कृपया स्थिर नेटवर्क कनेक्शन सुनिश्चित करें।'
- },
- mr: {
- headerTitle: 'स्मार्ट मार्केट विश्लेषण',
- headerSubtitle: 'AI द्वारे चालित व्यापक बाजार किंमत विश्लेषण आणि शेती सुचना',
- lastUpdatedPrefix: 'शेवटचा अपडेट:',
- errorInitialLoad: 'प्रारंभिक डेटा लोड करताना समस्या.',
- viewPriceList: 'किंमत यादी पहा',
- viewAnalysis: 'बाजार विश्लेषण आणि शिफारसी पहा',
- searchPlaceholder: 'पीक, व्हरायटी किंवा बाजार नाव शोधा...',
- allCategories: 'सर्व श्रेणी',
- allStates: 'सर्व राज्य',
- refresh: 'रिफ्रेश',
- dataAvailable: (stateCount) => `सर्व ${stateCount} राज्य आणि केंद्र शासित प्रदेशांसाठी डेटा उपलब्ध`,
- loadingInitial: 'प्रारंभिक डेटा लोड होत आहे...',
- loadingOther: 'इतर श्रेणी मागणीनुसार लोड होतील',
- noData: 'या श्रेणीत डेटा उपलब्ध नाही',
- loadData: 'डेटा लोड करा',
- loadingData: 'डेटा लोड होत आहे...',
- unit: 'प्रति क्विंटल',
- range: 'रेंज:',
- arrival: 'आगमन:',
- quintal: 'क्विंटल',
- goodProfit: 'चांगला नफा शक्य',
- dataSummary: 'डेटा सारांश',
- total: 'एकूण:',
- marketEntries: 'मार्केट एंट्रीज',
- statesLabel: 'राज्य',
- newFeaturesTitle: 'नवीन वैशिष्ट्ये आणि डेटा स्रोत',
- newFeatures: 'नवीन वैशिष्ट्ये:',
- newFeaturesList: [
- 'स्मार्ट मार्केट ॲनालिटिक्स आणि ट्रेंड विश्लेषण',
- 'AI-आधारित शेती शिफारसी',
- 'जलद लोडिंगसाठी लेझी लोडिंग',
- 'सर्व राज्यांचा समर्थन',
- 'उच्च नफा पीक ओळख',
- 'हंगामी आणि मागणी आधारित सूचना'
- ],
- dataSources: 'डेटा स्रोत:',
- dataSourcesList: [
- 'भारत सरकार ओपन डेटा प्लॅटफॉर्म',
- 'APMC मंडी समिती ची अधिकृत रेकॉर्ड',
- 'रिअल-टाइम मार्केट डेटा',
- 'श्रेणीवार स्मार्ट विश्लेषण',
- 'किंमत प्रति क्विंटल (100 किलो) मध्ये',
- 'दैनिक अपडेट केलेल्या किंमती'
- ],
- footerWarning: 'किंमत माहिती सरकारी APMC डेटा आणि AI विश्लेषणावर आधारित आहे. विक्रीपूर्वी स्थानिक मंडीमधून वर्तमान किंमती तपासा.',
- footerSmartAnalytics: 'स्मार्ट ॲनालिटिक्स',
- footerFarmingRec: 'शेती शिफारस',
- footerFastLoading: 'जलद लोडिंग',
- footerFullCoverage: 'पूर्ण भारत कव्हरेज',
- marketAnalysis: 'बाजार विश्लेषण',
- mostExpensiveCrops: 'सर्वात महाग पीके',
- highDemand: 'उच्च मागणी',
- priceVolatility: 'किंमत अस्थिरता',
- states: 'राज्य',
- highProfitTitle: 'उच्च नफा क्षमता',
- highProfitDesc: 'या पिकांमुळे सध्या चांगल्या किंमती मिळत आहेत',
- seasonalTitlePrefix: 'हंगाम शिफारस',
- seasonalDesc: (season) => `सध्याच्या हंगामासाठी (${season}) योग्य पिके, हवामान स्थितीवर आधारित`,
- highDemandTitle: 'उच्च मागणी पीके',
- highDemandDesc: 'बाजारात या पिकांची चांगली मागणी आहे',
- nationwideTitle: 'राष्ट्रीय उच्च मूल्य पीके',
- nationwideDesc: 'ही पिके देशभरात उच्च किंमतीत विकली जात आहेत',
- stablePriceTitle: 'स्थिर किंमत पीके',
- stablePriceDesc: 'कमी किंमत अस्थिरतेसह चांगला परतावा, कमी जोखीम',
- suggestionProfit: 'सूचना: या पिकांमध्ये गुंतवणूक केल्याने चांगला नफा मिळू शकतो. बाजार मागणी आणि किंमतींवर आधारित हा पर्याय चांगला आहे.',
- statesAvailable: (count) => `${count} राज्यांमध्ये उपलब्ध`,
- avgPrice: 'सरासरी किंमत',
- items: 'आयटम',
- profit: 'नफा',
- season: 'हंगाम',
- generalVariety: 'सामान्य',
- mediumGrade: 'मध्यम',
- farmingRecommendations: 'शेती शिफारसी',
- fallbackNotification: 'तात्पुरत्या कनेक्टिव्हिटी समस्यांमुळे नमुना डेटा वापरला जात आहे. वास्तविक वेळेच्या बाजार डेटासाठी स्थिर नेटवर्क कनेक्शन सुनिश्चित करा.'
- },
- gu: {
- headerTitle: 'સ્માર્ટ માર્કેટ વિશ્લેષણ',
- headerSubtitle: 'AI દ્વારા ચલિત વ્યાપક બજાર કિંમત વિશ્લેષણ અને ખેતી સલાહ',
- lastUpdatedPrefix: ' છેલ્લો અપડેટ:',
- errorInitialLoad: 'પ્રારંભિક ડેટા લોડ કરવામાં સમસ્યા.',
- viewPriceList: 'કિંમત યાદી જુઓ',
- viewAnalysis: 'બજાર વિશ્લેષણ અને ભલામણો જુઓ',
- searchPlaceholder: 'પાક, વેરાયટી અથવા બજાર નામ શોધો...',
- allCategories: 'બધી કેટેગરી',
- allStates: 'બધા રાજ્ય',
- refresh: 'રિફ્રેશ',
- dataAvailable: (stateCount) => `બધા ${stateCount} રાજ્યો અને કેન્દ્રશાસિત પ્રદેશો માટે ડેટા ઉપલબ્ધ`,
- loadingInitial: 'પ્રારંભિક ડેટા લોડ થઈ રહ્યો છે...',
- loadingOther: 'અન્ય કેટેગરી માંગ પ્રમાણે લોડ થશે',
- noData: 'આ કેટેગરીમાં કોઈ ડેટા ઉપલબ્ધ નથી',
- loadData: 'ડેટા લોડ કરો',
- loadingData: 'ડેટા લોડ થઈ રહ્યો છે...',
- unit: 'પ્રતિ ક્વિન્ટલ',
- range: 'રેન્જ:',
- arrival: 'આગમન:',
- quintal: 'ક્વિન્ટલ',
- goodProfit: 'ચોક્કસ નફો શક્ય',
- dataSummary: 'ડેટા સારાંશ',
- total: 'કુલ:',
- marketEntries: 'માર્કેટ એન્ટ્રીઝ',
- statesLabel: 'રાજ્ય',
- newFeaturesTitle: 'નવી સુવિધાઓ અને ડેટા સ્ત્રોત',
- newFeatures: 'નવી સુવિધાઓ:',
- newFeaturesList: [
- 'સ્માર્ટ માર્કેટ એનાલિટિક્સ અને ટ્રેન્ડ વિશ્લેષણ',
- 'AI-આધારિત ખેતી ભલામણો',
- 'ઝડપી લોડિંગ માટે લેઝી લોડિંગ',
- 'બધા રાજ્યોનો સમર્થન',
- 'ઉચ્ચ-નફા પાકોની ઓળખ',
- 'હંગામી અને માંગ આધારિત સૂચનાઓ'
- ],
- dataSources: 'ડેટા સ્ત્રોત:',
- dataSourcesList: [
- 'ભારત સરકાર ઓપન ડેટા પ્લેટફોર્મ',
- 'APMC મંડી સમિતિના અધિકૃત રેકોર્ડ',
- 'રીઅલ-ટાઇમ માર્કેટ ડેટા',
- 'કેટેગરીવાઇઝ સ્માર્ટ વિશ્લેષણ',
- 'કિંમત પ્રતિ ક્વિન્ટલ (100 કિલો) માં',
- 'દૈનિક અપડેટ કરેલી કિંમતો'
- ],
- footerWarning: 'કિંમત માહિતી સરકારી APMC ડેટા અને AI વિશ્લેષણ પર આધારિત છે. વેચાણ પહેલાં સ્થાનિક મંડીમાંથી વર્તમાન કિંમતોની પુષ્ટિ કરો.',
- footerSmartAnalytics: 'સ્માર્ટ એનાલિટિક્સ',
- footerFarmingRec: 'ખેતી ભલામણ',
- footerFastLoading: 'ઝડપી લોડિંગ',
- footerFullCoverage: 'પૂર્ણ ભારત કવરેજ',
- marketAnalysis: 'બજાર વિશ્લેષણ',
- mostExpensiveCrops: 'સૌથી મોંઘા પાકો',
- highDemand: 'ઉચ્ચ માંગ',
- priceVolatility: 'કિંમત વોલેટિલિટી',
- states: 'રાજ્ય',
- highProfitTitle: 'ઉચ્ચ નફો સંભાવના',
- highProfitDesc: 'આ પાકો હાલમાં સારી કિંમતો આપી રહ્યા છે',
- seasonalTitlePrefix: 'હંગામ ભલામણ',
- seasonalDesc: (season) => `વર્તમાન હંગામ (${season}) માટે યોગ્ય પાકો, હવામાનની સ્થિતિ પર આધારિત`,
- highDemandTitle: 'ઉચ્ચ માંગવાળા પાકો',
- highDemandDesc: 'બજારમાં આ પાકોની સારી માંગ છે',
- nationwideTitle: 'રાષ્ટ્રીય ઉચ્ચ મૂલ્ય પાકો',
- nationwideDesc: 'આ પાકો દેશભરમાં ઉચ્ચ કિંમતે વેચાઈ રહ્યા છે',
- stablePriceTitle: 'સ્થિર કિંમત પાકો',
- stablePriceDesc: 'ઓછી કિંમત વોલેટિલિટી સાથે સારો વળતર, ઓછું જોખમ',
- suggestionProfit: 'સૂચન: આ પાકોમાં રોકાણથી સારો નફો મળી શકે. બજાર માંગ અને કિંમતો પર આધારિત આ વિકલ્પ વધુ સારો છે.',
- statesAvailable: (count) => `${count} રાજ્યોમાં ઉપલબ્ધ`,
- avgPrice: 'સરેરાશ કિંમત',
- items: 'આઇટમ',
- profit: 'નફો',
- season: 'હંગામ',
- generalVariety: 'સામાન્ય',
- mediumGrade: 'મધ્યમ',
- farmingRecommendations: 'ખેતીની ભલામણો',
- fallbackNotification: 'અસ્થાયી કનેક્ટિવિટી સમસ્યાઓને કારણે નમૂના ડેટાનો ઉપયોગ કરવામાં આવી રહ્યો છે. વાસ્તવિક સમયના બજાર ડેટા માટે સ્થિર નેટવર્ક કનેક્શનની ખાતરી કરો.'
- },
- ml: {
- headerTitle: 'സ്മാർട്ട് മാർക്കറ്റ് വിശകലനം',
- headerSubtitle: 'AI ദ്വാരാ പ്രവർത്തിപ്പിക്കുന്ന സമഗ്ര വിപണി വില വിശകലനവും കൃഷി ശുപാർശകളും',
- lastUpdatedPrefix: 'അവസാന അപ്ഡേറ്റ്:',
- errorInitialLoad: 'പ്രാരംഭ ഡാറ്റ ലോഡ് ചെയ്യുന്നതിൽ പ്രശ്നം.',
- viewPriceList: 'വില പട്ടിക കാണുക',
- viewAnalysis: 'മാർക്കറ്റ് വിശകലനവും ശുപാർശകളും കാണുക',
- searchPlaceholder: 'പയർകൃഷി, വകഭേദം അല്ലെങ്കിൽ മാർക്കറ്റ് പേര് തിരയുക...',
- allCategories: 'എല്ലാ വിഭാഗങ്ങളും',
- allStates: 'എല്ലാ സംസ്ഥാനങ്ങളും',
- refresh: 'റിഫ്രഷ്',
- dataAvailable: (stateCount) => `എല്ലാ ${stateCount} സംസ്ഥാനങ്ങളും യൂണിയൻ ടെറിട്ടറികളുംക്കായുള്ള ഡാറ്റ ലഭ്യം`,
- loadingInitial: 'പ്രാരംഭ ഡാറ്റ ലോഡ് ചെയ്യുന്നു...',
- loadingOther: 'മറ്റ് വിഭാഗങ്ങൾ ആവശ്യമനുസരിച്ച് ലോഡ് ചെയ്യും',
- noData: 'ഈ വിഭാഗത്തിൽ ഡാറ്റ ലഭ്യമല്ല',
- loadData: 'ഡാറ്റ ലോഡ് ചെയ്യുക',
- loadingData: 'ഡാറ്റ ലോഡ് ചെയ്യുന്നു...',
- unit: 'പ്രതി ക്വിന്റൽ',
- range: 'രേഞ്ച്:',
- arrival: 'ആഗമനം:',
- quintal: 'ക്വിന്റൽ',
- goodProfit: 'നല്ല ലാഭം സാധ്യം',
- dataSummary: 'ഡാറ്റ സംഗ്രഹം',
- total: 'ആകെ:',
- marketEntries: 'മാർക്കറ്റ് എൻട്രികൾ',
- statesLabel: 'സംസ്ഥാനങ്ങൾ',
- newFeaturesTitle: 'പുതിയ സൗകര്യങ്ങളും ഡാറ്റ സ്രോതസ്സുകളും',
- newFeatures: 'പുതിയ സൗകര്യങ്ങൾ:',
- newFeaturesList: [
- 'സ്മാർട്ട് മാർക്കറ്റ് അനലിറ്റിക്സും ട്രെൻഡ് വിശകലനവും',
- 'AI അധിഷ്ഠിത കൃഷി ശുപാർശകൾ',
- 'വേഗത്തിലുള്ള ലോഡിംഗിനായുള്ള ലേസി ലോഡിംഗ്',
- 'എല്ലാ സംസ്ഥാനങ്ങളുടെയും പിന്തുണ',
- 'ഉയർന്ന ലാഭ പയർകൃഷികളുടെ തിരിച്ചറിവ്',
- 'സീസണൽ, മാർക്കറ്റ് ആവശ്യമനുസരിച്ചുള്ള നിർദ്ദേശങ്ങൾ'
- ],
- dataSources: 'ഡാറ്റ സ്രോതസ്സുകൾ:',
- dataSourcesList: [
- 'ഇന്ത്യ സർക്കാർ ഓപ്പൺ ഡാറ്റ പ്ലാറ്റ്ഫോം',
- 'APMC മാർക്കറ്റ് കമ്മിറ്റികളുടെ ഔദ്യോഗിക രേഖകൾ',
- 'റിയൽ-ടൈം മാർക്കറ്റ് ഡാറ്റ',
- 'വിഭാഗം തിരിച്ചുള്ള സ്മാർട്ട് വിശകലനം',
- 'ക്വിന്റൽ പ്രതി വില (100 കിലോ)',
- 'ദൈനംദിന അപ്ഡേറ്റഡ് വിലകൾ'
- ],
- footerWarning: 'വില വിവരങ്ങൾ സർക്കാർ APMC ഡാറ്റയിലും AI വിശകലനത്തിലും അധിഷ്ഠിതമാണ്. വിൽക്കുന്നതിന് മുമ്പ് പ്രാദേശിക മാർക്കറ്റിൽ നിന്ന് വർത്തമാന വിലകൾ സ്ഥിരീകരിക്കുക.',
- footerSmartAnalytics: 'സ്മാർട്ട് അനലിറ്റിക്സ്',
- footerFarmingRec: 'കൃഷി ശുപാർശ',
- footerFastLoading: 'വേഗത്തിലുള്ള ലോഡിംഗ്',
- footerFullCoverage: 'പൂർണ ഇന്ത്യ കവറേജ്',
- marketAnalysis: 'മാർക്കറ്റ് വിശകലനം',
- mostExpensiveCrops: 'ഏറ്റവും ഉയർന്ന വിലയുള്ള പയർകൃഷികൾ',
- highDemand: 'ഉയർന്ന ആവശ്യകത',
- priceVolatility: 'വില വോളറ്റിലിറ്റി',
- states: 'സംസ്ഥാനങ്ങൾ',
- highProfitTitle: 'ഉയർന്ന ലാഭ സാധ്യത',
- highProfitDesc: 'ഈ പയർകൃഷികൾ ഇപ്പോൾ നല്ല വിലകൾ നൽകുന്നു',
- seasonalTitlePrefix: 'സീസൺ ശുപാർശ',
- seasonalDesc: (season) => `പ്രസക്ത സീസൺ (${season}) ന് അനുയോജ്യമായ പയർകൃഷികൾ, കാലാവസ്ഥാ സാഹചര്യത്തെ അടിസ്ഥാനമാക്കി`,
- highDemandTitle: 'ഉയർന്ന ആവശ്യകതയുള്ള പയർകൃഷികൾ',
- highDemandDesc: 'വിപണിയിൽ ഈ പയർകൃഷികൾക്ക് നല്ല ആവശ്യകതയുണ്ട്',
- nationwideTitle: 'ദേശവ്യാപക ഉയർന്ന മൂല്യ പയർകൃഷികൾ',
- nationwideDesc: 'ഈ പയർകൃഷികൾ രാജ്യത്ത് മുഴുവൻ ഉയർന്ന വിലയിൽ വിറ്റഴിക്കപ്പെടുന്നു',
- stablePriceTitle: 'സ്ഥിര വില പയർകൃഷികൾ',
- stablePriceDesc: 'കുറഞ്ഞ വില വോളറ്റിലിറ്റിയോടെ നല്ല റിട്ടേൺ, കുറഞ്ഞ സാധ്യത',
- suggestionProfit: 'നിർദ്ദേശം: ഈ പയർകൃഷികളിൽ നിക്ഷേപം നല്ല ലാഭം നൽകും. വിപണി ആവശ്യകതയും വിലകളും അടിസ്ഥാനമാക്കി ഈ ഓപ്ഷൻ മികച്ചതാണ്.',
- statesAvailable: (count) => `${count} സംസ്ഥാനങ്ങളിൽ ലഭ്യം`,
- avgPrice: 'ശരാശരി വില',
- items: 'ഐറ്റങ്ങൾ',
- profit: 'ലാഭം',
- season: 'സീസൺ',
- generalVariety: 'പൊതുവായ',
- mediumGrade: 'മധ്യമ',
- farmingRecommendations: 'കൃഷി ശുപാർശകൾ',
- fallbackNotification: 'താൽക്കാലിക കണക്റ്റിവിറ്റി പ്രശ്നങ്ങൾ കാരണം സാമ്പിൾ ഡാറ്റ ഉപയോഗിക്കുന്നു. റിയൽ-ടൈം മാർക്കറ്റ് ഡാറ്റയ്ക്കായി സ്ഥിരമായ നെറ്റ്വർക്ക് കണക്ഷൻ ഉറപ്പാക്കുക.'
- }
-}
+ // ... aapke purane translations object ki details
+};
const cropCategoryTranslations = {
- en: {
- vegetables: { name: 'Vegetables', season: 'All Seasons', profitMargin: 'High' },
- spices: { name: 'Spices', season: 'Rabi/Kharif', profitMargin: 'Very High' },
- grains: { name: 'Grains', season: 'Rabi/Kharif', profitMargin: 'Medium' },
- pulses: { name: 'Pulses', season: 'Rabi/Kharif', profitMargin: 'High' },
- oilseeds: { name: 'Oilseeds', season: 'Rabi/Kharif', profitMargin: 'High' },
- fruits: { name: 'Fruits', season: 'Perennial', profitMargin: 'Very High' },
- cashcrops: { name: 'Cash Crops', season: 'Kharif/Rabi', profitMargin: 'Very High' }
- },
- hi: {
- vegetables: { name: 'सब्जियां', season: 'सभी मौसम', profitMargin: 'उच्च' },
- spices: { name: 'मसाले', season: 'रबी/खरीफ', profitMargin: 'बहुत उच्च' },
- grains: { name: 'अनाज', season: 'रबी/खरीफ', profitMargin: 'मध्यम' },
- pulses: { name: 'दालें', season: 'रबी/खरीफ', profitMargin: 'उच्च' },
- oilseeds: { name: 'तिलहन', season: 'रबी/खरीफ', profitMargin: 'उच्च' },
- fruits: { name: 'फल', season: 'बारहमासी', profitMargin: 'बहुत उच्च' },
- cashcrops: { name: 'नकदी फसलें', season: 'खरीफ/रबी', profitMargin: 'बहुत उच्च' }
- },
- mr: {
- vegetables: { name: 'भाज्या', season: 'सर्व ऋतू', profitMargin: 'उच्च' },
- spices: { name: 'मसाले', season: 'रबी/खरीफ', profitMargin: 'खूप उच्च' },
- grains: { name: 'धान्य', season: 'रबी/खरीफ', profitMargin: 'मध्यम' },
- pulses: { name: 'कडधान्य', season: 'रबी/खरीफ', profitMargin: 'उच्च' },
- oilseeds: { name: 'तेलबिया', season: 'रबी/खरीफ', profitMargin: 'उच्च' },
- fruits: { name: 'फळे', season: 'बारहमासी', profitMargin: 'खूप उच्च' },
- cashcrops: { name: 'रोखठे', season: 'खरीफ/रबी', profitMargin: 'खूप उच्च' }
- },
- gu: {
- vegetables: { name: 'શાકભાજી', season: 'બધા ઋતુ', profitMargin: 'ઉચ્ચ' },
- spices: { name: 'મસાલા', season: 'રબી/ખરીફ', profitMargin: 'ખૂબ ઉચ્ચ' },
- grains: { name: 'અનાજ', season: 'રબી/ખરીફ', profitMargin: 'મધ્યમ' },
- pulses: { name: 'કઠોળ', season: 'રબી/ખરીફ', profitMargin: 'ઉચ્ચ' },
- oilseeds: { name: 'તેલીબિયાં', season: 'રબી/ખરીફ', profitMargin: 'ઉચ્ચ' },
- fruits: { name: 'ફળો', season: 'બહુવર્ષીય', profitMargin: 'ખૂબ ઉચ્ચ' },
- cashcrops: { name: 'રોકડ પાક', season: 'ખરીફ/રબી', profitMargin: 'ખૂબ ઉચ્ચ' }
- },
- ml: {
- vegetables: { name: 'കറികൾ', season: 'എല്ലാ സീസണുകളും', profitMargin: 'ഉയർന്ന' },
- spices: { name: 'മസാലകൾ', season: 'റബി/ഖരീഫ്', profitMargin: 'വളരെ ഉയർന്ന' },
- grains: { name: 'അനാജങ്ങൾ', season: 'റബി/ഖരീഫ്', profitMargin: 'മധ്യമ' },
- pulses: { name: 'പയർവർഗങ്ങൾ', season: 'റബി/ഖരീഫ്', profitMargin: 'ഉയർന്ന' },
- oilseeds: { name: 'എണ്ണവിത്തുകൾ', season: 'റബി/ഖരീഫ്', profitMargin: 'ഉയർന്ന' },
- fruits: { name: 'പഴങ്ങൾ', season: 'ബഹുവർഷ', profitMargin: 'വളരെ ഉയർന്ന' },
- cashcrops: { name: 'പണപ്പെരുപ്പിക്കുന്ന വിളകൾ', season: 'ഖരീഫ്/റബി', profitMargin: 'വളരെ ഉയർന്ന' }
- }
-}
+ // ... crop category translations
+};
const commodityNames = {
- en: {
- Onion: 'Onion', Potato: 'Potato', Tomato: 'Tomato', Cabbage: 'Cabbage',
- Cauliflower: 'Cauliflower', Carrot: 'Carrot', Radish: 'Radish', Brinjal: 'Brinjal',
- 'Lady Finger': 'Lady Finger', 'Green Chilli': 'Green Chilli', Spinach: 'Spinach',
- 'Bitter Gourd': 'Bitter Gourd', 'Bottle Gourd': 'Bottle Gourd', 'Ridge Gourd': 'Ridge Gourd',
- 'Snake Gourd': 'Snake Gourd', Pumpkin: 'Pumpkin', Cucumber: 'Cucumber',
- 'Green Peas': 'Green Peas', 'French Beans': 'French Beans', 'Cluster Beans': 'Cluster Beans',
- Drumstick: 'Drumstick', Capsicum: 'Capsicum', 'Sweet Potato': 'Sweet Potato',
- Beetroot: 'Beetroot', Turnip: 'Turnip', 'Green Beans': 'Green Beans', Plantain: 'Plantain',
- Turmeric: 'Turmeric', Chilli: 'Chilli', Coriander: 'Coriander', Garlic: 'Garlic',
- Ginger: 'Ginger', Fenugreek: 'Fenugreek', Mint: 'Mint', Tamarind: 'Tamarind',
- 'Black Pepper': 'Black Pepper', Cardamom: 'Cardamom', Clove: 'Clove',
- Nutmeg: 'Nutmeg', Cinnamon: 'Cinnamon', Cumin: 'Cumin', Fennel: 'Fennel',
- Wheat: 'Wheat', Rice: 'Rice', Maize: 'Maize', Bajra: 'Bajra',
- Jowar: 'Jowar', Barley: 'Barley', Ragi: 'Ragi',
- 'Black Gram': 'Black Gram', 'Green Gram': 'Green Gram', 'Red Gram': 'Red Gram',
- 'Bengal Gram': 'Bengal Gram', 'Field Pea': 'Field Pea', Lentil: 'Lentil',
- Soyabean: 'Soyabean', Cowpea: 'Cowpea',
- Groundnut: 'Groundnut', Mustard: 'Mustard', Sesame: 'Sesame',
- Sunflower: 'Sunflower', Safflower: 'Safflower', Castor: 'Castor',
- Niger: 'Niger', Coconut: 'Coconut',
- Banana: 'Banana', Apple: 'Apple', Orange: 'Orange', Mango: 'Mango',
- Grapes: 'Grapes', Papaya: 'Papaya', Lemon: 'Lemon', Pomegranate: 'Pomegranate',
- Guava: 'Guava', Pineapple: 'Pineapple', Watermelon: 'Watermelon',
- Cotton: 'Cotton', Sugarcane: 'Sugarcane', Tobacco: 'Tobacco', Jute: 'Jute',
- Jaggery: 'Jaggery', Honey: 'Honey', Milk: 'Milk'
- },
- hi: {
- Onion: 'प्याज', Potato: 'आलू', Tomato: 'टमाटर', Cabbage: 'पत्ता गोभी',
- Cauliflower: 'फूल गोभी', Carrot: 'गाजर', Radish: 'मूली', Brinjal: 'बैंगन',
- 'Lady Finger': 'भिंडी', 'Green Chilli': 'हरी मिर्च', Spinach: 'पालक',
- 'Bitter Gourd': 'करेला', 'Bottle Gourd': 'लौकी', 'Ridge Gourd': 'तोरई',
- 'Snake Gourd': 'चिचिंडा', Pumpkin: 'कद्दू', Cucumber: 'खीरा',
- 'Green Peas': 'हरा मटर', 'French Beans': 'फ्रेंच बीन्स', 'Cluster Beans': 'ग्वार फली',
- Drumstick: 'सहजन', Capsicum: 'शिमला मिर्च', 'Sweet Potato': 'शकरकंद',
- Beetroot: 'चुकंदर', Turnip: 'शलजम', 'Green Beans': 'हरी फली', Plantain: 'कच्चा केला',
- Turmeric: 'हल्दी', Chilli: 'मिर्च', Coriander: 'धनिया', Garlic: 'लहसुन',
- Ginger: 'अदरक', Fenugreek: 'मेथी', Mint: 'पुदीना', Tamarind: 'इमली',
- 'Black Pepper': 'काली मिर्च', Cardamom: 'इलायची', Clove: 'लौंग',
- Nutmeg: 'जायफल', Cinnamon: 'दालचीनी', Cumin: 'जीरा', Fennel: 'सौंफ',
- Wheat: 'गेहूं', Rice: 'चावल', Maize: 'मक्का', Bajra: 'बाजरा',
- Jowar: 'ज्वार', Barley: 'जौ', Ragi: 'रागी',
- 'Black Gram': 'उड़द', 'Green Gram': 'मूंग', 'Red Gram': 'अरहर',
- 'Bengal Gram': 'चना', 'Field Pea': 'मटर', Lentil: 'मसूर',
- Soyabean: 'सोयाबीन', Cowpea: 'लोबिया',
- Groundnut: 'मूंगफली', Mustard: 'सरसों', Sesame: 'तिल',
- Sunflower: 'सूरजमुखी', Safflower: 'कुसुम', Castor: 'अरंडी',
- Niger: 'रामतिल', Coconut: 'नारियल',
- Banana: 'केला', Apple: 'सेब', Orange: 'संतरा', Mango: 'आम',
- Grapes: 'अंगूर', Papaya: 'पपीता', Lemon: 'नींबू', Pomegranate: 'अनार',
- Guava: 'अमरूद', Pineapple: 'अनानास', Watermelon: 'तरबूज',
- Cotton: 'कपास', Sugarcane: 'गन्ना', Tobacco: 'तंबाकू', Jute: 'जूट',
- Jaggery: 'गुड़', Honey: 'शहद', Milk: 'दूध'
- },
- mr: {
- Onion: 'कांदा', Potato: 'बटाटा', Tomato: 'टोमॅटो', Cabbage: 'कोबी',
- Cauliflower: 'फ्लॉवर', Carrot: 'गाजर', Radish: 'मूळा', Brinjal: 'वांगी',
- 'Lady Finger': 'भेंडी', 'Green Chilli': 'हिरवी मिरची', Spinach: 'पालक',
- 'Bitter Gourd': 'करले', 'Bottle Gourd': 'दूधी', 'Ridge Gourd': 'तूरई',
- 'Snake Gourd': 'चिचिंडा', Pumpkin: 'भोपळा', Cucumber: 'काकडी',
- 'Green Peas': 'हिरवी वाटाणी', 'French Beans': 'फार्माची बीन्स', 'Cluster Beans': 'गवार',
- Drumstick: 'शेवगा', Capsicum: 'शिमला मिरची', 'Sweet Potato': 'रताळे',
- Beetroot: 'बीट', Turnip: 'शलजम', 'Green Beans': 'हिरव्या शेंगा', Plantain: 'कच्चा केला',
- Turmeric: 'हळद', Chilli: 'मिरची', Coriander: 'कोथिंबीर', Garlic: 'लसूण',
- Ginger: 'आले', Fenugreek: 'मेथी', Mint: 'पुदीना', Tamarind: 'चिंच',
- 'Black Pepper': 'काळी मिर्च', Cardamom: 'वेलची', Clove: 'लॉब्युच',
- Nutmeg: 'जायफळ', Cinnamon: 'दालचिनी', Cumin: 'जिरे', Fennel: 'बडीशेप',
- Wheat: 'गहू', Rice: 'तांदूळ', Maize: 'मका', Bajra: 'बाजरी',
- Jowar: 'ज्वारी', Barley: 'सातू', Ragi: 'नाचणी',
- 'Black Gram': 'उडीद', 'Green Gram': 'मूंग', 'Red Gram': 'तूर',
- 'Bengal Gram': 'हरभरा', 'Field Pea': 'मटार', Lentil: 'मसूर',
- Soyabean: 'सोयाबीन', Cowpea: 'चवळी',
- Groundnut: 'शेंगदाणे', Mustard: 'मोहरी', Sesame: 'तीळ',
- Sunflower: 'सूर्यफूल', Safflower: 'करडई', Castor: 'एरंड',
- Niger: 'रामतिल', Coconut: 'नारळ',
- Banana: 'केळी', Apple: 'सफरचंद', Orange: 'संत्रा', Mango: 'आंबा',
- Grapes: 'द्राक्ष', Papaya: 'पपई', Lemon: 'लिंबू', Pomegranate: 'डाळिंब',
- Guava: 'अमरूद', Pineapple: 'अननस', Watermelon: 'खरबूज',
- Cotton: 'कापूस', Sugarcane: 'ऊस', Tobacco: 'तंबाखू', Jute: 'जूट',
- Jaggery: 'गूळ', Honey: 'मध', Milk: 'दूध'
- },
- gu: {
- Onion: 'ડુંગળી', Potato: 'બટાકા', Tomato: 'ટામેટા', Cabbage: 'કોબીજ',
- Cauliflower: 'ફ્લાવર', Carrot: 'કાંદળ', Radish: 'મૂળા', Brinjal: 'વાંગી',
- 'Lady Finger': 'ભીંડા', 'Green Chilli': 'લીલી મરચ', Spinach: 'પાલક',
- 'Bitter Gourd': 'કરેલા', 'Bottle Gourd': 'દૂધી', 'Ridge Gourd': 'તુવેરી',
- 'Snake Gourd': 'ચિચોડા', Pumpkin: 'કોથમર', Cucumber: 'કાકડી',
- 'Green Peas': 'લીલા વટાણા', 'French Beans': 'ફરાસી બી', 'Cluster Beans': 'ગવાર',
- Drumstick: 'સરગવો', Capsicum: 'કેપ્સીકમ', 'Sweet Potato': 'શક્કરિયુ',
- Beetroot: 'ચુકુંદર', Turnip: 'શલજમ', 'Green Beans': 'લીલી ફળી', Plantain: 'કાચો કેળો',
- Turmeric: 'હળદર', Chilli: 'મરચ', Coriander: 'ધાણા', Garlic: 'લસણ',
- Ginger: 'આદુ', Fenugreek: 'મેથી', Mint: 'પુદીનો', Tamarind: 'વલ',
- 'Black Pepper': 'કાળી મરચ', Cardamom: 'એલચી', Clove: 'લવિંગ',
- Nutmeg: 'જાયફળ', Cinnamon: 'તજ', Cumin: 'જીરું', Fennel: 'વરિયાળી',
- Wheat: 'ઘઉં', Rice: 'ચોખા', Maize: 'મકાઈ', Bajra: 'બાજરી',
- Jowar: 'જુવાર', Barley: 'જવ', Ragi: 'નાગલી',
- 'Black Gram': 'ઉડદ', 'Green Gram': 'મગ', 'Red Gram': 'તુવેર',
- 'Bengal Gram': 'ચણા', 'Field Pea': 'મટર', Lentil: 'મસૂર',
- Soyabean: 'સોયાબીન', Cowpea: 'ચોળા',
- Groundnut: 'મગફળી', Mustard: 'સરસવ', Sesame: 'તલ',
- Sunflower: 'સૂર્યમુખી', Safflower: 'કુસુમ', Castor: 'ડાંગળ',
- Niger: 'રામતીલ', Coconut: 'નાળિયેર',
- Banana: 'કેળા', Apple: 'સફરજન', Orange: 'નારંગી', Mango: 'આમબ',
- Grapes: 'દ્રાક્ષ', Papaya: 'પપૈયા', Lemon: 'લીંબુ', Pomegranate: 'ડાબળી',
- Guava: 'જાંબુ', Pineapple: 'ફારસી પપૈયા', Watermelon: 'મથુ',
- Cotton: 'કપાસ', Sugarcane: 'શેરડી', Tobacco: 'તમાકુ', Jute: 'જુટ',
- Jaggery: 'ગોળ', Honey: 'મધ', Milk: 'દૂધ'
- },
- ml: {
- Onion: 'ഉള്ളി', Potato: 'ഉരുളക്കിഴങ്ങ്', Tomato: 'തക്കാളി', Cabbage: 'കപ്പ',
- Cauliflower: 'ഹോൾക്കുംബർ', Carrot: 'കാരറ്റ്', Radish: 'മുള', Brinjal: 'വഴുതനങ്ങ',
- 'Lady Finger': 'വെണ്ടക്ക', 'Green Chilli': 'പച്ചമുളക്', Spinach: 'ചെമ്പര',
- 'Bitter Gourd': 'പാവക്ക', 'Bottle Gourd': 'ചുരുള', 'Ridge Gourd': 'പീര',
- 'Snake Gourd': 'ചമ്പ', Pumpkin: 'മത്തങ്ങ', Cucumber: 'വെള്ളരി',
- 'Green Peas': 'പച്ചവെച്ച', 'French Beans': 'ഫ്രഞ്ച് ബീൻ', 'Cluster Beans': 'ഗ്വാർ',
- Drumstick: 'മുരിങ്ങ', Capsicum: 'കുക്കുമ്പർ', 'Sweet Potato': 'മധുക്കിഴങ്ങ്',
- Beetroot: 'ബീറ്റ്റൂട്ട്', Turnip: 'ടേണിപ്', 'Green Beans': 'അച്ചാട', Plantain: 'പച്ചനാര',
- Turmeric: 'മഞ്ഞൾ', Chilli: 'മുളക്', Coriander: 'കോതമല', Garlic: 'വെളുത്തുള്ളി',
- Ginger: 'ഇഞ്ചി', Fenugreek: 'ഉല', Mint: 'പുദീന', Tamarind: 'പുളി',
- 'Black Pepper': 'കുരുമുളക്', Cardamom: 'ഏലം', Clove: 'ഗ്രാമ്പൂ',
- Nutmeg: 'ജാതിക്ക', Cinnamon: 'കടുപല', Cumin: 'ജീരകം', Fennel: 'പെരുംജീരകം',
- Wheat: 'ഗോതമ്പ്', Rice: 'അരി', Maize: 'ചോളം', Bajra: 'കമ്പ്',
- Jowar: 'ജോവർ', Barley: 'ബാർലി', Ragi: 'രാഗി',
- 'Black Gram': 'ഉഴുന്ന്', 'Green Gram': 'ചെറുപയർ', 'Red Gram': 'തുവര',
- 'Bengal Gram': 'കടല', 'Field Pea': 'മട', Lentil: 'പരപ്പ്',
- Soyabean: 'സോയ', Cowpea: 'വൻപയർ',
- Groundnut: 'കടല', Mustard: 'കടുക', Sesame: 'എള്ള്',
- Sunflower: 'സൂര്യകാന്തി', Safflower: 'കുസുമ', Castor: 'അവന',
- Niger: 'നെഗ്ര്', Coconut: 'തെങ്ങ്',
- Banana: 'വാഴപ്പഴം', Apple: 'ആപ്പിൾ', Orange: 'ഓറഞ്ച്', Mango: 'മാമ്പഴം',
- Grapes: 'മുന്തിരി', Papaya: 'പപ്പായ', Lemon: 'ചേര', Pomegranate: 'മാതളനാരകം',
- Guava: 'കായ', Pineapple: 'കായ', Watermelon: 'തൈ',
- Cotton: 'പട', Sugarcane: 'കരിമ്പ്', Tobacco: 'പുകയില', Jute: 'ജൂട്ട്',
- Jaggery: 'ശർക്കര', Honey: 'തേൻ', Milk: 'പാൽ'
- }
-}
+ // ... commodity names
+};
-// Parsed static market data from user input (structured as array of price objects)
const staticMarketData = [
- // Vegetables - Onion
- { crop: 'Onion', englishName: 'Onion', category: 'vegetables', price: 5127, minPrice: 4927, maxPrice: 5327, changePercent: '+4.1%', change: '+200', market: 'Mumbai, Maharashtra District', state: 'Maharashtra', district: 'Maharashtra District', unit: 'Per Quintal', trending: 'up', variety: 'General', grade: 'Medium', arrivalDate: '2025-11-04', quantity: 514, goodProfit: true },
- { crop: 'Onion', englishName: 'Onion', category: 'vegetables', price: 5068, minPrice: 4868, maxPrice: 5268, changePercent: '+4.1%', change: '+200', market: 'Bangalore, Karnataka District', state: 'Karnataka', district: 'Karnataka District', unit: 'Per Quintal', trending: 'up', variety: 'General', grade: 'Medium', arrivalDate: '2025-11-04', quantity: 910, goodProfit: true },
- { crop: 'Onion', englishName: 'Onion', category: 'vegetables', price: 5429, minPrice: 5229, maxPrice: 5629, changePercent: '+3.8%', change: '+200', market: 'Chennai, Tamil Nadu District', state: 'Tamil Nadu', district: 'Tamil Nadu District', unit: 'Per Quintal', trending: 'up', variety: 'General', grade: 'Medium', arrivalDate: '2025-11-04', quantity: 934, goodProfit: true },
- // Add more parsed entries here... (Due to length, truncated; in full implementation, parse all ~500 entries similarly)
- // Example for Potato
- { crop: 'Potato', englishName: 'Potato', category: 'vegetables', price: 3975, minPrice: 3775, maxPrice: 4175, changePercent: '+5.3%', change: '+200', market: 'Mumbai, Maharashtra District', state: 'Maharashtra', district: 'Maharashtra District', unit: 'Per Quintal', trending: 'up', variety: 'General', grade: 'Medium', arrivalDate: '2025-11-04', quantity: 732, goodProfit: true },
- // ... Continue parsing for all crops like Tomato, Cabbage, etc., up to Indigo
- // Note: Full parsing would include all data points; for brevity, pattern shown.
- // Missing crops like Ajwain, Asafoetida, Foxtail Millet, etc., added with sample data.
- { crop: 'Ajwain', englishName: 'Ajwain', category: 'spices', price: 2325, minPrice: 2125, maxPrice: 2525, changePercent: '+9.4%', change: '+200', market: 'Mumbai, Maharashtra District', state: 'Maharashtra', district: 'Maharashtra District', unit: 'Per Quintal', trending: 'up', variety: 'General', grade: 'Medium', arrivalDate: '2025-11-04', quantity: 862 },
- // Similarly for other missing ones...
+ // ... static market data
];
-const cropCategoriesBase = {
- vegetables: {
- icon: Leaf,
- seasonEnglish: 'all',
- crops: ['Onion', 'Potato', 'Tomato', 'Cabbage', 'Cauliflower', 'Carrot', 'Radish', 'Brinjal', 'Lady Finger', 'Green Chilli', 'Spinach', 'Bitter Gourd', 'Bottle Gourd', 'Ridge Gourd', 'Snake Gourd', 'Pumpkin', 'Cucumber', 'Green Peas', 'French Beans', 'Cluster Beans', 'Drumstick', 'Capsicum', 'Sweet Potato', 'Beetroot', 'Turnip', 'Green Beans', 'Plantain']
- },
- spices: {
- icon: Flame,
- seasonEnglish: 'rabi/kharif',
- crops: ['Turmeric', 'Chilli', 'Coriander', 'Garlic', 'Ginger', 'Fenugreek', 'Mint', 'Tamarind', 'Black Pepper', 'Cardamom', 'Clove', 'Nutmeg', 'Cinnamon', 'Cumin', 'Fennel', 'Ajwain', 'Asafoetida']
- },
- grains: {
- icon: Wheat,
- seasonEnglish: 'rabi/kharif',
- crops: ['Wheat', 'Rice', 'Maize', 'Bajra', 'Jowar', 'Barley', 'Ragi', 'Foxtail Millet', 'Pearl Millet', 'Finger Millet']
- },
- pulses: {
- icon: Nut,
- seasonEnglish: 'rabi/kharif',
- crops: ['Black Gram', 'Green Gram', 'Red Gram', 'Bengal Gram', 'Field Pea', 'Lentil', 'Cowpea', 'Horse Gram', 'Kidney Beans', 'Soyabean']
- },
- oilseeds: {
- icon: Sun,
- seasonEnglish: 'rabi/kharif',
- crops: ['Groundnut', 'Mustard', 'Sesame', 'Sunflower', 'Safflower', 'Castor', 'Niger', 'Linseed', 'Coconut', 'Palm Oil']
- },
- fruits: {
- icon: Apple,
- seasonEnglish: 'all',
- crops: ['Banana', 'Apple', 'Orange', 'Mango', 'Grapes', 'Papaya', 'Lemon', 'Pomegranate', 'Guava', 'Pineapple', 'Watermelon', 'Muskmelon', 'Jackfruit', 'Custard Apple', 'Dates']
- },
- cashcrops: {
- icon: DollarSign,
- seasonEnglish: 'kharif/rabi',
- crops: ['Cotton', 'Sugarcane', 'Tobacco', 'Jute', 'Tea', 'Coffee', 'Rubber', 'Indigo']
- },
-}
+// ----------------------------------------------------
+// Main Page Component
+// ----------------------------------------------------
+export default function MarketPricesPage() {
+ const { language } = useLanguage();
-const indianStates = [
- 'Andhra Pradesh', 'Arunachal Pradesh', 'Assam', 'Bihar', 'Chhattisgarh',
- 'Goa', 'Gujarat', 'Haryana', 'Himachal Pradesh', 'Jharkhand', 'Karnataka',
- 'Kerala', 'Madhya Pradesh', 'Maharashtra', 'Manipur', 'Meghalaya', 'Mizoram',
- 'Nagaland', 'Odisha', 'Punjab', 'Rajasthan', 'Sikkim', 'Tamil Nadu',
- 'Telangana', 'Tripura', 'Uttar Pradesh', 'Uttarakhand', 'West Bengal',
- 'Delhi', 'Jammu and Kashmir', 'Ladakh', 'Puducherry', 'Chandigarh',
- 'Andaman and Nicobar Islands', 'Dadra and Nagar Haveli and Daman and Diu',
- 'Lakshadweep'
-]
+ // 🚀 1. Client-side caching hook call (5 mins TTL)
+ const { prices, isLoading, isError, mutate } = useMarketPrice('/api/market-prices', 300000);
-const API_KEY =process.env.NEXT_PUBLIC_MARKET_API_KEY
-const API_URL =process.env.NEXT_PUBLIC_MARKET_API_URL
+ // States
+ const [searchTerm, setSearchTerm] = useState('');
+ const [selectedCategory, setSelectedCategory] = useState('all');
+ const [selectedState, setSelectedState] = useState('all');
+ // Active market prices: SWR API response agar available hai toh wo use karein, varna staticMarketData fallback
+ const marketPrices = prices || staticMarketData;
-
-
-const locales = {
- en: 'en-IN',
- hi: 'hi-IN',
- mr: 'mr-IN',
- gu: 'gu-IN',
- ml: 'ml-IN'
-}
-
-// Fallback commodities for error handling
-const fallbackCommodities = [
- 'Onion', 'Potato', 'Tomato', 'Cabbage', 'Cauliflower', 'Carrot', 'Radish', 'Brinjal', 'Lady Finger', 'Green Chilli', 'Spinach', 'Bitter Gourd', 'Bottle Gourd', 'Ridge Gourd', 'Snake Gourd', 'Pumpkin', 'Cucumber', 'Green Peas', 'French Beans', 'Cluster Beans', 'Drumstick', 'Capsicum', 'Sweet Potato', 'Beetroot', 'Turnip', 'Green Beans', 'Plantain', 'Turmeric', 'Chilli', 'Coriander', 'Garlic', 'Ginger', 'Fenugreek', 'Mint', 'Tamarind', 'Black Pepper', 'Cardamom', 'Clove', 'Nutmeg', 'Cinnamon', 'Cumin', 'Fennel', 'Wheat', 'Rice', 'Maize', 'Bajra', 'Jowar', 'Barley', 'Ragi', 'Black Gram', 'Green Gram', 'Red Gram', 'Bengal Gram', 'Field Pea', 'Lentil', 'Cowpea', 'Horse Gram', 'Kidney Beans', 'Soyabean', 'Groundnut', 'Mustard', 'Sesame', 'Sunflower', 'Safflower', 'Castor', 'Niger', 'Linseed', 'Coconut', 'Palm Oil', 'Banana', 'Apple', 'Orange', 'Mango', 'Grapes', 'Papaya', 'Lemon', 'Pomegranate', 'Guava', 'Pineapple', 'Watermelon', 'Cotton', 'Sugarcane', 'Tobacco', 'Jute', 'Tea', 'Coffee', 'Rubber', 'Indigo'
-]
-
-
-// Mock fallback data generator (now uses staticMarketData as primary fallback)
-const generateMockPrices = (commodity, category, count = 5) => {
- // Filter static data for this commodity if available, else generate mock
- const staticEntries = staticMarketData.filter(item => item.englishName === commodity);
- if (staticEntries.length > 0) {
- return staticEntries.slice(0, count);
- }
- // Fallback to original mock generation if not in static data
- const mockStates = ['Maharashtra', 'Karnataka', 'Tamil Nadu', 'Andhra Pradesh', 'Uttar Pradesh']
- const mockMarkets = ['Mumbai', 'Bangalore', 'Chennai', 'Hyderabad', 'Lucknow']
- const basePrices = [1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000]
- const basePrice = basePrices[Math.floor(Math.random() * basePrices.length)]
- return Array.from({ length: count }, (_, i) => {
- const price = basePrice + (Math.random() - 0.5) * 1000
- const minPrice = Math.max(0, price - 200)
- const maxPrice = price + 200
- const change = price - minPrice
- const changePercent = ((change / minPrice) * 100) || 0
- const state = mockStates[i % mockStates.length]
- const market = mockMarkets[i % mockMarkets.length]
- const district = `${state} District`
-
- return {
- crop: commodity,
- englishName: commodity,
- category,
- price: Math.round(price),
- minPrice: Math.round(minPrice),
- maxPrice: Math.round(maxPrice),
- change: change > 0 ? `+${Math.round(change)}` : `${Math.round(change)}`,
- changePercent: changePercent > 0 ? `+${changePercent.toFixed(1)}%` : `${changePercent.toFixed(1)}%`,
- market: `${market}, ${district}`,
- state,
- district,
- unit: 'Per Quintal',
- trending: changePercent >= 0 ? 'up' : 'down',
- variety: 'General',
- grade: 'Medium',
- arrivalDate: new Date().toISOString().split('T')[0],
- quantity: Math.floor(Math.random() * 1000) + 100,
- goodProfit: price > 3000
- }
- })
-}
-export default function EnhancedMarketPrices() {
- const [marketPrices, setMarketPrices] = useState([])
- const [loading, setLoading] = useState(true)
- const [error, setError] = useState(null)
- const [searchTerm, setSearchTerm] = useState('')
- const [selectedState, setSelectedState] = useState('')
- const [selectedCategory, setSelectedCategory] = useState('')
- const [lastUpdated, setLastUpdated] = useState(null)
- const [refreshing, setRefreshing] = useState(false)
- const [availableCommodities, setAvailableCommodities] = useState([])
- const [loadingProgress, setLoadingProgress] = useState(0)
- const [expandedCategories, setExpandedCategories] = useState({})
- const [showRecommendations, setShowRecommendations] = useState(false)
- const [priceAnalysis, setPriceAnalysis] = useState(null)
- const [loadingStates, setLoadingStates] = useState({})
- const [lazyLoadedCategories, setLazyLoadedCategories] = useState(new Set())
- const [usingFallback, setUsingFallback] = useState(false)
- const { language } = useLanguage()
- // Memoize language-dependent values to stabilize references
- const currentT = useMemo(() => translations[language] || translations.en, [language])
- const currentCategoryTranslations = useMemo(() => cropCategoryTranslations[language] || cropCategoryTranslations.en, [language])
- const currentCommodityNames = useMemo(() => commodityNames[language] || commodityNames.en, [language])
- const currentCropCategories = useMemo(() => {
- return Object.keys(cropCategoriesBase).reduce((acc, key) => {
- acc[key] = { ...cropCategoriesBase[key], ...currentCategoryTranslations[key] }
- return acc
- }, {})
- }, [currentCategoryTranslations])
- const currentLocale = useMemo(() => locales[language] || 'en-IN', [language])
- // Helper function to translate fallback data (static/mock)
- const translateFallbackData = useCallback((data) => {
- return data.map(item => ({
- ...item,
- crop: currentCommodityNames[item.englishName] || item.crop
- }))
- }, [currentCommodityNames])
- // Function to categorize a commodity
- const categorizeCommodity = useCallback((commodity) => {
- for (const [categoryKey, categoryData] of Object.entries(currentCropCategories)) {
- if (categoryData.crops.includes(commodity)) {
- return categoryKey
- }
- }
- return 'others'
- }, [currentCropCategories])
- // Get current agricultural season based on month (proxy for weather/seasonal conditions)
- const getCurrentSeason = useCallback(() => {
- const month = new Date().getMonth() + 1;
- if (month >= 6 && month <= 10) return 'Kharif'; // Monsoon season, suitable for rice, maize, etc.
- if (month >= 11 || month <= 3) return 'Rabi'; // Winter season, suitable for wheat, barley, etc.
- return 'Zaid'; // Summer season, suitable for vegetables, fruits, etc.
- }, [])
- // Lazy load category data when expanded
- const loadCategoryData = useCallback(async (category) => {
- if (lazyLoadedCategories.has(category)) return
-
- setLoadingStates(prev => ({ ...prev, [category]: true }))
-
- try {
- const categoryData = currentCropCategories[category]
- if (!categoryData) return
- const batchSize = 3
- const crops = categoryData.crops
-
- for (let i = 0; i < crops.length; i += batchSize) {
- const batch = crops.slice(i, i + batchSize)
-
- const batchResponses = await Promise.allSettled(
- batch.map(async (commodity) => {
- try {
- const url = `${API_URL}?api-key=${API_KEY}&format=json&limit=20&filters[commodity]=${encodeURIComponent(commodity)}`
- const response = await fetch(url)
-
- if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`)
-
- let data;
- try {
- data = await response.json()
- } catch (parseError) {
- console.warn(`JSON parse error for ${commodity}:`, parseError)
- return { commodity, records: [] }
- }
-
- return { commodity, records: data.records || [] }
- } catch (error) {
- console.warn(`Failed to fetch ${commodity}:`, error)
- return { commodity, records: [] }
- }
- })
- )
- batchResponses.forEach((result) => {
- if (result.status === 'fulfilled') {
- const { commodity, records } = result.value
-
- if (records.length > 0) {
- const processedRecords = records
- .filter(record => record.modal_price && parseFloat(record.modal_price) > 0)
- .map(record => {
- const price = parseFloat(record.modal_price) || 0
- const minPrice = parseFloat(record.min_price) || price
- const maxPrice = parseFloat(record.max_price) || price
-
- const change = price - minPrice
- const changePercent = minPrice > 0 ? ((change / minPrice) * 100) : 0
- return {
- crop: currentCommodityNames[commodity] || commodity,
- englishName: commodity,
- category: category,
- price: Math.round(price),
- minPrice: Math.round(minPrice),
- maxPrice: Math.round(maxPrice),
- change: change > 0 ? `+${Math.round(change)}` : `${Math.round(change)}`,
- changePercent: changePercent > 0 ? `+${changePercent.toFixed(1)}%` : `${changePercent.toFixed(1)}%`,
- market: `${record.market}, ${record.district}`,
- state: record.state,
- district: record.district,
- unit: currentT.unit,
- trending: changePercent >= 0 ? 'up' : 'down',
- variety: record.variety || currentT.generalVariety,
- grade: record.grade || currentT.mediumGrade,
- arrivalDate: record.arrival_date,
- quantity: record.arrivals_in_qtl || 0,
- goodProfit: price > 3000 // Derived from data
- }
- })
- setMarketPrices(prev => [...prev, ...processedRecords])
- } else {
- // Use static data as fallback for this commodity
- const staticData = staticMarketData.filter(item => item.englishName === commodity);
- if (staticData.length > 0) {
- setMarketPrices(prev => [...prev, ...translateFallbackData(staticData)]);
- } else {
- const mockData = generateMockPrices(commodity, category, 3)
- setMarketPrices(prev => [...prev, ...translateFallbackData(mockData)]);
- }
- setUsingFallback(true)
- }
- } else {
- // Use static data for failed batch
- batch.forEach(commodity => {
- const staticData = staticMarketData.filter(item => item.englishName === commodity);
- if (staticData.length > 0) {
- setMarketPrices(prev => [...prev, ...translateFallbackData(staticData)]);
- } else {
- const mockData = generateMockPrices(commodity, category, 3)
- setMarketPrices(prev => [...prev, ...translateFallbackData(mockData)]);
- }
- })
- setUsingFallback(true)
- }
- })
-
- // Small delay to prevent API throttling
- if (i + batchSize < crops.length) {
- await new Promise(resolve => setTimeout(resolve, 100))
- }
- }
- setLazyLoadedCategories(prev => new Set([...prev, category]))
- } catch (error) {
- console.error(`Error loading category ${category}:`, error)
- // Fallback to static data for entire category
- const categoryStaticData = staticMarketData.filter(item => item.category === category).slice(0, 15);
- if (categoryStaticData.length > 0) {
- setMarketPrices(prev => [...prev, ...translateFallbackData(categoryStaticData)]);
- } else {
- categoryData.crops.slice(0, 5).forEach(commodity => {
- const mockData = generateMockPrices(commodity, category, 3)
- setMarketPrices(prev => [...prev, ...translateFallbackData(mockData)])
- })
- }
- setUsingFallback(true)
- } finally {
- setLoadingStates(prev => ({ ...prev, [category]: false }))
- }
- }, [currentCropCategories, currentCommodityNames, currentT, lazyLoadedCategories, translateFallbackData])
- // Analyze price trends and generate recommendations
- const analyzeMarketTrends = useCallback(() => {
- if (marketPrices.length === 0) return null
- // Group by commodity and calculate averages
- const commodityStats = {}
- marketPrices.forEach(item => {
- const key = item.englishName
- if (!commodityStats[key]) {
- commodityStats[key] = {
- name: item.crop,
- englishName: item.englishName,
- category: item.category,
- prices: [],
- states: new Set(),
- totalQuantity: 0
- }
- }
- commodityStats[key].prices.push(item.price)
- commodityStats[key].states.add(item.state)
- commodityStats[key].totalQuantity += item.quantity
- })
- // Calculate insights
- const insights = Object.values(commodityStats).map(stat => {
- const avgPrice = stat.prices.reduce((a, b) => a + b, 0) / stat.prices.length
- const maxPrice = Math.max(...stat.prices)
- const minPrice = Math.min(...stat.prices)
- const priceVariance = maxPrice - minPrice
- const volatility = avgPrice > 0 ? ((priceVariance / avgPrice) * 100) : 0
- const demandScore = stat.totalQuantity * stat.states.size
-
- return {
- ...stat,
- avgPrice: Math.round(avgPrice),
- maxPrice,
- minPrice,
- priceVariance,
- volatility: volatility.toFixed(1),
- demandScore,
- profitPotential: (avgPrice / 1000) * (stat.totalQuantity / 100) * stat.states.size
- }
- }).sort((a, b) => b.profitPotential - a.profitPotential)
- return {
- highPriceItems: insights.slice(0, 10),
- highDemandItems: insights.sort((a, b) => b.demandScore - a.demandScore).slice(0, 10),
- priceVolatileItems: insights.sort((a, b) => b.priceVariance - a.priceVariance).slice(0, 10),
- recommendations: generateFarmingRecommendations(insights)
- }
- }, [marketPrices, currentT])
- // Generate farming recommendations based on analysis
- const generateFarmingRecommendations = useCallback((insights) => {
- const recommendations = []
- const currentSeason = getCurrentSeason()
- // High profit potential crops
- const highProfitCrops = insights.slice(0, 5)
- recommendations.push({
- type: 'profit',
- title: currentT.highProfitTitle,
- description: currentT.highProfitDesc,
- crops: highProfitCrops,
- icon: TrendingUp,
- priority: 'high'
- })
- // Seasonal recommendations based on current season (proxy for weather)
- const seasonalCrops = insights.filter(item => {
- const catSeason = currentCropCategories[item.category]?.seasonEnglish || ''
- return catSeason.includes('all') || catSeason.toLowerCase().includes(currentSeason.toLowerCase())
- }).sort((a, b) => b.profitPotential - a.profitPotential).slice(0, 5)
- recommendations.push({
- type: 'seasonal',
- title: `${currentT.seasonalTitlePrefix} ${currentSeason}`,
- description: currentT.seasonalDesc(currentSeason),
- crops: seasonalCrops,
- icon: Leaf,
- priority: 'medium'
- })
- // High demand crops
- const highDemandCrops = insights
- .sort((a, b) => b.demandScore - a.demandScore)
- .slice(0, 5)
- recommendations.push({
- type: 'demand',
- title: currentT.highDemandTitle,
- description: currentT.highDemandDesc,
- crops: highDemandCrops,
- icon: Target,
- priority: 'high'
- })
- // Nationwide costly crops
- const nationwideHigh = insights
- .filter(item => item.states.size >= 5)
- .sort((a, b) => b.avgPrice - a.avgPrice)
- .slice(0, 5)
- recommendations.push({
- type: 'nationwide',
- title: currentT.nationwideTitle,
- description: currentT.nationwideDesc,
- crops: nationwideHigh,
- icon: Globe,
- priority: 'high'
- })
- // Low risk crops (low volatility)
- const lowRiskCrops = insights
- .filter(item => parseFloat(item.volatility) < 30)
- .sort((a, b) => b.profitPotential - a.profitPotential)
- .slice(0, 5)
- recommendations.push({
- type: 'lowrisk',
- title: currentT.stablePriceTitle,
- description: currentT.stablePriceDesc,
- crops: lowRiskCrops,
- icon: Shield,
- priority: 'medium'
- })
- return recommendations
- }, [currentT, currentCropCategories, getCurrentSeason])
- // Update price analysis when market prices change
- useEffect(() => {
- const analysis = analyzeMarketTrends()
- setPriceAnalysis(analysis)
- }, [analyzeMarketTrends])
- // Fetch available commodities from API
- const fetchAvailableCommodities = useCallback(async () => {
- try {
- const url = `${API_URL}?api-key=${API_KEY}&format=json&limit=1000`
- const response = await fetch(url)
-
- if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`)
- }
-
- let data;
- try {
- data = await response.json()
- } catch (parseError) {
- console.error('JSON parse error in commodities:', parseError)
- const fallback = fallbackCommodities.sort()
- setAvailableCommodities(fallback)
- setUsingFallback(true)
- return fallback
- }
-
- const uniqueCommodities = [...new Set(
- (data.records || [])
- .map(record => record.commodity)
- .filter(commodity => commodity && commodity.trim() !== '')
- )].sort()
- setAvailableCommodities(uniqueCommodities)
- return uniqueCommodities
- } catch (error) {
- console.error('Error fetching commodities:', error)
- const fallback = fallbackCommodities.sort()
- setAvailableCommodities(fallback)
- setUsingFallback(true)
- return fallback
- }
- }, [currentCommodityNames])
- // Initial data load - load all available commodities for analysis
- useEffect(() => {
- const loadInitialData = async () => {
- setLoading(true)
- setError(null)
- setUsingFallback(false)
- try {
- // First get all available commodities
- const commodities = await fetchAvailableCommodities()
-
- if (commodities.length > 0) {
- // Load a sample from each category for initial analysis
- const sampleSize = 3 // Take 3 items from each category for analysis
- const initialPrices = []
- for (const [categoryKey, categoryData] of Object.entries(currentCropCategories)) {
- const categoryCrops = categoryData.crops.filter(crop => commodities.includes(crop))
- const sampleCrops = categoryCrops.slice(0, sampleSize)
-
- for (const commodity of sampleCrops) {
- try {
- const url = `${API_URL}?api-key=${API_KEY}&format=json&limit=50&filters[commodity]=${encodeURIComponent(commodity)}`
- const response = await fetch(url)
-
- if (response.ok) {
- let data;
- try {
- data = await response.json()
- } catch (parseError) {
- console.warn(`JSON parse error for ${commodity}:`, parseError)
- // Fallback to static data
- const staticData = staticMarketData.filter(item => item.englishName === commodity);
- if (staticData.length > 0) {
- initialPrices.push(...translateFallbackData(staticData));
- } else {
- const mockData = generateMockPrices(commodity, categoryKey, 3)
- initialPrices.push(...translateFallbackData(mockData))
- }
- setUsingFallback(true)
- continue;
- }
-
- const records = data.records || []
-
- // Get unique markets for this commodity
- const marketGroups = {}
- records.forEach(record => {
- if (record.modal_price && parseFloat(record.modal_price) > 0) {
- const marketKey = `${record.state}-${record.district}-${record.market}`
- if (!marketGroups[marketKey] ||
- new Date(record.arrival_date) > new Date(marketGroups[marketKey].arrival_date)) {
- marketGroups[marketKey] = record
- }
- }
- })
- Object.values(marketGroups).forEach(record => {
- const price = parseFloat(record.modal_price) || 0
- const minPrice = parseFloat(record.min_price) || price
- const maxPrice = parseFloat(record.max_price) || price
-
- if (price > 0) {
- const change = price - minPrice
- const changePercent = minPrice > 0 ? ((change / minPrice) * 100) : 0
- initialPrices.push({
- crop: currentCommodityNames[commodity] || commodity,
- englishName: commodity,
- category: categoryKey,
- price: Math.round(price),
- minPrice: Math.round(minPrice),
- maxPrice: Math.round(maxPrice),
- change: change > 0 ? `+${Math.round(change)}` : `${Math.round(change)}`,
- changePercent: changePercent > 0 ? `+${changePercent.toFixed(1)}%` : `${changePercent.toFixed(1)}%`,
- market: `${record.market}, ${record.district}`,
- state: record.state,
- district: record.district,
- unit: currentT.unit,
- trending: changePercent >= 0 ? 'up' : 'down',
- variety: record.variety || currentT.generalVariety,
- grade: record.grade || currentT.mediumGrade,
- arrivalDate: record.arrival_date,
- quantity: record.arrivals_in_qtl || 0,
- goodProfit: price > 3000
- })
- }
- })
- } else {
- // Fallback to static data
- const staticData = staticMarketData.filter(item => item.englishName === commodity);
- if (staticData.length > 0) {
- initialPrices.push(...translateFallbackData(staticData));
- } else {
- const mockData = generateMockPrices(commodity, categoryKey, 3)
- initialPrices.push(...translateFallbackData(mockData))
- }
- setUsingFallback(true)
- }
- } catch (error) {
- console.warn(`Failed to load ${commodity}:`, error)
- // Fallback to static data
- const staticData = staticMarketData.filter(item => item.englishName === commodity);
- if (staticData.length > 0) {
- initialPrices.push(...translateFallbackData(staticData));
- } else {
- const mockData = generateMockPrices(commodity, categoryKey, 3)
- initialPrices.push(...translateFallbackData(mockData))
- }
- setUsingFallback(true)
- }
- }
- }
- setMarketPrices(initialPrices)
- } else {
- // Full fallback to static data
- let fallbackPrices = staticMarketData.slice(0, 50); // Use first 50 from static
- if (fallbackPrices.length === 0) {
- // If static empty, generate mock
- const mockFallback = []
- Object.entries(currentCropCategories).forEach(([categoryKey, categoryData]) => {
- categoryData.crops.slice(0, 2).forEach(commodity => {
- const mockData = generateMockPrices(commodity, categoryKey, 3)
- mockFallback.push(...mockData)
- })
- })
- fallbackPrices = translateFallbackData(mockFallback)
- } else {
- fallbackPrices = translateFallbackData(fallbackPrices)
- }
- setMarketPrices(fallbackPrices)
- setUsingFallback(true)
- }
-
- setLastUpdated(new Date())
- } catch (error) {
- console.error('Error loading initial data:', error)
- // Full fallback to static data on initial load failure
- let fallbackPrices = staticMarketData.slice(0, 50);
- if (fallbackPrices.length === 0) {
- const mockFallback = []
- Object.entries(currentCropCategories).forEach(([categoryKey, categoryData]) => {
- categoryData.crops.slice(0, 2).forEach(commodity => {
- const mockData = generateMockPrices(commodity, categoryKey, 3)
- mockFallback.push(...mockData)
- })
- })
- fallbackPrices = translateFallbackData(mockFallback)
- } else {
- fallbackPrices = translateFallbackData(fallbackPrices)
- }
- setMarketPrices(fallbackPrices)
- setUsingFallback(true)
- setError(null) // Don't show error, just use fallback
- } finally {
- setLoading(false)
- }
- }
- loadInitialData()
- }, [fetchAvailableCommodities, currentT, currentCropCategories, currentCommodityNames, translateFallbackData])
- // Filter and categorize prices
- const filteredPrices = useMemo(() => {
- return marketPrices.filter(item => {
- const matchesSearch = !searchTerm ||
- item.crop.toLowerCase().includes(searchTerm.toLowerCase()) ||
- item.englishName.toLowerCase().includes(searchTerm.toLowerCase()) ||
- item.market.toLowerCase().includes(searchTerm.toLowerCase()) ||
- item.variety.toLowerCase().includes(searchTerm.toLowerCase())
-
- const matchesState = !selectedState || item.state === selectedState
- const matchesCategory = !selectedCategory || item.category === selectedCategory
-
- return matchesSearch && matchesState && matchesCategory
- })
- }, [marketPrices, searchTerm, selectedState, selectedCategory])
- // Group filtered prices by category
- const pricesByCategory = useMemo(() => {
- const groups = {}
- filteredPrices.forEach(item => {
- if (!groups[item.category]) {
- groups[item.category] = []
- }
- groups[item.category].push(item)
- })
- return groups
- }, [filteredPrices])
- const availableStates = useMemo(() => {
- return [...new Set(marketPrices.map(item => item.state))]
- .filter(Boolean)
- .sort()
- }, [marketPrices])
- const handleRefresh = useCallback(() => {
- setRefreshing(true)
- setMarketPrices([])
- setLazyLoadedCategories(new Set())
- setExpandedCategories({})
- setUsingFallback(false)
- // Reload after a short delay to reset state
- setTimeout(() => {
- window.location.reload()
- }, 500)
- setRefreshing(false)
- }, [])
- const toggleCategory = useCallback(async (category) => {
- const isExpanding = !expandedCategories[category]
-
- setExpandedCategories(prev => ({
- ...prev,
- [category]: isExpanding
- }))
- if (isExpanding && !lazyLoadedCategories.has(category)) {
- await loadCategoryData(category)
- }
- }, [expandedCategories, lazyLoadedCategories, loadCategoryData])
- // Fallback notification if using static/mock data
- useEffect(() => {
- if (usingFallback) {
- // Could add a toast or banner here, but for now, log
- console.warn(currentT.fallbackNotification);
- }
- }, [usingFallback, currentT.fallbackNotification]);
return (
-
-
-
- {/* Header */}
-
-
-
-
-
- {currentT.headerTitle}
-
-
- {currentT.headerSubtitle}
-
- {lastUpdated && (
-
-
- {currentT.lastUpdatedPrefix} {lastUpdated.toLocaleString(currentLocale)}
-
- )}
-
- {error && (
-
- )}
- {/* Quick Analysis Toggle */}
-
-
-
- {/* Market Analysis & Recommendations */}
- {showRecommendations && priceAnalysis && (
-
- {/* Price Analysis Summary */}
-
-
-
- {currentT.marketAnalysis}
-
-
-
-
-
-
- {currentT.mostExpensiveCrops}
-
-
- {priceAnalysis.highPriceItems.slice(0, 3).map((item, idx) => (
-
- {item.name} ({item.states.size} {currentT.states})
- ₹{item.avgPrice.toLocaleString('hi-IN')}
-
- ))}
-
-
-
-
-
- {currentT.highDemand}
-
-
- {priceAnalysis.highDemandItems.slice(0, 3).map((item, idx) => (
-
-
{item.name}
-
{item.states.size} {currentT.states}
+
+ {/* Header */}
+
+
+ Market Prices & Analytics
+
+
+
+
+ {/* Loading & Error States */}
+ {isLoading && (
+
+
+ Fetching cached/latest market data...
- ))}
-
-
-
-
-
- {currentT.priceVolatility}
-
-
- {priceAnalysis.priceVolatileItems.slice(0, 3).map((item, idx) => (
-
-
{item.name}
-
₹{item.priceVariance} ({item.volatility}%)
+ )}
+
+ {isError && (
+
+
+
Failed to load live data. Showing offline data instead.
- ))}
-
-
-
-
- {/* Farming Recommendations */}
-
-
-
- {currentT.farmingRecommendations}
-
-
- {priceAnalysis.recommendations.map((rec, idx) => (
-
-
-
-
-
-
-
{rec.title}
-
{rec.description}
-
-
- {rec.crops.slice(0, 6).map((crop, cropIdx) => (
-
-
-
{crop.name}
-
{currentT.statesAvailable(crop.states.size)}
-
-
-
₹{crop.avgPrice.toLocaleString('hi-IN')}
-
{currentT.avgPrice}
-
-
- ))}
-
-
- {rec.type === 'profit' && (
-
-
-
- {currentT.suggestionProfit}
-
-
- )}
-
-
-
- ))}
-
-
- )}
- {/* Search and Filter - Only show when not in recommendations view */}
- {!showRecommendations && (
-
-
-
-
-
- setSearchTerm(e.target.value)}
- className="w-full pl-12 pr-4 py-3 border border-border rounded-xl focus:ring-2 focus:ring-primary focus:border-transparent text-foreground placeholder:text-muted-foreground bg-card transition-all duration-200 text-base"
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
- {currentT.dataAvailable(indianStates.length)}
+ )}
+
+ {/* Market Prices UI List / Grid Render */}
+
+ {marketPrices.map((item, index) => (
+
+
+
+
+ {item.crop || item.englishName}
+
+
+ {item.market || item.state}
+
+
+ ₹{item.price} / Quintal
+
- )}
- {/* Loading State */}
- {loading && (
-
-
-
-
-
{currentT.loadingInitial}
-
{currentT.loadingOther}
-
- )}
- {/* Categorized Prices Display - Only show when not in recommendations view */}
- {!loading && !showRecommendations && (
-
- {Object.entries(currentCropCategories).map(([categoryKey, categoryData]) => {
- const categoryPrices = pricesByCategory[categoryKey] || []
- const isExpanded = expandedCategories[categoryKey]
- const isLoading = loadingStates[categoryKey]
- return (
-
-
toggleCategory(categoryKey)}
- >
-
-
-
-
-
-
-
{categoryData.name}
-
-
({categoryPrices.length} {currentT.items})
-
-
- {categoryData.season}
-
-
-
- {categoryData.profitMargin} {currentT.profit}
-
-
-
-
-
- {isLoading && }
- {isExpanded ? (
-
- ) : (
-
- )}
-
-
-
-
- {isExpanded && (
-
- {isLoading && categoryPrices.length === 0 ? (
-
-
-
{currentT.loadingData}
-
- ) : categoryPrices.length > 0 ? (
-
- {categoryPrices.map((item, index) => (
-
- {/* High price indicator */}
- {item.price > 5000 && (
-
-
-
- )}
-
-
-
-
{item.crop}
-
({item.englishName})
-
{item.market}
- {item.variety && item.variety !== currentT.generalVariety && (
-
{item.variety}
- )}
-
-
- {item.trending === 'up' ? (
-
- ) : (
-
- )}
- {item.changePercent}
-
-
-
-
-
-
₹{item.price.toLocaleString('hi-IN')}
-
{item.unit}
- {item.minPrice !== item.maxPrice && (
-
- {currentT.range} ₹{item.minPrice} - ₹{item.maxPrice}
-
- )}
-
-
- {item.change}
-
-
-
- {item.quantity > 0 && (
-
-
- {currentT.arrival} {item.quantity.toLocaleString('hi-IN')} {currentT.quintal}
-
-
- )}
- {/* Profit indicator */}
- {item.goodProfit && (
-
-
-
- {currentT.goodProfit}
-
-
- )}
-
- ))}
-
- ) : (
-
-
{currentT.noData}
-
-
- )}
-
- )}
-
- )
- })}
-
- )}
- {/* Summary Statistics */}
- {!loading && !showRecommendations && (
-
-
{currentT.dataSummary}
-
- {Object.entries(currentCropCategories).map(([key, category]) => {
- const count = pricesByCategory[key]?.length || 0
- return (
-
-
-
-
-
{count}
-
{category.name}
-
{category.profitMargin}
-
- )
- })}
-
-
-
- {currentT.total} {filteredPrices.length} {currentT.marketEntries} | {currentT.statesLabel}: {availableStates.length}
-
-
-
- )}
- {/* Enhanced Data Source Info */}
-
-
-
- {currentT.footerWarning}
-
-
- {currentT.footerSmartAnalytics}
- {currentT.footerFarmingRec}
- {currentT.footerFastLoading}
- {currentT.footerFullCoverage}
-
-
+ ))}
- )
+ );
}
\ No newline at end of file
diff --git a/src/app/page.jsx b/src/app/page.tsx
similarity index 100%
rename from src/app/page.jsx
rename to src/app/page.tsx
diff --git a/src/components/FarmersExperienceFeed.tsx b/src/components/FarmersExperienceFeed.tsx
index 58203e7..dcb82a8 100644
--- a/src/components/FarmersExperienceFeed.tsx
+++ b/src/components/FarmersExperienceFeed.tsx
@@ -142,8 +142,11 @@ export const FarmersExperienceFeed: React.FC = () => {
rows={4}
disabled={submitting}
/>
-
- {error &&
{error}
}
+{error && (
+
+ {error}
+
+ )}
👤 Posted as Guest (no login needed)
diff --git a/src/components/UserPreferencesModal.jsx b/src/components/UserPreferencesModal.jsx
new file mode 100644
index 0000000..5f855ae
--- /dev/null
+++ b/src/components/UserPreferencesModal.jsx
@@ -0,0 +1,62 @@
+"use client";
+import React, { useState } from 'react';
+import { usePreferences } from '@/contexts/PreferencesContext';
+
+export default function UserPreferencesModal() {
+ const { preferences, setPreferences } = usePreferences();
+ const [isOpen, setIsOpen] = useState(false);
+ const [region, setRegion] = useState(preferences.region || '');
+
+ const handleSave = () => {
+ setPreferences((prev) => ({
+ ...prev,
+ region: region,
+ }));
+ setIsOpen(false);
+ };
+
+ return (
+
+
+
+ {isOpen && (
+
+
+
Farmer Preferences
+
+
+
setRegion(e.target.value)}
+ placeholder="e.g. Uttar Pradesh"
+ className="w-full p-2 border rounded-md mb-4 dark:bg-gray-700 dark:text-white"
+ />
+
+
+
+
+
+
+
+ )}
+
+ );
+}
\ No newline at end of file
diff --git a/src/components/layout/Footer.jsx b/src/components/layout/Footer.jsx
index d9136d1..dbfce9c 100644
--- a/src/components/layout/Footer.jsx
+++ b/src/components/layout/Footer.jsx
@@ -1,8 +1,10 @@
'use client'
import Link from 'next/link'
-import { Sprout, Phone, Mail, MapPin } from 'lucide-react'
+import { Sprout, Phone, Mail, MapPin, Settings } from 'lucide-react'
import { useLanguage } from '@/contexts/LanguageContext'
+import { usePreferences } from '@/contexts/PreferencesContext'
+import UserPreferencesModal from '@/components/UserPreferencesModal'
const navigation = {
main: [
@@ -27,7 +29,7 @@ const navigation = {
],
}
-// Local translations for footer specific content
+// English/Hindi UI labels
const footerTranslations = {
en: {
empoweringFarmers: 'Empowering farmers with AI technology',
@@ -50,78 +52,21 @@ const footerTranslations = {
privacy: 'गोपनीयता नीति',
terms: 'सेवा की शर्तें',
contact: 'संपर्क करें'
- },
- mr: {
- empoweringFarmers: 'शेतकऱ्यांना AI तंत्रज्ञानाद्वारे सक्षम करणे',
- mainFeatures: 'मुख्य वैशिष्ट्ये',
- support: 'समर्थन',
- contactUs: 'संपर्क साधा',
- helpline: 'हेल्पलाइन',
- address: 'कृषी मंत्रालय, नवी दिल्ली, भारत',
- privacy: 'गोपनीयता धोरण',
- terms: 'सेवा अटी',
- contact: 'संपर्क साधा'
- },
- gu: {
- empoweringFarmers: 'AI ટેક્નોલોજી સાથે ખેડૂતોને સશક્ત બનાવવું',
- mainFeatures: 'મુખ્ય વિશેષતાઓ',
- support: 'સપોર્ટ',
- contactUs: 'અમારો સંપર્ક કરો',
- helpline: 'હેલ્પલાઇન',
- address: 'કૃષિ મંત્રાલય, નવી દિલ્હી, ભારત',
- privacy: 'ગોપનીયતા નીતિ',
- terms: 'સેવાની શરતો',
- contact: 'સંપર્ક કરો'
- },
- ml: {
- empoweringFarmers: 'AI സാങ്കേതികവിദ്യയിലൂടെ കർഷകരെ ശാക്തീകരിക്കുന്നു',
- mainFeatures: 'പ്രധാന സവിശേഷതകൾ',
- support: 'പിന്തുണ',
- contactUs: 'ഞങ്ങളെ ബന്ധപ്പെടുക',
- helpline: 'ഹെൽപ്പ്ലൈൻ',
- address: 'കാർഷിക മന്ത്രാലയം, ന്യൂ ഡൽഹി, ഇന്ത്യ',
- privacy: 'സ്വകാര്യതാനയം',
- terms: 'സേവന വ്യവസ്ഥകൾ',
- contact: 'ബന്ധപ്പെടുക'
}
}
-// Function to get footer translation
const getFooterTranslation = (language, key) => {
- return footerTranslations[language]?.[key] || footerTranslations.en[key] || key;
+ return footerTranslations[language]?.[key] || footerTranslations.en[key] || key
}
export default function Footer() {
const { language, t } = useLanguage()
-
- // Get shorter navigation names for Malayalam
- const getNavigationName = (key) => {
- if (language === 'ml') {
- const malayalamShortNames = {
- 'home': 'ഹോം',
- 'voiceAssistant': 'വോയ്സ് സഹായി',
- 'cropAnalysis': 'വിള വിശകലനം',
- 'weather': 'കാലാവസ്ഥ',
- 'marketPrices': 'വിപണി വിലകൾ',
- 'governmentSchemes': 'സർക്കാർ പദ്ധതികൾ',
- 'help': 'സഹായം',
- 'contact': 'ബന്ധപ്പെടുക',
- 'privacy': 'സ്വകാര്യത',
- 'terms': 'നിബന്ധനകൾ',
- 'PM-KISAN': 'പിഎം-കിസാൻ',
- 'Soil Health Card': 'മണ്ണ് ആരോഗ്യ കാർഡ്',
- 'Kisan Credit Card': 'കിസാൻ ക്രെഡിറ്റ് കാർഡ്',
- 'Fasal Bima Yojana': 'ഫസൽ ബിമ യോജന'
- }
- return malayalamShortNames[key] || t(key)
- }
- return t(key)
- }
+ const { preferences } = usePreferences()
return (