From ed2de720d9bea7f6950a7507bd67b43ae8b9b519 Mon Sep 17 00:00:00 2001 From: my8bit Date: Tue, 24 Aug 2021 23:35:18 +0200 Subject: [PATCH] introduce 12 chapters with JsLIGO --- .../Drawer/Drawer.controller.tsx | 12 +- .../app/App.components/Drawer/Drawer.view.tsx | 2 +- src/frontend/src/app/App.routes.tsx | 6 + .../src/pages/Chapter/Chapter.data.tsx | 58 +++++++++ .../src/pages/Chapter/Chapter.view.tsx | 1 + .../Chapters/JS/ChapterConditionals/course.md | 63 ++++++++++ .../JS/ChapterConditionals/exercise.ligo | 8 ++ .../Chapters/JS/ChapterConditionals/index.ts | 11 ++ .../JS/ChapterConditionals/solution.ligo | 16 +++ .../Chapters/JS/ChapterFunctions/course.md | 73 +++++++++++ .../JS/ChapterFunctions/exercise.ligo | 4 + .../Chapters/JS/ChapterFunctions/index.ts | 11 ++ .../JS/ChapterFunctions/solution.ligo | 4 + .../pages/Chapters/JS/ChapterLists/course.md | 73 +++++++++++ .../Chapters/JS/ChapterLists/exercise.ligo | 1 + .../pages/Chapters/JS/ChapterLists/index.ts | 11 ++ .../Chapters/JS/ChapterLists/solution.ligo | 4 + .../Chapters/JS/ChapterMainFunction/course.md | 76 ++++++++++++ .../JS/ChapterMainFunction/exercise.ligo | 23 ++++ .../Chapters/JS/ChapterMainFunction/index.ts | 11 ++ .../JS/ChapterMainFunction/solution.ligo | 23 ++++ .../pages/Chapters/JS/ChapterMaps/course.md | 76 ++++++++++++ .../Chapters/JS/ChapterMaps/exercise.ligo | 2 + .../pages/Chapters/JS/ChapterMaps/index.ts | 11 ++ .../Chapters/JS/ChapterMaps/solution.ligo | 8 ++ .../pages/Chapters/JS/ChapterMath/course.md | 116 ++++++++++++++++++ .../Chapters/JS/ChapterMath/exercise.ligo | 1 + .../pages/Chapters/JS/ChapterMath/index.ts | 11 ++ .../Chapters/JS/ChapterMath/solution.ligo | 4 + .../Chapters/JS/ChapterRecords/course.md | 49 ++++++++ .../Chapters/JS/ChapterRecords/exercise.ligo | 4 + .../pages/Chapters/JS/ChapterRecords/index.ts | 11 ++ .../Chapters/JS/ChapterRecords/solution.ligo | 14 +++ .../Chapters/JS/ChapterStrings/course.md | 64 ++++++++++ .../Chapters/JS/ChapterStrings/exercise.ligo | 3 + .../pages/Chapters/JS/ChapterStrings/index.ts | 11 ++ .../Chapters/JS/ChapterStrings/solution.ligo | 4 + .../pages/Chapters/JS/ChapterTuples/course.md | 42 +++++++ .../Chapters/JS/ChapterTuples/exercise.ligo | 1 + .../pages/Chapters/JS/ChapterTuples/index.ts | 11 ++ .../Chapters/JS/ChapterTuples/solution.ligo | 5 + .../pages/Chapters/JS/ChapterTypes/course.md | 62 ++++++++++ .../Chapters/JS/ChapterTypes/exercise.ligo | 1 + .../pages/Chapters/JS/ChapterTypes/index.ts | 11 ++ .../Chapters/JS/ChapterTypes/solution.ligo | 3 + .../Chapters/JS/ChapterVariables/course.md | 41 +++++++ .../JS/ChapterVariables/exercise.ligo | 3 + .../Chapters/JS/ChapterVariables/index.ts | 11 ++ .../JS/ChapterVariables/solution.ligo | 4 + .../Chapters/JS/ChapterVariant/course.md | 71 +++++++++++ .../Chapters/JS/ChapterVariant/exercise.ligo | 1 + .../pages/Chapters/JS/ChapterVariant/index.ts | 11 ++ .../Chapters/JS/ChapterVariant/solution.ligo | 2 + src/frontend/src/pages/Home/Home.style.tsx | 2 +- src/frontend/src/pages/Home/Home.view.tsx | 15 +++ 55 files changed, 1172 insertions(+), 5 deletions(-) create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterConditionals/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterConditionals/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterConditionals/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterConditionals/solution.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterFunctions/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterFunctions/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterFunctions/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterFunctions/solution.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterLists/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterLists/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterLists/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterLists/solution.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMainFunction/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMainFunction/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMainFunction/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMainFunction/solution.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMaps/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMaps/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMaps/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMaps/solution.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMath/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMath/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMath/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterMath/solution.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterRecords/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterRecords/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterRecords/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterRecords/solution.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterStrings/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterStrings/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterStrings/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterStrings/solution.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterTuples/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterTuples/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterTuples/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterTuples/solution.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterTypes/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterTypes/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterTypes/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterTypes/solution.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterVariables/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterVariables/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterVariables/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterVariables/solution.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterVariant/course.md create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterVariant/exercise.ligo create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterVariant/index.ts create mode 100644 src/frontend/src/pages/Chapters/JS/ChapterVariant/solution.ligo diff --git a/src/frontend/src/app/App.components/Drawer/Drawer.controller.tsx b/src/frontend/src/app/App.components/Drawer/Drawer.controller.tsx index 893ae8b..91d2805 100644 --- a/src/frontend/src/app/App.components/Drawer/Drawer.controller.tsx +++ b/src/frontend/src/app/App.components/Drawer/Drawer.controller.tsx @@ -16,6 +16,7 @@ export const Drawer = () => { let defaultLanguage = 'PascaLIGO' if (pathname.match(/pascal/i)) defaultLanguage = 'PascaLIGO' + if (pathname.match(/js/i)) defaultLanguage = 'JsLIGO' if (pathname.match(/camel/i)) defaultLanguage = 'CameLIGO' if (pathname.match(/reason/i)) defaultLanguage = 'ReasonLIGO' const [activeLanguage, setActiveLanguage] = useState(defaultLanguage) @@ -23,6 +24,7 @@ export const Drawer = () => { useEffect(() => { let defaultLanguage = 'PascaLIGO' if (pathname.match(/pascal/i)) defaultLanguage = 'PascaLIGO' + if (pathname.match(/js/i)) defaultLanguage = 'JsLIGO' if (pathname.match(/camel/i)) defaultLanguage = 'CameLIGO' if (pathname.match(/reason/i)) defaultLanguage = 'ReasonLIGO' setActiveLanguage(defaultLanguage) @@ -37,15 +39,19 @@ export const Drawer = () => { function changeLanguageCallback(e: string) { console.log(e) if (e === 'PascaLIGO') { - history.push(pathname.replace(new RegExp('camel|reason', 'i'), 'pascal')) + history.push(pathname.replace(new RegExp('camel|reason|js', 'i'), 'pascal')) setActiveLanguage('PascaLIGO') } + if (e === 'JsLIGO') { + history.push(pathname.replace(new RegExp('camel|reason|pascal', 'i'), 'js')) + setActiveLanguage('JsLIGO') + } if (e === 'CameLIGO') { - history.push(pathname.replace(new RegExp('pascal|reason', 'i'), 'camel')) + history.push(pathname.replace(new RegExp('pascal|reason|js', 'i'), 'camel')) setActiveLanguage('CameLIGO') } if (e === 'ReasonLIGO') { - history.push(pathname.replace(new RegExp('camel|pascal', 'i'), 'reason')) + history.push(pathname.replace(new RegExp('camel|pascal|js', 'i'), 'reason')) setActiveLanguage('ReasonLIGO') } } diff --git a/src/frontend/src/app/App.components/Drawer/Drawer.view.tsx b/src/frontend/src/app/App.components/Drawer/Drawer.view.tsx index a0941a3..90b10b1 100644 --- a/src/frontend/src/app/App.components/Drawer/Drawer.view.tsx +++ b/src/frontend/src/app/App.components/Drawer/Drawer.view.tsx @@ -31,7 +31,7 @@ export const DrawerView = ({

Menu