From 7077ca5e98f0e21d9935e6942bd020084a234469 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Fri, 20 Jun 2025 17:36:28 +0530 Subject: [PATCH] (chore/upgrade) migrate to react v19 --- frontend/package-lock.json | 91 ++++--------------- frontend/package.json | 8 +- frontend/src/components/DocumentHead.tsx | 52 +++++++++++ .../src/conversation/SharedConversation.tsx | 26 ++---- 4 files changed, 83 insertions(+), 94 deletions(-) create mode 100644 frontend/src/components/DocumentHead.tsx diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 77e806da..e27d0e8b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -11,16 +11,15 @@ "@reduxjs/toolkit": "^2.8.2", "chart.js": "^4.4.4", "clsx": "^2.1.1", + "copy-to-clipboard": "^3.3.3", "i18next": "^24.2.0", "i18next-browser-languagedetector": "^8.0.2", "mermaid": "^11.6.0", "prop-types": "^15.8.1", "react": "^19.1.0", "react-chartjs-2": "^5.3.0", - "react-copy-to-clipboard": "^5.1.0", - "react-dom": "^18.3.1", + "react-dom": "^19.0.0", "react-dropzone": "^14.3.8", - "react-helmet": "^6.1.0", "react-i18next": "^15.4.0", "react-markdown": "^9.0.1", "react-redux": "^9.2.0", @@ -34,8 +33,7 @@ "devDependencies": { "@types/mermaid": "^9.1.0", "@types/react": "^19.1.8", - "@types/react-dom": "^18.3.0", - "@types/react-helmet": "^6.1.11", + "@types/react-dom": "^19.0.0", "@types/react-syntax-highlighter": "^15.5.13", "@typescript-eslint/eslint-plugin": "^5.51.0", "@typescript-eslint/parser": "^5.62.0", @@ -2148,22 +2146,13 @@ } }, "node_modules/@types/react-dom": { - "version": "18.3.0", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz", - "integrity": "sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==", - "dev": true, - "dependencies": { - "@types/react": "*" - } - }, - "node_modules/@types/react-helmet": { - "version": "6.1.11", - "resolved": "https://registry.npmjs.org/@types/react-helmet/-/react-helmet-6.1.11.tgz", - "integrity": "sha512-0QcdGLddTERotCXo3VFlUSWO3ztraw8nZ6e3zJSgG7apwV5xt+pJUS8ewPBqT4NYB1optGLprNQzFleIY84u/g==", + "version": "19.1.6", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.1.6.tgz", + "integrity": "sha512-4hOiT/dwO8Ko0gV1m/TJZYk3y0KBnY9vzDh7W+DH17b2HFSOGgdj33dhihPeuy3l0q23+4e+hoXHV6hCC4dCXw==", "dev": true, "license": "MIT", - "dependencies": { - "@types/react": "*" + "peerDependencies": { + "@types/react": "^19.0.0" } }, "node_modules/@types/react-syntax-highlighter": { @@ -9168,28 +9157,16 @@ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, - "node_modules/react-copy-to-clipboard": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/react-copy-to-clipboard/-/react-copy-to-clipboard-5.1.0.tgz", - "integrity": "sha512-k61RsNgAayIJNoy9yDsYzDe/yAZAzEbEgcz3DZMhF686LEyukcE1hzurxe85JandPUG+yTfGVFzuEw3xt8WP/A==", - "dependencies": { - "copy-to-clipboard": "^3.3.1", - "prop-types": "^15.8.1" - }, - "peerDependencies": { - "react": "^15.3.0 || 16 || 17 || 18" - } - }, "node_modules/react-dom": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", - "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz", + "integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==", + "license": "MIT", "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.2" + "scheduler": "^0.26.0" }, "peerDependencies": { - "react": "^18.3.1" + "react": "^19.1.0" } }, "node_modules/react-dropzone": { @@ -9209,36 +9186,6 @@ "react": ">= 16.8 || 18.0.0" } }, - "node_modules/react-fast-compare": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.2.tgz", - "integrity": "sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==", - "license": "MIT" - }, - "node_modules/react-helmet": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-6.1.0.tgz", - "integrity": "sha512-4uMzEY9nlDlgxr61NL3XbKRy1hEkXmKNXhjbAIOVw5vcFrsdYbH2FEwcNyWvWinl103nXgzYNlns9ca+8kFiWw==", - "license": "MIT", - "dependencies": { - "object-assign": "^4.1.1", - "prop-types": "^15.7.2", - "react-fast-compare": "^3.1.1", - "react-side-effect": "^2.1.0" - }, - "peerDependencies": { - "react": ">=16.3.0" - } - }, - "node_modules/react-helmet/node_modules/react-side-effect": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-2.1.2.tgz", - "integrity": "sha512-PVjOcvVOyIILrYoyGEpDN3vmYNLdy1CajSFNt4TDsVQC5KpTijDvWVoR+/7Rz2xT978D8/ZtFceXxzsPwZEDvw==", - "license": "MIT", - "peerDependencies": { - "react": "^16.3.0 || ^17.0.0 || ^18.0.0" - } - }, "node_modules/react-i18next": { "version": "15.4.0", "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-15.4.0.tgz", @@ -9846,12 +9793,10 @@ "license": "MIT" }, "node_modules/scheduler": { - "version": "0.23.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", - "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", - "dependencies": { - "loose-envify": "^1.1.0" - } + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz", + "integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==", + "license": "MIT" }, "node_modules/semver": { "version": "6.3.1", diff --git a/frontend/package.json b/frontend/package.json index caafd978..acc39f58 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -22,16 +22,15 @@ "@reduxjs/toolkit": "^2.8.2", "chart.js": "^4.4.4", "clsx": "^2.1.1", + "copy-to-clipboard": "^3.3.3", "i18next": "^24.2.0", "i18next-browser-languagedetector": "^8.0.2", "mermaid": "^11.6.0", "prop-types": "^15.8.1", "react": "^19.1.0", "react-chartjs-2": "^5.3.0", - "react-copy-to-clipboard": "^5.1.0", - "react-dom": "^18.3.1", + "react-dom": "^19.0.0", "react-dropzone": "^14.3.8", - "react-helmet": "^6.1.0", "react-i18next": "^15.4.0", "react-markdown": "^9.0.1", "react-redux": "^9.2.0", @@ -45,8 +44,7 @@ "devDependencies": { "@types/mermaid": "^9.1.0", "@types/react": "^19.1.8", - "@types/react-dom": "^18.3.0", - "@types/react-helmet": "^6.1.11", + "@types/react-dom": "^19.0.0", "@types/react-syntax-highlighter": "^15.5.13", "@typescript-eslint/eslint-plugin": "^5.51.0", "@typescript-eslint/parser": "^5.62.0", diff --git a/frontend/src/components/DocumentHead.tsx b/frontend/src/components/DocumentHead.tsx new file mode 100644 index 00000000..b52b0f84 --- /dev/null +++ b/frontend/src/components/DocumentHead.tsx @@ -0,0 +1,52 @@ +import React from 'react'; + +interface DocumentHeadProps { + title?: string; + description?: string; + keywords?: string; + ogTitle?: string; + ogDescription?: string; + ogImage?: string; + twitterCard?: string; + twitterTitle?: string; + twitterDescription?: string; + children?: React.ReactNode; +} + +export function DocumentHead({ + title, + description, + keywords, + ogTitle, + ogDescription, + ogImage, + twitterCard, + twitterTitle, + twitterDescription, + children, +}: DocumentHeadProps) { + return ( + <> + {title && {title}} + {description && } + {keywords && } + + {/* Open Graph */} + {ogTitle && } + {ogDescription && ( + + )} + {ogImage && } + + {/* Twitter */} + {twitterCard && } + {twitterTitle && } + {twitterDescription && ( + + )} + + {/* Additional elements */} + {children} + + ); +} diff --git a/frontend/src/conversation/SharedConversation.tsx b/frontend/src/conversation/SharedConversation.tsx index 22efae4e..a5ac5d48 100644 --- a/frontend/src/conversation/SharedConversation.tsx +++ b/frontend/src/conversation/SharedConversation.tsx @@ -1,5 +1,4 @@ import { useEffect, useState } from 'react'; -import { Helmet } from 'react-helmet'; import { useTranslation } from 'react-i18next'; import { useDispatch, useSelector } from 'react-redux'; import { useNavigate, useParams } from 'react-router-dom'; @@ -24,6 +23,7 @@ import { updateQuery, } from './sharedConversationSlice'; import { selectCompletedAttachments } from '../upload/uploadSlice'; +import { DocumentHead } from '../components/DocumentHead'; export const SharedConversation = () => { const navigate = useNavigate(); @@ -129,21 +129,15 @@ export const SharedConversation = () => { return ( <> - - {`DocsGPT | ${title}`} - - - - - - - +