+ {/* poner aqui la aplicacion */}
Hello {username}!
@@ -47,7 +54,7 @@ const Login = () => {
) : (
- Login
+ {t('login')}
{
value={password}
onChange={(e) => setPassword(e.target.value)}
/>
-
+
+
{error && (
setError('')} message={`Error: ${error}`} />
diff --git a/webapp/src/constants/index.ts b/webapp/src/constants/index.ts
new file mode 100644
index 0000000..963e29a
--- /dev/null
+++ b/webapp/src/constants/index.ts
@@ -0,0 +1,4 @@
+export const LANGUAGES = [
+ { label: 'Spanish', code: 'es'},
+ { label: 'English', code: 'en'},
+]
\ No newline at end of file
diff --git a/webapp/src/i18n.ts b/webapp/src/i18n.ts
new file mode 100644
index 0000000..827b6c5
--- /dev/null
+++ b/webapp/src/i18n.ts
@@ -0,0 +1,38 @@
+import i18n from 'i18next';
+import { initReactI18next } from 'react-i18next';
+
+i18n
+ .use(initReactI18next)
+ .init({
+ lng: 'en',
+ fallbackLng: 'en',
+ interpolation:{
+ escapeValue: false
+ },
+ resources: {
+ en: {
+ translation: {
+ app_name: 'Conocer y Vencer',
+ login: 'Login',
+ go_back: 'Go back',
+ register: 'Register',
+ add_user: 'Add user',
+ login_google: 'Login with Google'
+ }
+ },
+ es: {
+ translation: {
+ app_name: 'Conocer y Vencer',
+ login: 'Iniciar sesión',
+ go_back: 'Ir atrás',
+ register: 'Registrarse',
+ add_user: 'Añadir usuario',
+ login_google: 'Iniciar sesión con Google'
+ }
+ },
+
+ }
+ });
+
+
+export default i18n;
\ No newline at end of file
diff --git a/webapp/src/index.js b/webapp/src/index.tsx
similarity index 92%
rename from webapp/src/index.js
rename to webapp/src/index.tsx
index d563c0f..5b87300 100644
--- a/webapp/src/index.js
+++ b/webapp/src/index.tsx
@@ -1,10 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
-import App from './App';
+import App from './App'
import reportWebVitals from './reportWebVitals';
-const root = ReactDOM.createRoot(document.getElementById('root'));
+const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
diff --git a/webapp/src/reportWebVitals.js b/webapp/src/reportWebVitals.ts
similarity index 68%
rename from webapp/src/reportWebVitals.js
rename to webapp/src/reportWebVitals.ts
index 5253d3a..c0ca77c 100644
--- a/webapp/src/reportWebVitals.js
+++ b/webapp/src/reportWebVitals.ts
@@ -1,4 +1,6 @@
-const reportWebVitals = onPerfEntry => {
+import { ReportHandler } from 'web-vitals';
+
+const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
@@ -10,4 +12,4 @@ const reportWebVitals = onPerfEntry => {
}
};
-export default reportWebVitals;
+export default reportWebVitals;
\ No newline at end of file
diff --git a/webapp/tsconfig.json b/webapp/tsconfig.json
index b6f849c..b6cef81 100644
--- a/webapp/tsconfig.json
+++ b/webapp/tsconfig.json
@@ -5,6 +5,11 @@
"ESNext",
"dom"
],
+
+ "types":["node"],
+ "jsx":"react-jsx",
+ "module": "esnext",
+
"outDir": "lib",
"removeComments": true,
"target": "ES6",
@@ -32,7 +37,7 @@
"noUnusedLocals": true,
"noUnusedParameters": true
},
- "include": ["./**/*.ts"],
+ "include": ["./**/*.tsx", "src/index.tsx"],
"exclude": [
"node_modules/**/*"
]