From 4d642e312ed728ad51c454d1e2a0b7bb350fc174 Mon Sep 17 00:00:00 2001
From: Piotr Russ <mail@pruss.it>
Date: Sun, 6 Dec 2020 23:49:13 +0100
Subject: first creator page

---
 client/src/admin/jsx/layout/UserSwitch.jsx | 39 ++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 client/src/admin/jsx/layout/UserSwitch.jsx

(limited to 'client/src/admin/jsx/layout/UserSwitch.jsx')

diff --git a/client/src/admin/jsx/layout/UserSwitch.jsx b/client/src/admin/jsx/layout/UserSwitch.jsx
new file mode 100644
index 0000000..403783c
--- /dev/null
+++ b/client/src/admin/jsx/layout/UserSwitch.jsx
@@ -0,0 +1,39 @@
+import React from 'react';
+import { WithHover, t } from '../../hocs';
+import { logout } from '../../api';
+
+const User = ({ user, setUser, opened, setOpened }) => {
+  const handleLogout = () => {
+    setOpened(false);
+    logout();
+  };
+  const handleChangePass = () => { setOpened(false) };
+  const handleRemoveUser = () => { setOpened(false) };
+
+  return (
+    <div className="user">
+      <WithHover message="click-to-change-user">
+        <span
+          className={`user__main-item${opened === 'user' ? ' user__main-item--active' : ''}`}
+          onClick={() => setOpened(opened !== 'user' ? 'user' : false)}
+        >
+          {user.email}
+        </span>
+        {
+          opened === 'user' && (
+            <div className="user__list" >
+              <WithHover message="click-to-logout">
+                <span className="user__item" onClick={handleLogout}>{t('logout')}</span>
+              </WithHover>
+              <WithHover message="click-to-change-user-settings">
+                <span className="user__item" onClick={handleChangePass}>{t('user-settings')}</span>
+              </WithHover>
+            </div>
+          )
+        }
+      </WithHover>
+    </div>
+  );
+};
+
+export default User;
-- 
cgit v1.2.3

