From 1870f3fdf43707a15fda0f609a021f516f45eb63 Mon Sep 17 00:00:00 2001
From: Piotr Russ <mail@pruss.it>
Date: Wed, 18 Nov 2020 23:15:38 +0100
Subject: finish auth routes, create cookie token, fix folder structure, add
 context to FE

---
 client/src/login/jsx/App.jsx | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

(limited to 'client/src/login/jsx/App.jsx')

diff --git a/client/src/login/jsx/App.jsx b/client/src/login/jsx/App.jsx
index a0109dd..e33e6c2 100644
--- a/client/src/login/jsx/App.jsx
+++ b/client/src/login/jsx/App.jsx
@@ -3,36 +3,34 @@ import ReactDOM from 'react-dom';
 
 import "../scss/index.scss";
 
-import texts from '../../common/data/texts.js';
-import TopBar from '../../common/jsx/TopBar.jsx';
-import Info from '../../common/jsx/Info.jsx';
+import TopBar from '../../admin/jsx/TopBar.jsx';
+import Info from '../../admin/jsx/Info.jsx';
 import LoginPanel from './LoginPanel.jsx';
+import Context from '../../admin/context';
+import { defaultLanguage } from '../../admin/data/translations';
 
 const App = () => {
-  const [lang, setLang] = useState('en');
+  const [lang, setLang] = useState(defaultLanguage);
   const [info, setInfo] = useState('login-info');
   const [hover, setHover] = useState('');
   const [user, setUser] = useState(null);
-  const t = (key) => texts[lang][key] || texts['en'][key];
 
   return (
-    <div className="main">
-      <TopBar
-        lang={lang}
-        setLang={setLang}
-        setHover={setHover}
-        t={t}
-      />
-      <LoginPanel
-        setUser={setUser}
-        t={t}
-      />
-      <Info
-        info={info}
-        hover={hover}
-        t={t}
-      />
-    </div>
+    <Context.Provider value={{ lang, setHover, setInfo }}>
+      <div className="main">
+        <TopBar
+          lang={lang}
+          setLang={setLang}
+        />
+        <LoginPanel
+          setUser={setUser}
+        />
+        <Info
+          info={info}
+          hover={hover}
+        />
+      </div>
+    </Context.Provider>
   )
 };
 
-- 
cgit v1.2.3

