diff --git a/.env b/.env deleted file mode 100644 index e963ff50..00000000 --- a/.env +++ /dev/null @@ -1,3 +0,0 @@ -REACT_APP_CLIENT_ID=874354657793-vjglkmnn18d872tps5m9vlfeu4f3e20s.apps.googleusercontent.com -REACT_APP_CLIENT_SECRET=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 -REACT_APP_SCOPE=https://www.googleapis.com/auth/youtubepartner diff --git a/.github/workflows/deploy-prod-azure.yml b/.github/workflows/deploy-prod-azure.yml index cd084be0..db919e83 100644 --- a/.github/workflows/deploy-prod-azure.yml +++ b/.github/workflows/deploy-prod-azure.yml @@ -13,6 +13,9 @@ env: AZURE_CDN_PROFILE: ${{ vars.PROD__AZURE_CDN_PROFILE }} AZURE_ENDPOINT_NAME: ${{ vars.PROD__AZURE_ENDPOINT_NAME }} AZURE_RESOURCE_GROUP: ${{ vars.PROD__AZURE_RESOURCE_GROUP }} + REACT_APP_CLIENT_ID: ${{ vars.REACT_APP_CLIENT_ID }} + REACT_APP_CLIENT_SECRET: ${{ vars.REACT_APP_CLIENT_SECRET }} + REACT_APP_SCOPE: ${{ vars.REACT_APP_SCOPE }} jobs: cicd: diff --git a/package-lock.json b/package-lock.json index 27d347df..2e186c4b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "webapp", "version": "0.1.0", "dependencies": { - "@ai4bharat/indic-transliterate": "^1.3.6", + "@ai4bharat/indic-transliterate": "^1.3.8", "@emotion/react": "^11.10.4", "@emotion/styled": "^11.10.4", "@mui/icons-material": "^5.10.6", @@ -21,6 +21,7 @@ "@testing-library/user-event": "^13.5.0", "audio-react-recorder": "^1.0.4", "axios": "^1.1.3", + "diff": "^7.0.0", "duration-time-conversion": "^1.0.6", "gapi-script": "^1.2.0", "indic-transliterate": "file:react-transliterate-chitralekha-ver-2.3.5.tgz", @@ -30,6 +31,7 @@ "react": "^18.2.0", "react-audio-voice-recorder": "^2.1.2", "react-contextmenu": "^2.14.0", + "react-diff-viewer": "^3.1.1", "react-dom": "^18.2.0", "react-draggable": "^4.4.5", "react-joyride": "^2.5.3", @@ -60,9 +62,10 @@ "integrity": "sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==" }, "node_modules/@ai4bharat/indic-transliterate": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/@ai4bharat/indic-transliterate/-/indic-transliterate-1.3.6.tgz", - "integrity": "sha512-NiPLgkwJ/2XTg7ocyWgd/UNUBsj0VzMvLe3jw9zrJQTG20ybegf108rtIDKdmYuYcwyM1aLsQVBNjsgnAMXAGg==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/@ai4bharat/indic-transliterate/-/indic-transliterate-1.3.8.tgz", + "integrity": "sha512-PdbS1C4Ndmvj7rQ6Jyy1dKGgT1Qi+C+ZBffpAmaONOdC99bARqSZiiCK/TdrMKJoUlgQFWkMie+ULpzK8TfkKQ==", + "license": "MIT", "dependencies": { "textarea-caret": "^3.1.0" }, @@ -2458,6 +2461,11 @@ } } }, + "node_modules/@emotion/stylis": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.5.tgz", + "integrity": "sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ==" + }, "node_modules/@emotion/unitless": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.1.tgz", @@ -5745,6 +5753,93 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/babel-plugin-emotion": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/babel-plugin-emotion/-/babel-plugin-emotion-10.2.2.tgz", + "integrity": "sha512-SMSkGoqTbTyUTDeuVuPIWifPdUGkTk1Kf9BWRiXIOIcuyMfsdp2EjeiiFvOzX8NOBvEh/ypKYvUh2rkgAJMCLA==", + "dependencies": { + "@babel/helper-module-imports": "^7.0.0", + "@emotion/hash": "0.8.0", + "@emotion/memoize": "0.7.4", + "@emotion/serialize": "^0.11.16", + "babel-plugin-macros": "^2.0.0", + "babel-plugin-syntax-jsx": "^6.18.0", + "convert-source-map": "^1.5.0", + "escape-string-regexp": "^1.0.5", + "find-root": "^1.1.0", + "source-map": "^0.5.7" + } + }, + "node_modules/babel-plugin-emotion/node_modules/@emotion/hash": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", + "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" + }, + "node_modules/babel-plugin-emotion/node_modules/@emotion/memoize": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==" + }, + "node_modules/babel-plugin-emotion/node_modules/@emotion/serialize": { + "version": "0.11.16", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-0.11.16.tgz", + "integrity": "sha512-G3J4o8by0VRrO+PFeSc3js2myYNOXVJ3Ya+RGVxnshRYgsvErfAOglKAiy1Eo1vhzxqtUvjCyS5gtewzkmvSSg==", + "dependencies": { + "@emotion/hash": "0.8.0", + "@emotion/memoize": "0.7.4", + "@emotion/unitless": "0.7.5", + "@emotion/utils": "0.11.3", + "csstype": "^2.5.7" + } + }, + "node_modules/babel-plugin-emotion/node_modules/@emotion/unitless": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", + "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" + }, + "node_modules/babel-plugin-emotion/node_modules/@emotion/utils": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-0.11.3.tgz", + "integrity": "sha512-0o4l6pZC+hI88+bzuaX/6BgOvQVhbt2PfmxauVaYOGgbsAw14wdKyvMCZXnsnsHys94iadcF+RG/wZyx6+ZZBw==" + }, + "node_modules/babel-plugin-emotion/node_modules/babel-plugin-macros": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz", + "integrity": "sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "cosmiconfig": "^6.0.0", + "resolve": "^1.12.0" + } + }, + "node_modules/babel-plugin-emotion/node_modules/cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-emotion/node_modules/csstype": { + "version": "2.6.21", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", + "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" + }, + "node_modules/babel-plugin-emotion/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/babel-plugin-istanbul": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", @@ -5840,6 +5935,11 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/babel-plugin-syntax-jsx": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", + "integrity": "sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw==" + }, "node_modules/babel-plugin-transform-react-remove-prop-types": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz", @@ -6661,6 +6761,75 @@ "node": ">=10" } }, + "node_modules/create-emotion": { + "version": "10.0.27", + "resolved": "https://registry.npmjs.org/create-emotion/-/create-emotion-10.0.27.tgz", + "integrity": "sha512-fIK73w82HPPn/RsAij7+Zt8eCE8SptcJ3WoRMfxMtjteYxud8GDTKKld7MYwAX2TVhrw29uR1N/bVGxeStHILg==", + "dependencies": { + "@emotion/cache": "^10.0.27", + "@emotion/serialize": "^0.11.15", + "@emotion/sheet": "0.9.4", + "@emotion/utils": "0.11.3" + } + }, + "node_modules/create-emotion/node_modules/@emotion/cache": { + "version": "10.0.29", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-10.0.29.tgz", + "integrity": "sha512-fU2VtSVlHiF27empSbxi1O2JFdNWZO+2NFHfwO0pxgTep6Xa3uGb+3pVKfLww2l/IBGLNEZl5Xf/++A4wAYDYQ==", + "dependencies": { + "@emotion/sheet": "0.9.4", + "@emotion/stylis": "0.8.5", + "@emotion/utils": "0.11.3", + "@emotion/weak-memoize": "0.2.5" + } + }, + "node_modules/create-emotion/node_modules/@emotion/hash": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", + "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" + }, + "node_modules/create-emotion/node_modules/@emotion/memoize": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==" + }, + "node_modules/create-emotion/node_modules/@emotion/serialize": { + "version": "0.11.16", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-0.11.16.tgz", + "integrity": "sha512-G3J4o8by0VRrO+PFeSc3js2myYNOXVJ3Ya+RGVxnshRYgsvErfAOglKAiy1Eo1vhzxqtUvjCyS5gtewzkmvSSg==", + "dependencies": { + "@emotion/hash": "0.8.0", + "@emotion/memoize": "0.7.4", + "@emotion/unitless": "0.7.5", + "@emotion/utils": "0.11.3", + "csstype": "^2.5.7" + } + }, + "node_modules/create-emotion/node_modules/@emotion/sheet": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-0.9.4.tgz", + "integrity": "sha512-zM9PFmgVSqBw4zL101Q0HrBVTGmpAxFZH/pYx/cjJT5advXguvcgjHFTCaIO3enL/xr89vK2bh0Mfyj9aa0ANA==" + }, + "node_modules/create-emotion/node_modules/@emotion/unitless": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", + "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" + }, + "node_modules/create-emotion/node_modules/@emotion/utils": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-0.11.3.tgz", + "integrity": "sha512-0o4l6pZC+hI88+bzuaX/6BgOvQVhbt2PfmxauVaYOGgbsAw14wdKyvMCZXnsnsHys94iadcF+RG/wZyx6+ZZBw==" + }, + "node_modules/create-emotion/node_modules/@emotion/weak-memoize": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", + "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" + }, + "node_modules/create-emotion/node_modules/csstype": { + "version": "2.6.21", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", + "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -7409,6 +7578,14 @@ "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" }, + "node_modules/diff": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", + "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/diff-sequences": { "version": "29.4.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", @@ -7643,6 +7820,15 @@ "node": ">= 4" } }, + "node_modules/emotion": { + "version": "10.0.27", + "resolved": "https://registry.npmjs.org/emotion/-/emotion-10.0.27.tgz", + "integrity": "sha512-2xdDzdWWzue8R8lu4G76uWX5WhyQuzATon9LmNeCy/2BHVC6dsEpfhN1a0qhELgtDVdjyEA6J8Y/VlI5ZnaH0g==", + "dependencies": { + "babel-plugin-emotion": "^10.0.27", + "create-emotion": "^10.0.27" + } + }, "node_modules/encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -15225,6 +15411,34 @@ "node": ">= 12.13.0" } }, + "node_modules/react-diff-viewer": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/react-diff-viewer/-/react-diff-viewer-3.1.1.tgz", + "integrity": "sha512-rmvwNdcClp6ZWdS11m1m01UnBA4OwYaLG/li0dB781e/bQEzsGyj+qewVd6W5ztBwseQ72pO7nwaCcq5jnlzcw==", + "dependencies": { + "classnames": "^2.2.6", + "create-emotion": "^10.0.14", + "diff": "^4.0.1", + "emotion": "^10.0.14", + "memoize-one": "^5.0.4", + "prop-types": "^15.6.2" + }, + "engines": { + "node": ">= 8" + }, + "peerDependencies": { + "react": "^15.3.0 || ^16.0.0", + "react-dom": "^15.3.0 || ^16.0.0" + } + }, + "node_modules/react-diff-viewer/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/react-display-name": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/react-display-name/-/react-display-name-0.2.5.tgz", @@ -18946,9 +19160,9 @@ "integrity": "sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==" }, "@ai4bharat/indic-transliterate": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/@ai4bharat/indic-transliterate/-/indic-transliterate-1.3.6.tgz", - "integrity": "sha512-NiPLgkwJ/2XTg7ocyWgd/UNUBsj0VzMvLe3jw9zrJQTG20ybegf108rtIDKdmYuYcwyM1aLsQVBNjsgnAMXAGg==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/@ai4bharat/indic-transliterate/-/indic-transliterate-1.3.8.tgz", + "integrity": "sha512-PdbS1C4Ndmvj7rQ6Jyy1dKGgT1Qi+C+ZBffpAmaONOdC99bARqSZiiCK/TdrMKJoUlgQFWkMie+ULpzK8TfkKQ==", "requires": { "textarea-caret": "^3.1.0" } @@ -20510,6 +20724,11 @@ "@emotion/utils": "^1.2.1" } }, + "@emotion/stylis": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.5.tgz", + "integrity": "sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ==" + }, "@emotion/unitless": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.8.1.tgz", @@ -22932,6 +23151,89 @@ } } }, + "babel-plugin-emotion": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/babel-plugin-emotion/-/babel-plugin-emotion-10.2.2.tgz", + "integrity": "sha512-SMSkGoqTbTyUTDeuVuPIWifPdUGkTk1Kf9BWRiXIOIcuyMfsdp2EjeiiFvOzX8NOBvEh/ypKYvUh2rkgAJMCLA==", + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@emotion/hash": "0.8.0", + "@emotion/memoize": "0.7.4", + "@emotion/serialize": "^0.11.16", + "babel-plugin-macros": "^2.0.0", + "babel-plugin-syntax-jsx": "^6.18.0", + "convert-source-map": "^1.5.0", + "escape-string-regexp": "^1.0.5", + "find-root": "^1.1.0", + "source-map": "^0.5.7" + }, + "dependencies": { + "@emotion/hash": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", + "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" + }, + "@emotion/memoize": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==" + }, + "@emotion/serialize": { + "version": "0.11.16", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-0.11.16.tgz", + "integrity": "sha512-G3J4o8by0VRrO+PFeSc3js2myYNOXVJ3Ya+RGVxnshRYgsvErfAOglKAiy1Eo1vhzxqtUvjCyS5gtewzkmvSSg==", + "requires": { + "@emotion/hash": "0.8.0", + "@emotion/memoize": "0.7.4", + "@emotion/unitless": "0.7.5", + "@emotion/utils": "0.11.3", + "csstype": "^2.5.7" + } + }, + "@emotion/unitless": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", + "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" + }, + "@emotion/utils": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-0.11.3.tgz", + "integrity": "sha512-0o4l6pZC+hI88+bzuaX/6BgOvQVhbt2PfmxauVaYOGgbsAw14wdKyvMCZXnsnsHys94iadcF+RG/wZyx6+ZZBw==" + }, + "babel-plugin-macros": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz", + "integrity": "sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==", + "requires": { + "@babel/runtime": "^7.7.2", + "cosmiconfig": "^6.0.0", + "resolve": "^1.12.0" + } + }, + "cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + } + }, + "csstype": { + "version": "2.6.21", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", + "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + } + } + }, "babel-plugin-istanbul": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", @@ -23005,6 +23307,11 @@ "@babel/helper-define-polyfill-provider": "^0.3.3" } }, + "babel-plugin-syntax-jsx": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", + "integrity": "sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw==" + }, "babel-plugin-transform-react-remove-prop-types": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz", @@ -23629,6 +23936,77 @@ "yaml": "^1.10.0" } }, + "create-emotion": { + "version": "10.0.27", + "resolved": "https://registry.npmjs.org/create-emotion/-/create-emotion-10.0.27.tgz", + "integrity": "sha512-fIK73w82HPPn/RsAij7+Zt8eCE8SptcJ3WoRMfxMtjteYxud8GDTKKld7MYwAX2TVhrw29uR1N/bVGxeStHILg==", + "requires": { + "@emotion/cache": "^10.0.27", + "@emotion/serialize": "^0.11.15", + "@emotion/sheet": "0.9.4", + "@emotion/utils": "0.11.3" + }, + "dependencies": { + "@emotion/cache": { + "version": "10.0.29", + "resolved": "https://registry.npmjs.org/@emotion/cache/-/cache-10.0.29.tgz", + "integrity": "sha512-fU2VtSVlHiF27empSbxi1O2JFdNWZO+2NFHfwO0pxgTep6Xa3uGb+3pVKfLww2l/IBGLNEZl5Xf/++A4wAYDYQ==", + "requires": { + "@emotion/sheet": "0.9.4", + "@emotion/stylis": "0.8.5", + "@emotion/utils": "0.11.3", + "@emotion/weak-memoize": "0.2.5" + } + }, + "@emotion/hash": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", + "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" + }, + "@emotion/memoize": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==" + }, + "@emotion/serialize": { + "version": "0.11.16", + "resolved": "https://registry.npmjs.org/@emotion/serialize/-/serialize-0.11.16.tgz", + "integrity": "sha512-G3J4o8by0VRrO+PFeSc3js2myYNOXVJ3Ya+RGVxnshRYgsvErfAOglKAiy1Eo1vhzxqtUvjCyS5gtewzkmvSSg==", + "requires": { + "@emotion/hash": "0.8.0", + "@emotion/memoize": "0.7.4", + "@emotion/unitless": "0.7.5", + "@emotion/utils": "0.11.3", + "csstype": "^2.5.7" + } + }, + "@emotion/sheet": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/@emotion/sheet/-/sheet-0.9.4.tgz", + "integrity": "sha512-zM9PFmgVSqBw4zL101Q0HrBVTGmpAxFZH/pYx/cjJT5advXguvcgjHFTCaIO3enL/xr89vK2bh0Mfyj9aa0ANA==" + }, + "@emotion/unitless": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", + "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" + }, + "@emotion/utils": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@emotion/utils/-/utils-0.11.3.tgz", + "integrity": "sha512-0o4l6pZC+hI88+bzuaX/6BgOvQVhbt2PfmxauVaYOGgbsAw14wdKyvMCZXnsnsHys94iadcF+RG/wZyx6+ZZBw==" + }, + "@emotion/weak-memoize": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", + "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" + }, + "csstype": { + "version": "2.6.21", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", + "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" + } + } + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -24156,6 +24534,11 @@ "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==" }, + "diff": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", + "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==" + }, "diff-sequences": { "version": "29.4.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", @@ -24337,6 +24720,15 @@ "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==" }, + "emotion": { + "version": "10.0.27", + "resolved": "https://registry.npmjs.org/emotion/-/emotion-10.0.27.tgz", + "integrity": "sha512-2xdDzdWWzue8R8lu4G76uWX5WhyQuzATon9LmNeCy/2BHVC6dsEpfhN1a0qhELgtDVdjyEA6J8Y/VlI5ZnaH0g==", + "requires": { + "babel-plugin-emotion": "^10.0.27", + "create-emotion": "^10.0.27" + } + }, "encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -29849,6 +30241,26 @@ } } }, + "react-diff-viewer": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/react-diff-viewer/-/react-diff-viewer-3.1.1.tgz", + "integrity": "sha512-rmvwNdcClp6ZWdS11m1m01UnBA4OwYaLG/li0dB781e/bQEzsGyj+qewVd6W5ztBwseQ72pO7nwaCcq5jnlzcw==", + "requires": { + "classnames": "^2.2.6", + "create-emotion": "^10.0.14", + "diff": "^4.0.1", + "emotion": "^10.0.14", + "memoize-one": "^5.0.4", + "prop-types": "^15.6.2" + }, + "dependencies": { + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + } + } + }, "react-display-name": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/react-display-name/-/react-display-name-0.2.5.tgz", diff --git a/package.json b/package.json index 35509f91..e2b5760a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { - "@ai4bharat/indic-transliterate": "^1.3.6", + "@ai4bharat/indic-transliterate": "^1.3.8", "@emotion/react": "^11.10.4", "@emotion/styled": "^11.10.4", "@mui/icons-material": "^5.10.6", @@ -16,6 +16,7 @@ "@testing-library/user-event": "^13.5.0", "audio-react-recorder": "^1.0.4", "axios": "^1.1.3", + "diff": "^7.0.0", "duration-time-conversion": "^1.0.6", "gapi-script": "^1.2.0", "indic-transliterate": "file:react-transliterate-chitralekha-ver-2.3.5.tgz", @@ -25,6 +26,7 @@ "react": "^18.2.0", "react-audio-voice-recorder": "^2.1.2", "react-contextmenu": "^2.14.0", + "react-diff-viewer": "^3.1.1", "react-dom": "^18.2.0", "react-draggable": "^4.4.5", "react-joyride": "^2.5.3", diff --git a/src/common/CompareEdits.jsx b/src/common/CompareEdits.jsx new file mode 100644 index 00000000..bab88c21 --- /dev/null +++ b/src/common/CompareEdits.jsx @@ -0,0 +1,385 @@ +import { + Dialog, + DialogContent, + DialogContentText, + Box, + IconButton, + DialogTitle, + Typography, + CircularProgress, +} from "@mui/material"; +import '../styles/Compare.css'; +import React, { useCallback, useEffect, useState,useRef} from "react"; +import CloseIcon from "@mui/icons-material/Close"; +import FullscreenIcon from "@mui/icons-material/Fullscreen"; +import FullscreenExitIcon from "@mui/icons-material/FullscreenExit"; +import { FetchpreviewTaskAPI, setSnackBar } from "redux/actions"; +import { useDispatch } from "react-redux"; +import Loader from "./Spinner"; +import TimeBoxes from "./TimeBoxes"; +import DiffViewer,{DiffMethod} from "react-diff-viewer"; +import { diffWords } from "diff"; +import Compare from "redux/actions/api/Project/Compare"; +import Comparetrans from "redux/actions/api/Project/CompareTrans"; + +const CompareEdits = ({ + openPreviewDialog, + handleClose, + videoId, + taskType, + currentSubs, + targetLanguage, +}) => { + const dispatch = useDispatch(); + const [isFullscreen, setIsFullscreen] = useState(false); + + const [EditCompleteTexts, setEditCompleteTexts] = useState(); + const [SelectSourceTexts,setSelectSourceTexts] = useState(); + const [loading, setLoading] = useState(false); + const [totalAdded, setTotalAdded] = useState(0); + const [totalDeleted, setTotalDeleted] = useState(0); + const [ratio, setRatio] = useState(0); + const [selectedDiffMethod, setSelectedDiffMethod] = useState(DiffMethod.WORDS); + + const handleDiffMethodChange = (event) => { + setSelectedDiffMethod(event.target.value); + }; + + const dialogRef = useRef(null); + + // const selectSource = [ + // "What he wants, that conversation is very interesting for a couple of reasons.", + // "Power.", + // "So, Muni thinks that a conversation endorses the viewpoint of the shopkeeper.", + // ]; + + // const editComplete = [ + // "Though that narrative is unsuccessful in getting him what he wants, that conversation is very interesting for a couple of reasons.", + // "123 Power.", + // "Muni thinks that a conversation endorses the viewpoint of the shopkeeper will make him happy.", + // ]; + + + + + const fetchPreviewData = useCallback(async () => { + setLoading(true) + console.log(targetLanguage); + + if(taskType=="TRANSCRIPTION_EDIT"){ + + var taskObj = new Compare(videoId); + + }else{ + + var taskObj = new Comparetrans(videoId); + } + try { + const res = await fetch(taskObj.apiEndPoint(), { + method: "GET", + headers: taskObj.getHeaders().headers, + }); + + const data = await res.json(); + console.log(data); + if(taskType=="TRANSCRIPTION_EDIT"){ + if (data?.transcripts) { + const editComplete = []; + const selectSource = []; + console.log(data); + + data.transcripts.forEach((transcript) => { + if (transcript.status === "TRANSCRIPTION_EDIT_COMPLETE") { + transcript.data.payload.forEach((item) => { + if (item.verbatim_text && item.verbatim_text.trim() !== "") { + editComplete.push(item.verbatim_text); + }else{ + editComplete.push(item.text); + } + }) + } else if (transcript.status === "TRANSCRIPTION_SELECT_SOURCE") { + selectSource.push( + ...transcript.data.payload.map((item) => item.text) + ); + } + }); + console.log(editComplete,selectSource); + + setEditCompleteTexts(editComplete); + setSelectSourceTexts(selectSource); + } + }else{ + if (data) { + const editComplete = []; + const selectSource = []; + + data.forEach((translate) => { + + if (translate.status === "TRANSLATION_EDIT_COMPLETE" && targetLanguage == translate.target_language) { + editComplete.push( + ...translate.data.payload.map((item) => item.target_text) + ); + } else if (translate.status === "TRANSLATION_SELECT_SOURCE" && targetLanguage== translate.target_language) { + selectSource.push( + ...translate.data.payload.map((item) => item.target_text ) + ); + } + }); + console.log(editComplete,selectSource); + + setEditCompleteTexts(editComplete); + setSelectSourceTexts(selectSource); + } + + } + setLoading(false) + } catch (error) { + setLoading(false) + } + }, [ dispatch,videoId]); + + useEffect(() => { + if (openPreviewDialog) { + fetchPreviewData(); + } + }, [fetchPreviewData, openPreviewDialog]); + + + + + const calculateWordDiff = (sourceText, editedText) => { + const diff = diffWords(sourceText, editedText); + let addedWords = 0; + let deletedWords = 0; + + diff.forEach((part) => { + if (part.added) { + addedWords += part.value.split(/\s+/).filter(Boolean).length; + } + if (part.removed) { + deletedWords += part.value.split(/\s+/).filter(Boolean).length; + } + }); + + return { addedWords, deletedWords }; + }; + + useEffect(() => { + if (openPreviewDialog) { + let added = 0; + let deleted = 0; + + SelectSourceTexts?.forEach((sourceText, index) => { + const { addedWords, deletedWords } = calculateWordDiff( + sourceText, + EditCompleteTexts[index] || "" + ); + added += addedWords; + deleted += deletedWords; + }); + + setTotalAdded(added); + setTotalDeleted(deleted); + setRatio((deleted / (added || 1)).toFixed(2)); + } + }, [openPreviewDialog, SelectSourceTexts, EditCompleteTexts]); + + const handleFullscreenToggle = () => { + const elem = dialogRef.current; + if (!isFullscreen) { + if (elem.requestFullscreen) { + elem.requestFullscreen(); + } else if (elem.mozRequestFullScreen) { + /* Firefox */ + elem.mozRequestFullScreen(); + } else if (elem.webkitRequestFullscreen) { + /* Chrome, Safari and Opera */ + elem.webkitRequestFullscreen(); + } else if (elem.msRequestFullscreen) { + /* IE/Edge */ + elem.msRequestFullscreen(); + } + setIsFullscreen(true); + } else { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.mozCancelFullScreen) { + /* Firefox */ + document.mozCancelFullScreen(); + } else if (document.webkitExitFullscreen) { + /* Chrome, Safari and Opera */ + document.webkitExitFullscreen(); + } else if (document.msExitFullscreen) { + /* IE/Edge */ + document.msExitFullscreen(); + } + setIsFullscreen(false); + } + }; + + + + useEffect(() => { + const handleFullscreenChange = () => { + if (!document.fullscreenElement) { + setIsFullscreen(false); + } + }; + + document.addEventListener('fullscreenchange', handleFullscreenChange); + document.addEventListener('webkitfullscreenchange', handleFullscreenChange); + document.addEventListener('mozfullscreenchange', handleFullscreenChange); + document.addEventListener('msfullscreenchange', handleFullscreenChange); + + return () => { + document.removeEventListener('fullscreenchange', handleFullscreenChange); + document.removeEventListener('webkitfullscreenchange', handleFullscreenChange); + document.removeEventListener('mozfullscreenchange', handleFullscreenChange); + document.removeEventListener('msfullscreenchange', handleFullscreenChange); + }; + }, []); + + return ( + + + Source vs Edit Comparison{" "} + + {isFullscreen ? : } + + + + + + + + +
+ + +
+ + {loading ? ( +
+ +
+ ) : ( + + +
+ {SelectSourceTexts?.map((sourceText, index) => { + const editedText = EditCompleteTexts[index] || ""; + const hasDifferences = sourceText !== editedText; + + return ( +
+
Card - {index + 1}
+ {hasDifferences ? ( + + ) : ( +
+
+
{sourceText || "No Source Text"}
+
+
+
{EditCompleteTexts[index] || "No Edited Text"}
+
+
+ + )} +
+ ); + })} + + +
+
+ Total Changes: {totalAdded} +
+
+ Total Deletions: {totalDeleted} +
+
+
+ +
+ )} +
+
+ ); +}; + +export default CompareEdits; diff --git a/src/common/CustomMenuComponent.jsx b/src/common/CustomMenuComponent.jsx index b66763fd..b1cac210 100644 --- a/src/common/CustomMenuComponent.jsx +++ b/src/common/CustomMenuComponent.jsx @@ -98,7 +98,7 @@ const CustomMenuComponent = ({ {setShowSubtitles(!showSubtitles)}}/> - + {/*
Show Timeline {setShowTimeline(!showTimeline)}}/>
-
+
*/}
{ const { transcription, translation, voiceover, speakerInfo, bgMusic } = exportTypes; - const [currentTaskType, setCurrentTaskType] = useState(""); + const [currentTaskType, setCurrentTaskType] = useState(taskType); const transcriptExportTypes = useSelector( (state) => state.getTranscriptExportTypes.data.export_types @@ -58,7 +61,9 @@ const ExportDialog = ({ setCurrentTaskType("TRANSLATION_EDIT"); } } else { - setCurrentTaskType(taskType); + if(!multiOptionDialog){ + setCurrentTaskType(taskType); + } } }, [taskType, isBulkTaskDownload, currentSelectedTasks]); @@ -69,7 +74,16 @@ const ExportDialog = ({ PaperProps={{ style: { borderRadius: "10px" } }} > - Export Voiceover{" "} + {multiOptionDialog ? + Export   + + + : + Export {currentTaskType} + } + + + + + ); +}; + +export default RegenerateFailedVotrTasksDialog; diff --git a/src/config/apiendpoint.js b/src/config/apiendpoint.js index 1fdb90c3..3f695914 100644 --- a/src/config/apiendpoint.js +++ b/src/config/apiendpoint.js @@ -43,7 +43,7 @@ const endpoints = { task: "/task/", //Transliteration - transliteration: "/api/generic/transliteration/", + transliteration: "/xlit-api/generic/transliteration/", //Glossary glossary: "/glossary/", diff --git a/src/config/tableColumns.js b/src/config/tableColumns.js index fa9bd965..919fe33a 100644 --- a/src/config/tableColumns.js +++ b/src/config/tableColumns.js @@ -465,6 +465,10 @@ export const taskQueueStatusColumns = [ name: "video_duration", label: "Video Duration", }, + { + name: "status", + label: "Status", + }, ]; export const taskQueueStatusAdminColumns = [ diff --git a/src/containers/Organization/MyOrganization.jsx b/src/containers/Organization/MyOrganization.jsx index f7a7543c..6099e564 100644 --- a/src/containers/Organization/MyOrganization.jsx +++ b/src/containers/Organization/MyOrganization.jsx @@ -37,6 +37,7 @@ import ProjectList from "./ProjectList"; import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined"; import { AddOrganizationMember, AlertComponent, Loader } from "common"; import UploadFileDialog from "common/UploadFileDialog"; +import RegenerateFailedVotrTasksDialog from "common/RegenerateFailedVotrTasksDialog"; const TabPanel = (props) => { const { children, value, index, ...other } = props; @@ -71,7 +72,8 @@ const MyOrganization = () => { const [orgOwnerId, setOrgOwnerId] = useState(""); const [openUploadBulkVideoDialog, setOpenUploadBulkVideoDialog] = useState(false); - const [isUserOrgOwner, setIsUserOrgOwner] = useState(false); + const [isUserOrgOwner, setIsUserOrgOwner] = useState(false); + const [openRegenerateFailedVotrTasksDialog, setOpenRegenerateFailedVotrTasksDialog] = useState(false); const organizationDetails = useSelector( (state) => state.getOrganizationDetails.data @@ -88,6 +90,7 @@ const MyOrganization = () => { if (success) { if (apiType === "UPLOAD_CSV") { setOpenUploadBulkVideoDialog(false); + setOpenRegenerateFailedVotrTasksDialog(false); } if (apiType === "GET_USERS_ROLES") { @@ -103,6 +106,7 @@ const MyOrganization = () => { setAlertMessage(data.message); setAlertColumn("csvAlertColumns"); setOpenUploadBulkVideoDialog(false); + setOpenRegenerateFailedVotrTasksDialog(false); } } } @@ -184,13 +188,13 @@ const MyOrganization = () => { ); }; - const handeFileUpload = (file) => { + const handeFileUpload = (file, regenerate = false) => { const reader = new FileReader(); reader.onload = async () => { const csvData = reader.result; const csv = btoa(csvData); - const uploadCSVObj = new UploadCSVAPI("org", id, csv); + const uploadCSVObj = new UploadCSVAPI("org", id, csv, regenerate); dispatch(APITransport(uploadCSVObj)); }; reader.readAsBinaryString(file[0]); @@ -304,6 +308,15 @@ const MyOrganization = () => { Add New Project + +
- {enableTransliteration ? ( + {taskData?.src_language !== "en" && enableTransliteration ? ( { changeTranscriptHandler(text, index, "transaltion"); diff --git a/src/containers/Organization/Video/RightPanel.jsx b/src/containers/Organization/Video/RightPanel.jsx index 0dbee263..24838a8c 100644 --- a/src/containers/Organization/Video/RightPanel.jsx +++ b/src/containers/Organization/Video/RightPanel.jsx @@ -729,6 +729,7 @@ const RightPanel = ({ currentIndex, currentSubs,setCurrentIndex, showTimeline, s {taskData?.src_language !== "en" && enableTransliteration ? ( { diff --git a/src/containers/Organization/Video/TranslationRightPanel.jsx b/src/containers/Organization/Video/TranslationRightPanel.jsx index 152aaaaf..ec6634ff 100644 --- a/src/containers/Organization/Video/TranslationRightPanel.jsx +++ b/src/containers/Organization/Video/TranslationRightPanel.jsx @@ -809,6 +809,7 @@ const TranslationRightPanel = ({ currentIndex, currentSubs,setCurrentIndex, show {enableTransliteration ? ( { diff --git a/src/containers/Organization/Video/VoiceOverRightPanel.jsx b/src/containers/Organization/Video/VoiceOverRightPanel.jsx index 0a1dfe72..1e93822a 100644 --- a/src/containers/Organization/Video/VoiceOverRightPanel.jsx +++ b/src/containers/Organization/Video/VoiceOverRightPanel.jsx @@ -629,6 +629,7 @@ const VoiceOverRightPanel = ({ setCurrentIndex }) => { enableTransliteration ? ( { diff --git a/src/containers/Organization/Video/VoiceOverRightPanel1.jsx b/src/containers/Organization/Video/VoiceOverRightPanel1.jsx index bbfa38a3..3fafc7ef 100644 --- a/src/containers/Organization/Video/VoiceOverRightPanel1.jsx +++ b/src/containers/Organization/Video/VoiceOverRightPanel1.jsx @@ -36,6 +36,7 @@ import superscriptMap from "config/superscript"; import { ConfirmDialog, ConfirmErrorDialog, + ExportDialog, RecorderComponent, ShortcutKeys, TableDialog, @@ -58,10 +59,15 @@ import { setTotalSentences, setSnackBar, CreateGlossaryAPI, + exportTranslationAPI, + FetchTranscriptExportTypesAPI, + FetchTranslationExportTypesAPI, + FetchVoiceoverExportTypesAPI, + exportTranscriptionAPI, } from "redux/actions"; import { MenuItem } from "react-contextmenu"; import GlossaryDialog from "common/GlossaryDialog"; -import { copySubs, onExpandTimeline } from "utils/subtitleUtils"; +import { copySubs, exportFile, onExpandTimeline } from "utils/subtitleUtils"; import AudioPlayer from "./audioPanel"; const VoiceOverRightPanel1 = ({ currentIndex, setCurrentIndex, showTimeline, segment }) => { @@ -130,6 +136,7 @@ const VoiceOverRightPanel1 = ({ currentIndex, setCurrentIndex, showTimeline, seg const [redoStack, setRedoStack] = useState([]); const [contextMenu, setContextMenu] = React.useState(null); const [openGlossaryDialog, setOpenGlossaryDialog] = useState(false); + const [openExportDialog, setOpenExportDialog] = useState(false); const [glossaryDialogTitle, setGlossaryDialogTitle] = useState(false); const [selectedWord, setSelectedWord] = useState(""); const loggedInUserData = useSelector( @@ -137,6 +144,25 @@ const VoiceOverRightPanel1 = ({ currentIndex, setCurrentIndex, showTimeline, seg ); const [loader, setLoader] = useState(false); + const [exportTypes, setExportTypes] = useState({ + transcription: ["srt"], + translation: ["srt"], + voiceover: "mp3", + speakerInfo: "false", + bgMusic: "false", + }); + + useEffect(() => { + const transcriptExportObj = new FetchTranscriptExportTypesAPI(); + dispatch(APITransport(transcriptExportObj)); + + const translationExportObj = new FetchTranslationExportTypesAPI(); + dispatch(APITransport(translationExportObj)); + + const voiceoverExportObj = new FetchVoiceoverExportTypesAPI(); + dispatch(APITransport(voiceoverExportObj)); + }, []); + useEffect(() => { const { progress, success, data, apiType } = apiStatus; setApiInProgress(progress); @@ -744,6 +770,123 @@ const VoiceOverRightPanel1 = ({ currentIndex, setCurrentIndex, showTimeline, seg // }, 60000); // }, [currentOffset, sourceText]); + const handleTranscriptExport = async () => { + const { transcription, speakerInfo } = exportTypes; + + transcription.map(async (transcript)=>{ + const apiObj = new exportTranscriptionAPI( + taskId, + transcript, + speakerInfo + ); + setOpenExportDialog(false); + + try { + const res = await fetch(apiObj.apiEndPoint(), { + method: "GET", + headers: apiObj.getHeaders().headers, + }); + + if (res.ok) { + const resp = await res.blob(); + + exportFile(resp, taskData, transcript, "transcription"); + } else { + const resp = await res.json(); + + dispatch( + setSnackBar({ + open: true, + message: resp.message, + variant: "success", + }) + ); + } + } catch (error) { + dispatch( + setSnackBar({ + open: true, + message: "Something went wrong!!", + variant: "error", + }) + ); + }}) + }; + + const handleTranslationExport = async () => { + const { translation, speakerInfo } = exportTypes; + + translation.map(async (translate)=>{ + const apiObj = new exportTranslationAPI(taskId, translate, speakerInfo); + setOpenExportDialog(false); + + try { + const res = await fetch(apiObj.apiEndPoint(), { + method: "GET", + headers: apiObj.getHeaders().headers, + }); + + if (res.ok) { + const resp = await res.blob(); + + exportFile(resp, taskData, translate, "translation"); + } else { + const resp = await res.json(); + + dispatch( + setSnackBar({ + open: true, + message: resp.message, + variant: "success", + }) + ); + } + } catch (error) { + dispatch( + setSnackBar({ + open: true, + message: "Something went wrong!!", + variant: "error", + }) + ); + }}) + }; + + const handleExportSubmitClick = (taskType) => { + if(taskType === "TRANSCRIPTION_VOICEOVER_EDIT"){ + handleTranscriptExport(); + }else{ + handleTranslationExport(); + } + }; + + const handleExportRadioButtonChange = (event) => { + const { + target: { name, value }, + } = event; + + setExportTypes((prevState) => ({ + ...prevState, + [name]: value, + })); + }; + + const handleExportCheckboxChange = (event) => { + const { + target: { name, value }, + } = event; + let new_val=exportTypes[name] + if (new_val.includes(value)){ + new_val = new_val.filter(item => item !== value) + } else{ + new_val.push(value) + } + setExportTypes((prevState) => ({ + ...prevState, + [name]: new_val, + })); + } + return ( <> {loader && } @@ -781,6 +924,7 @@ const VoiceOverRightPanel1 = ({ currentIndex, setCurrentIndex, showTimeline, seg handleReGenerateTranslation={()=>{changeTranscriptHandler(null, "retranslate", "retranslate")}} handleGetUpdatedAudioForAll={()=>{changeTranscriptHandler(null, "audio", "audio")}} bookmarkSegment={() => {saveTranscriptHandler(false, false, currentPage, true)}} + setOpenExportDialog={setOpenExportDialog} /> @@ -922,7 +1066,7 @@ const VoiceOverRightPanel1 = ({ currentIndex, setCurrentIndex, showTimeline, seg : {} } > - + {/*