From f391328d76166d4aef84853247ac3dc274efe37f Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Tue, 6 Aug 2024 15:35:37 +0530 Subject: [PATCH 1/2] Issueid #223945 fix: When user is log out we are redirecting to home page --- .github/workflows/all-app-sandbox.yml | 2 +- .github/workflows/all-dev-rig.yml | 2 +- .github/workflows/all-prod-rig.yml | 2 +- src/components/Assesment/Assesment.jsx | 2 +- src/routes/index.js | 24 ++++++++++++------------ src/utils/constants.js | 4 ++-- src/views/AppContent/AppContent.jsx | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/all-app-sandbox.yml b/.github/workflows/all-app-sandbox.yml index 45f36483..b3e750a4 100644 --- a/.github/workflows/all-app-sandbox.yml +++ b/.github/workflows/all-app-sandbox.yml @@ -74,7 +74,7 @@ jobs: REACT_APP_POST_LEARNER_PROGRESS: ${{ vars.REACT_APP_POST_LEARNER_PROGRESS }} REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }} REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }} - REACT_APP_IS_APP_LANGUAGES: ${{ vars.REACT_APP_IS_APP_LANGUAGES }} + REACT_APP_LANGUAGES: ${{ vars.REACT_APP_LANGUAGES }} CI: false # Disabling CI to not treat warnings as errors run: npm run build diff --git a/.github/workflows/all-dev-rig.yml b/.github/workflows/all-dev-rig.yml index 40069fd6..1bd8de6f 100644 --- a/.github/workflows/all-dev-rig.yml +++ b/.github/workflows/all-dev-rig.yml @@ -74,7 +74,7 @@ jobs: REACT_APP_POST_LEARNER_PROGRESS: ${{ vars.REACT_APP_POST_LEARNER_PROGRESS }} REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }} REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }} - REACT_APP_IS_APP_LANGUAGES: ${{ vars.REACT_APP_IS_APP_LANGUAGES }} + REACT_APP_LANGUAGES: ${{ vars.REACT_APP_LANGUAGES }} CI: false # Disabling CI to not treat warnings as errors run: npm run build diff --git a/.github/workflows/all-prod-rig.yml b/.github/workflows/all-prod-rig.yml index d82589ea..98b6d296 100644 --- a/.github/workflows/all-prod-rig.yml +++ b/.github/workflows/all-prod-rig.yml @@ -74,7 +74,7 @@ jobs: REACT_APP_POST_LEARNER_PROGRESS: ${{ vars.REACT_APP_POST_LEARNER_PROGRESS }} REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }} REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }} - REACT_APP_IS_APP_LANGUAGES: ${{ vars.REACT_APP_IS_APP_LANGUAGES }} + REACT_APP_LANGUAGES: ${{ vars.REACT_APP_LANGUAGES }} CI: false # Disabling CI to not treat warnings as errors run: npm run build diff --git a/src/components/Assesment/Assesment.jsx b/src/components/Assesment/Assesment.jsx index 8039eb2c..3a6385bb 100644 --- a/src/components/Assesment/Assesment.jsx +++ b/src/components/Assesment/Assesment.jsx @@ -357,7 +357,7 @@ export const ProfileHeader = ({ const handleLogout = () => { localStorage.clear(); end({}); - navigate("/Login"); + navigate("/login"); }; const CustomIconButton = styled(IconButton)({ diff --git a/src/routes/index.js b/src/routes/index.js index 7891f52b..db7142a2 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -3,6 +3,12 @@ import * as reviews from "../views"; const routData = [ + { + id: "route-001", + path: "/", + component: reviews.DiscoverStart, + requiresAuth: true, + }, { id: "route-002", path: "/discover", @@ -53,6 +59,12 @@ const routData = [ component: reviews.PracticeRedirectPage, requiresAuth: true, }, + { + id: "route-010", + path: "/login", + component: reviews.LoginPage, + requiresAuth: false, + }, ]; // add login route for test rig @@ -61,12 +73,6 @@ const isLogin = process.env.REACT_APP_IS_IN_APP_AUTHORISATION === 'true'; if (isLogin && !virtualId) { routData.push( - { - id: "route-001", - path: "/", - component: reviews.LoginPage, - requiresAuth: true, - }, { id: "route-000", path: "*", @@ -76,12 +82,6 @@ if (isLogin && !virtualId) { ); }else { routData.push( - { - id: "route-001", - path: "/", - component: reviews.DiscoverStart, - requiresAuth: false, - }, { id: "route-000", path: "*", diff --git a/src/utils/constants.js b/src/utils/constants.js index 21fd00f8..1890c456 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -3524,8 +3524,8 @@ export const levelConfig = { { name: "తెలుగు", lang: "te", symbol: "ఈ" } , ]; -const appLanguages = process.env.REACT_APP_IS_APP_LANGUAGES - ? JSON.parse(process.env.REACT_APP_IS_APP_LANGUAGES) +const appLanguages = process.env.REACT_APP_LANGUAGES + ? JSON.parse(process.env.REACT_APP_LANGUAGES) : []; export const languages = AllLanguages.filter(lang => diff --git a/src/views/AppContent/AppContent.jsx b/src/views/AppContent/AppContent.jsx index 7cf3cf9f..d054867a 100644 --- a/src/views/AppContent/AppContent.jsx +++ b/src/views/AppContent/AppContent.jsx @@ -7,7 +7,7 @@ const PrivateRoute = (props) => { const navigate = useNavigate(); useEffect(() => { if (!virtualId && props.requiresAuth) { - navigate("/"); + navigate("/login"); } }, [virtualId]); From c9eabbf053f9143af99392069c06ad05a2e316ff Mon Sep 17 00:00:00 2001 From: Ajinkya Pande Date: Tue, 6 Aug 2024 16:21:34 +0530 Subject: [PATCH 2/2] Issueid #223945 fix: When user is log out we are redirecting to home page --- src/utils/constants.jsx | 3544 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 3544 insertions(+) diff --git a/src/utils/constants.jsx b/src/utils/constants.jsx index e69de29b..6d280d18 100644 --- a/src/utils/constants.jsx +++ b/src/utils/constants.jsx @@ -0,0 +1,3544 @@ +import confetti from "canvas-confetti"; +import * as React from "react"; + +export const getLocalData = (item) => { + return localStorage.getItem(item); +}; + +export const setLocalData = (item, value) => { + return localStorage.setItem(item, value); +}; + +export function replaceAll(string, search, replace) { + return string.split(search).join(replace); +} + +export function compareArrays(arr1, arr2) { + let words_result = []; + + // Iterate over each element and compare + for (var k in arr1) { + if (arr2[k] === "" || arr2[k] === undefined) { + // Element not available on the same key + words_result.push("-1"); + } else if (arr1[k] === arr2[k]) { + // Elements match on the same key + words_result.push("1"); + } else { + // Element does not match on the same key + words_result.push("0"); + } + } + if (arr1.length < arr2.length) { + for (let i = arr1.length; i < arr2.length; i++) { + words_result.push("-1"); + } + } + return words_result; +} + +export const questionsList = [ + { + question: + "One day, a dog was passing by a river. He had a bone in his mouth.", + type: "sentence", + }, + { + question: "He looked into the water and saw his own reflection in it.", + type: "sentence", + }, + { + question: "He started barking bow-wow, and bone fell into the water.", + type: "sentence", + }, + { question: "River", type: "word" }, + { question: "Water", type: "word" }, + { question: "Barking", type: "word" }, + { + question: + "There are many different kinds of animals that live in China. Tigers and leopards are animals that live in China's forests in the north.", + type: "paragraph", + }, + { + question: + "Bali and Lombok are neighbouring islands both are part of the Indonesian archipelago. It is easy to appreciate each island as an attractive tourist destination.", + type: "paragraph", + }, + { + question: + "Martin Luther led many demonstrations against racism. He delivered his message in a non-violent manner. The jail sentence he received was four months.", + type: "paragraph", + }, +]; + +export const NextButton = (props) => { + return ( + + + + + + + + + + + + + + + + + ); +}; + +export const ListenButton = (props) => { + return ( + + + + + + + + + + + + + + + + + + ); +}; + +export const SpeakButton = (props) => ( + + + + + + + + + + + + + + + + +); + +export const StopButton = (props) => ( + + + + + + + + + + + + + + + + +); + +export const AudioPlayerSvg = (props) => { + return ( + + + + ); +}; + +export const PlayAudioButton = (props) => ( + + + + +); + +export const StopAudioButton = (props) => ( + + + +); + +export const AudioBarSvg = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const AudioBarColoredSvg = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const SubmitButton = (props) => ( + + + + + + + + + + +); + +export const LevelOne = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const LevelTwo = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const LevelThree = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const LevelFour = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const LevelFive = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const LevelSix = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const LevelSeven = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const LevelEight = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const LevelNine = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const LetsStart = (props) => ( + + + + + + + + + + +); +export const StartAssessmentButton = (props) => ( + + + + + +); + +export const GoodMood = (props) => ( + + + +); + +export const AverageMood = (props) => ( + + + +); + +export const BadMood = (props) => ( + + + +); + +export const GreenTick = (props) => ( + + + + + + + + + +); + +export const LevelRight = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const SelectLanguageButton = (props) => ( + + + + + + + +); + +export const RoundTick = (props) => ( + + + + + + + + + + +); + +export const RetryIcon = (props) => ( + + + + + + + + + + + + + + + + +); + +export const AssesmentCompletePlane = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const HeartRed = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const HeartBlack = (props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export const SessionID = "13900744731701973109305"; +export const UserID = "1390074473"; + +export const practiceSteps = [ + { name: "P1", fullName: "Practice 1" }, + { name: "P2", fullName: "Practice 2" }, + { name: "P3", fullName: "Practice 3" }, + { name: "P4", fullName: "Practice 4" }, + { name: "S1", fullName: "Showcase 1" }, + { name: "P5", fullName: "Practice 5" }, + { name: "P6", fullName: "Practice 6" }, + { name: "P7", fullName: "Practice 7" }, + { name: "P8", fullName: "Practice 8" }, + { name: "S2", fullName: "Showcase 2" }, +]; + +export const levelGetContent = { + 0: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 1: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "word", template: "simple" }, + { title: "P4", criteria: "word", template: "simple" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple" }, + { title: "P8", criteria: "word", template: "simple" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 2: [ + { title: "P1", criteria: "char", template: "simple" }, + { title: "P2", criteria: "char", template: "simple" }, + { title: "P3", criteria: "word", template: "simple", mechanism: "audio" }, + { title: "P4", criteria: "word", template: "simple", mechanism: "audio" }, + { title: "S1", criteria: "word", template: "simple" }, + { title: "P5", criteria: "word", template: "simple" }, + { title: "P6", criteria: "word", template: "simple" }, + { title: "P7", criteria: "word", template: "simple", mechanism: "audio" }, + { title: "P8", criteria: "word", template: "simple", mechanism: "audio" }, + { title: "S2", criteria: "word", template: "simple" }, + ], + 3: [ + { + title: "P1", + criteria: "word", + template: "simple", + }, + { + title: "P2", + criteria: "word", + template: "simple", + }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { + title: "P5", + criteria: "sentence", + template: "simple", + mechanism: "fillInTheBlank", + }, + { + title: "P6", + criteria: "sentence", + template: "simple", + mechanism: "fillInTheBlank", + }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 4: [ + { title: "P1", criteria: "word", template: "simple" }, + { title: "P2", criteria: "word", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 5: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "sentence", template: "simple" }, + { title: "P4", criteria: "sentence", template: "simple" }, + { title: "S1", criteria: "sentence", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "sentence", template: "simple" }, + { title: "P7", criteria: "sentence", template: "simple" }, + { title: "P8", criteria: "sentence", template: "simple" }, + { title: "S2", criteria: "sentence", template: "simple" }, + ], + 6: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "sentence", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 7: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 8: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], + 9: [ + { title: "P1", criteria: "sentence", template: "simple" }, + { title: "P2", criteria: "sentence", template: "simple" }, + { title: "P3", criteria: "paragraph", template: "simple" }, + { title: "P4", criteria: "paragraph", template: "simple" }, + { title: "S1", criteria: "paragraph", template: "simple" }, + { title: "P5", criteria: "paragraph", template: "simple" }, + { title: "P6", criteria: "paragraph", template: "simple" }, + { title: "P7", criteria: "paragraph", template: "simple" }, + { title: "P8", criteria: "paragraph", template: "simple" }, + { title: "S2", criteria: "paragraph", template: "simple" }, + ], +}; + +export function callConfettiSnow() { + var duration = 3 * 1000; + var animationEnd = Date.now() + duration; + // var defaults = { startVelocity: 30, spread: 360, ticks: 60, zIndex: 0 }; + + // function randomInRange(min, max) { + // return Math.random() * (max - min) + min; + // } + + var interval = setInterval(function () { + var timeLeft = animationEnd - Date.now(); + + if (timeLeft <= 0) { + return clearInterval(interval); + } + + // since particles fall down, start a bit higher than random + timeLeft = animationEnd - Date.now(); + var ticks = Math.max(200, 500 * (timeLeft / duration)); + var skew; + skew = Math.max(0.8, skew - 0.001); + + confetti({ + particleCount: 1, + startVelocity: 0, + ticks: ticks, + origin: { + x: Math.random(), + // since particles fall down, skew start toward the top + y: Math.random() * skew - 0.2, + }, + colors: ["#3298D6"], + shapes: ["circle"], + }); + }, 250); +} + +export const callConfetti = () => { + var duration = 3 * 1000; + var animationEnd = Date.now() + duration; + var defaults = { startVelocity: 30, spread: 360, ticks: 60, zIndex: 0 }; + + function randomInRange(min, max) { + return Math.random() * (max - min) + min; + } + + var interval = setInterval(function () { + var timeLeft = animationEnd - Date.now(); + + if (timeLeft <= 0) { + return clearInterval(interval); + } + + var particleCount = 50 * (timeLeft / duration); + // since particles fall down, start a bit higher than random + confetti({ + ...defaults, + particleCount, + origin: { x: randomInRange(0.1, 0.3), y: Math.random() - 0.2 }, + }); + confetti({ + ...defaults, + particleCount, + origin: { x: randomInRange(0.7, 0.9), y: Math.random() - 0.2 }, + }); + }, 250); +}; + +export const levelConfig = { + 1: { color: "#3872C1" }, + 2: { color: "#FF1276" }, + 3: { color: "#FFB31F" }, + 4: { color: "#BC00FF" }, + 5: { color: "#37C473" }, + 6: { color: "#F810E1" }, + 7: { color: "#634AFF" }, + 8: { color: "#B4CF12" }, + 9: { color: "#00C7E2" }, +}; + +const AllLanguages = [ + { name: "தமிழ்", lang: "ta", symbol: "இ" }, + { name: "English", lang: "en", symbol: "A" }, + { name: "हिंदी", lang: "hi", symbol: "क" }, + { name: "ಕನ್ನಡ", lang: "kn", symbol: "ಕ" }, + { name: "తెలుగు", lang: "te", symbol: "ఈ" }, +]; + +const appLanguages = import.meta.env.VITE_APP_LANGUAGES + ? JSON.parse(import.meta.env.VITE_APP_LANGUAGES) + : []; + +export const languages = AllLanguages.filter((lang) => + appLanguages.includes(lang.lang) +); + +export const randomizeArray = (arr) => { + let wordsArr = [...arr]; + for (let i = wordsArr.length - 1; i > 0; i--) { + let j = Math.floor(Math.random() * i); + let k = wordsArr[i]; + wordsArr[i] = wordsArr[j]; + wordsArr[j] = k; + } + return wordsArr; +};