From 6863e107906f598b49332b5419eafe05cf954164 Mon Sep 17 00:00:00 2001 From: Alexander Bentkamp Date: Wed, 19 Oct 2022 13:56:48 +0200 Subject: [PATCH] convert all files to typescript --- client/src/{App.js => App.tsx} | 3 ++- client/src/components/{GoodBye.js => GoodBye.tsx} | 2 +- client/src/components/{InputZone.js => InputZone.tsx} | 7 ++++--- client/src/components/{LeftPanel.js => LeftPanel.tsx} | 3 ++- client/src/components/{Level.js => Level.tsx} | 5 +++-- client/src/components/{Message.js => Message.tsx} | 2 +- client/src/components/{TacticState.js => TacticState.tsx} | 8 ++++---- client/src/components/{Welcome.js => Welcome.tsx} | 5 +++-- tsconfig.json | 2 -- 9 files changed, 20 insertions(+), 17 deletions(-) rename client/src/{App.js => App.tsx} (97%) rename client/src/components/{GoodBye.js => GoodBye.tsx} (94%) rename client/src/components/{InputZone.js => InputZone.tsx} (92%) rename client/src/components/{LeftPanel.js => LeftPanel.tsx} (96%) rename client/src/components/{Level.js => Level.tsx} (95%) rename client/src/components/{Message.js => Message.tsx} (93%) rename client/src/components/{TacticState.js => TacticState.tsx} (91%) rename client/src/components/{Welcome.js => Welcome.tsx} (88%) diff --git a/client/src/App.js b/client/src/App.tsx similarity index 97% rename from client/src/App.js rename to client/src/App.tsx index 845e5ee..030c505 100644 --- a/client/src/App.js +++ b/client/src/App.tsx @@ -1,4 +1,5 @@ -import React, { useState } from 'react'; +import * as React from 'react'; +import { useState } from 'react'; import { MathJaxContext } from "better-react-mathjax"; import useWebSocket from 'react-use-websocket'; diff --git a/client/src/components/GoodBye.js b/client/src/components/GoodBye.tsx similarity index 94% rename from client/src/components/GoodBye.js rename to client/src/components/GoodBye.tsx index 9dc46fc..e6d135f 100644 --- a/client/src/components/GoodBye.js +++ b/client/src/components/GoodBye.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import '@fontsource/roboto/300.css'; import '@fontsource/roboto/400.css'; import '@fontsource/roboto/500.css'; diff --git a/client/src/components/InputZone.js b/client/src/components/InputZone.tsx similarity index 92% rename from client/src/components/InputZone.js rename to client/src/components/InputZone.tsx index e42f08b..3719237 100644 --- a/client/src/components/InputZone.js +++ b/client/src/components/InputZone.tsx @@ -1,4 +1,5 @@ -import React, { useEffect, useState } from 'react'; +import * as React from 'react'; +import { useEffect, useState } from 'react'; import '@fontsource/roboto/300.css'; import '@fontsource/roboto/400.css'; import '@fontsource/roboto/500.css'; @@ -10,8 +11,8 @@ import { Typography, Button, Paper, TextField, List, ListItem } from '@mui/mater function InputZone({ index, history, messageOpen, setMessageOpen, completed, sendTactic, nbLevels, loadNextLevel, errors, lastTactic, undo, finishGame }) { const [curInput, setCurInput] = useState("") - const inputRef = React.createRef() - const nextRef = React.createRef() + const inputRef = React.createRef() + const nextRef = React.createRef() function handleCurInputChange(evt) { setCurInput(evt.target.value) } diff --git a/client/src/components/LeftPanel.js b/client/src/components/LeftPanel.tsx similarity index 96% rename from client/src/components/LeftPanel.js rename to client/src/components/LeftPanel.tsx index a7a9050..3f4132d 100644 --- a/client/src/components/LeftPanel.js +++ b/client/src/components/LeftPanel.tsx @@ -1,4 +1,5 @@ -import React, { useState, useEffect } from 'react'; +import * as React from 'react'; +import { useState, useEffect } from 'react'; import ReactMarkdown from 'react-markdown'; import { MathJax } from "better-react-mathjax"; import '@fontsource/roboto/300.css'; diff --git a/client/src/components/Level.js b/client/src/components/Level.tsx similarity index 95% rename from client/src/components/Level.js rename to client/src/components/Level.tsx index 722f4d2..aa9bbfb 100644 --- a/client/src/components/Level.js +++ b/client/src/components/Level.tsx @@ -1,4 +1,5 @@ -import React, { useEffect, useState } from 'react'; +import * as React from 'react'; +import { useEffect, useState } from 'react'; import '@fontsource/roboto/300.css'; import '@fontsource/roboto/400.css'; import '@fontsource/roboto/500.css'; @@ -18,7 +19,7 @@ function Level({ sendJsonMessage, lastMessage, lastJsonMessage, nbLevels, level, const [tacticDocs, setTacticDocs] = useState([]) const [lemmaDocs, setLemmaDocs] = useState([]) - const [leanData, setLeanData] = useState({}) + const [leanData, setLeanData] = useState({goals: []}) const [history, setHistory] = useState([]) const [lastTactic, setLastTactic] = useState("") const [errors, setErrors] = useState([]) diff --git a/client/src/components/Message.js b/client/src/components/Message.tsx similarity index 93% rename from client/src/components/Message.js rename to client/src/components/Message.tsx index 14e538f..a6653bf 100644 --- a/client/src/components/Message.js +++ b/client/src/components/Message.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import ReactMarkdown from 'react-markdown'; import { MathJax } from "better-react-mathjax"; import '@fontsource/roboto/300.css'; diff --git a/client/src/components/TacticState.js b/client/src/components/TacticState.tsx similarity index 91% rename from client/src/components/TacticState.js rename to client/src/components/TacticState.tsx index 42d96af..b2f3c5b 100644 --- a/client/src/components/TacticState.js +++ b/client/src/components/TacticState.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import '@fontsource/roboto/300.css'; import '@fontsource/roboto/400.css'; import '@fontsource/roboto/500.css'; @@ -15,7 +15,7 @@ function Goal({ goal }) { const hasAssumption = typeof goal.assumptions === "object" && goal.assumptions.length > 0 return ( - {hasObject && Objects + {hasObject && Objects {goal.objects.map((item) => @@ -23,12 +23,12 @@ function Goal({ goal }) { {item[1]} )} } - {hasAssumption && Assumptions + {hasAssumption && Assumptions {goal.assumptions.map((item) => {item[0]} : {item[1]})} } - Prove: + Prove: {goal.goal} ) } diff --git a/client/src/components/Welcome.js b/client/src/components/Welcome.tsx similarity index 88% rename from client/src/components/Welcome.js rename to client/src/components/Welcome.tsx index d277fb3..c231385 100644 --- a/client/src/components/Welcome.js +++ b/client/src/components/Welcome.tsx @@ -1,4 +1,5 @@ -import React, { useState, useEffect } from 'react'; +import * as React from 'react'; +import { useState, useEffect } from 'react'; import ReactMarkdown from 'react-markdown'; import { MathJax } from "better-react-mathjax"; import '@fontsource/roboto/300.css'; @@ -9,7 +10,7 @@ import '@fontsource/roboto/700.css'; import { Box, Typography, Button, CircularProgress, Grid } from '@mui/material'; -function Welcome({ sendJsonMessage, lastJsonMessage, setNbLevels, setTitle, startGame, setConclusion }) { +function Welcome({ sendJsonMessage, lastJsonMessage, lastMessage, setNbLevels, setTitle, startGame, setConclusion }) { const [leanData, setLeanData] = useState({}) diff --git a/tsconfig.json b/tsconfig.json index 302a246..b55636b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,10 +1,8 @@ { "compilerOptions": { "outDir": "./client/dist/", - "noImplicitAny": true, "module": "es6", "target": "es5", - "jsx": "react", "allowJs": true, "moduleResolution": "node", "jsx": "react",