diff --git a/Makefile b/Makefile index aecbca5..f4913e2 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ build: rm -rf ./dist ./node_modules/.bin/fedx-scripts babel src --out-dir dist --source-maps --ignore **/*.test.jsx,**/__mocks__,**/__snapshots__,**/setupTest.js --copy-files @# --copy-files will bring in everything else that wasn't processed by babel. Remove what we don't want. + @rm -rf dist/*.test.jsx @rm -rf dist/**/*.test.jsx @rm -rf dist/**/__snapshots__ @rm -rf dist/__mocks__ diff --git a/package-lock.json b/package-lock.json index c2b0eba..7f123f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@edx/paragon": "21.5.3", "@reduxjs/toolkit": "^1.9.7", "babel-polyfill": "6.26.0", + "prop-types": "15.8.1", "react": "17.0.2", "react-dom": "17.0.2", "react-redux": "7.2.9", @@ -30,12 +31,12 @@ "@testing-library/dom": "9.3.3", "@testing-library/jest-dom": "5.17.0", "@testing-library/react": "10.4.9", + "@testing-library/user-event": "^14.5.1", "@wojtekmaj/enzyme-adapter-react-17": "0.8.0", "enzyme": "3.11.0", "husky": "8.0.3", "jest": "29.7.0", - "jest-chain": "1.1.6", - "prop-types": "15.8.1" + "jest-chain": "1.1.6" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -5171,6 +5172,19 @@ "node": ">= 10" } }, + "node_modules/@testing-library/user-event": { + "version": "14.5.1", + "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.5.1.tgz", + "integrity": "sha512-UCcUKrUYGj7ClomOo2SpNVvx4/fkd/2BbIHDCle8A0ax+P3bU7yJwDBDrS6ZwdTMARWTGODX1hEsCcO+7beJjg==", + "dev": true, + "engines": { + "node": ">=12", + "npm": ">=6" + }, + "peerDependencies": { + "@testing-library/dom": ">=7.21.4" + } + }, "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -25697,6 +25711,13 @@ } } }, + "@testing-library/user-event": { + "version": "14.5.1", + "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.5.1.tgz", + "integrity": "sha512-UCcUKrUYGj7ClomOo2SpNVvx4/fkd/2BbIHDCle8A0ax+P3bU7yJwDBDrS6ZwdTMARWTGODX1hEsCcO+7beJjg==", + "dev": true, + "requires": {} + }, "@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", diff --git a/package.json b/package.json index aba3c8e..ab00db5 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,9 @@ "start": "fedx-scripts webpack-dev-server --progress", "test": "fedx-scripts jest --coverage" }, + "files": [ + "/dist" + ], "repository": { "type": "git", "url": "git+https://github.com/openedx/frontend-component-ai-translations.git" @@ -33,18 +36,19 @@ "@testing-library/dom": "9.3.3", "@testing-library/jest-dom": "5.17.0", "@testing-library/react": "10.4.9", + "@testing-library/user-event": "^14.5.1", "@wojtekmaj/enzyme-adapter-react-17": "0.8.0", "enzyme": "3.11.0", "husky": "8.0.3", "jest": "29.7.0", - "jest-chain": "1.1.6", - "prop-types": "15.8.1" + "jest-chain": "1.1.6" }, "dependencies": { "@edx/frontend-platform": "6.0.1", "@edx/paragon": "21.5.3", "@reduxjs/toolkit": "^1.9.7", "babel-polyfill": "6.26.0", + "prop-types": "15.8.1", "react": "17.0.2", "react-dom": "17.0.2", "react-redux": "7.2.9", diff --git a/src/App.jsx b/src/App.jsx new file mode 100644 index 0000000..700c5f8 --- /dev/null +++ b/src/App.jsx @@ -0,0 +1,103 @@ +import { useState } from 'react'; +import { + ActionRow, Collapsible, Icon, IconButton, Image, +} from '@edx/paragon'; +import { ChevronLeft, ChevronRight, Close } from '@edx/paragon/icons'; +import PropTypes from 'prop-types'; + +import XpertLogo from './XpertLogo'; + +const App = ({ setIsAiTranslations, closeTranscriptSettings }) => { + const googleTranslateImage = 'https://prod-edx-ai-translations-assets.s3.amazonaws.com/google-translate.png'; + const [appState, setAppState] = useState({ + selectedLanguages: [], + translationsError: false, + view: '', + }); + + const handleAppState = (updatedData) => { + setAppState((previousState) => ({ ...previousState, ...updatedData })); + }; + + const handleViewClick = () => { + handleAppState({ view: 'request' }); + setIsAiTranslations(true); + }; + + const handleBackButton = () => { + if (appState.view === 'request') { + setIsAiTranslations(false); + setAppState({ ...appState, view: '' }); + } + }; + + return ( +