From e1d86816a7c07cb8ca2d54676d5cdbbe513f2ba7 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 4 Sep 2023 14:17:55 -0300
Subject: backoffcie new version, lot of changes

---
 .../src/components/menu/index.tsx                  | 58 ++++++++++++++++++----
 1 file changed, 49 insertions(+), 9 deletions(-)

(limited to 'packages/merchant-backoffice-ui/src/components/menu/index.tsx')

diff --git a/packages/merchant-backoffice-ui/src/components/menu/index.tsx b/packages/merchant-backoffice-ui/src/components/menu/index.tsx
index cdbae4ae0..cb318906f 100644
--- a/packages/merchant-backoffice-ui/src/components/menu/index.tsx
+++ b/packages/merchant-backoffice-ui/src/components/menu/index.tsx
@@ -24,7 +24,7 @@ import { Sidebar } from "./SideBar.js";
 
 function getInstanceTitle(path: string, id: string): string {
   switch (path) {
-    case InstancePaths.update:
+    case InstancePaths.server:
       return `${id}: Settings`;
     case InstancePaths.order_list:
       return `${id}: Orders`;
@@ -50,6 +50,12 @@ function getInstanceTitle(path: string, id: string): string {
       return `${id}: New webhook`;
     case InstancePaths.webhooks_update:
       return `${id}: Update webhook`;
+    case InstancePaths.validators_list:
+      return `${id}: Validators`;
+    case InstancePaths.validators_new:
+      return `${id}: New validator`;
+    case InstancePaths.validators_update:
+      return `${id}: Update validators`;
     case InstancePaths.templates_new:
       return `${id}: New template`;
     case InstancePaths.templates_update:
@@ -58,6 +64,10 @@ function getInstanceTitle(path: string, id: string): string {
       return `${id}: Templates`;
     case InstancePaths.templates_use:
       return `${id}: Use template`;
+    case InstancePaths.settings:
+      return `${id}: Interface`;
+    case InstancePaths.settings:
+      return `${id}: Interface`;
     default:
       return "";
   }
@@ -77,6 +87,7 @@ interface MenuProps {
   onLogout?: () => void;
   onShowSettings: () => void;
   setInstanceName: (s: string) => void;
+  isPasswordOk: boolean;
 }
 
 function WithTitle({
@@ -100,14 +111,15 @@ export function Menu({
   path,
   admin,
   setInstanceName,
+  isPasswordOk
 }: MenuProps): VNode {
   const [mobileOpen, setMobileOpen] = useState(false);
 
   const titleWithSubtitle = title
     ? title
     : !admin
-    ? getInstanceTitle(path, instance)
-    : getAdminTitle(path, instance);
+      ? getInstanceTitle(path, instance)
+      : getAdminTitle(path, instance);
   const adminInstance = instance === "default";
   const mimic = admin && !adminInstance;
   return (
@@ -129,14 +141,15 @@ export function Menu({
             mimic={mimic}
             instance={instance}
             mobile={mobileOpen}
+            isPasswordOk={isPasswordOk}
           />
         )}
 
         {mimic && (
           <nav class="level" style={{
             zIndex: 100,
-            position:"fixed",
-            width:"50%",
+            position: "fixed",
+            width: "50%",
             marginLeft: "20%"
           }}>
             <div class="level-item has-text-centered has-background-warning">
@@ -161,8 +174,9 @@ export function Menu({
 
 interface NotYetReadyAppMenuProps {
   title: string;
-  onLogout?: () => void;
   onShowSettings: () => void;
+  onLogout?: () => void;
+  isPasswordOk: boolean;
 }
 
 interface NotifProps {
@@ -181,8 +195,8 @@ export function NotificationCard({
               n.type === "ERROR"
                 ? "message is-danger"
                 : n.type === "WARN"
-                ? "message is-warning"
-                : "message is-info"
+                  ? "message is-warning"
+                  : "message is-info"
             }
           >
             <div class="message-header">
@@ -201,10 +215,36 @@ export function NotificationCard({
   );
 }
 
+interface NotConnectedAppMenuProps {
+  title: string;
+}
+export function NotConnectedAppMenu({
+  title,
+}: NotConnectedAppMenuProps): VNode {
+  const [mobileOpen, setMobileOpen] = useState(false);
+
+  useEffect(() => {
+    document.title = `Taler Backoffice: ${title}`;
+  }, [title]);
+
+  return (
+    <div
+      class={mobileOpen ? "has-aside-mobile-expanded" : ""}
+      onClick={() => setMobileOpen(false)}
+    >
+      <NavigationBar
+        onMobileMenu={() => setMobileOpen(!mobileOpen)}
+        title={title}
+      />
+    </div>
+  );
+}
+
 export function NotYetReadyAppMenu({
   onLogout,
   onShowSettings,
   title,
+  isPasswordOk
 }: NotYetReadyAppMenuProps): VNode {
   const [mobileOpen, setMobileOpen] = useState(false);
 
@@ -222,7 +262,7 @@ export function NotYetReadyAppMenu({
         title={title}
       />
       {onLogout && (
-        <Sidebar onShowSettings={onShowSettings} onLogout={onLogout} instance="" mobile={mobileOpen} />
+        <Sidebar onShowSettings={onShowSettings} onLogout={onLogout} instance="" mobile={mobileOpen} isPasswordOk={isPasswordOk} />
       )}
     </div>
   );
-- 
cgit v1.2.3

