From 0544b8358af68df87dbc472221d8c0842c2b2db0 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 19 May 2023 13:26:47 -0300 Subject: accounts and notifications --- packages/exchange-backoffice-ui/src/Dashboard.tsx | 217 +++++++++++++++++----- 1 file changed, 173 insertions(+), 44 deletions(-) (limited to 'packages/exchange-backoffice-ui/src/Dashboard.tsx') diff --git a/packages/exchange-backoffice-ui/src/Dashboard.tsx b/packages/exchange-backoffice-ui/src/Dashboard.tsx index 9a0ba41d5..9be86c533 100644 --- a/packages/exchange-backoffice-ui/src/Dashboard.tsx +++ b/packages/exchange-backoffice-ui/src/Dashboard.tsx @@ -3,19 +3,26 @@ import { ChevronDownIcon, MagnifyingGlassIcon, UserIcon, + XCircleIcon, } from "@heroicons/react/20/solid"; import { Bars3Icon, BellIcon, + CheckCircleIcon, Cog6ToothIcon, XMarkIcon, } from "@heroicons/react/24/outline"; import { ComponentChildren, Fragment, VNode, h } from "preact"; import { ForwardedRef, forwardRef } from "preact/compat"; -import { useRef, useState } from "preact/hooks"; +import { useEffect, useRef, useState } from "preact/hooks"; import { Pages } from "./pages.js"; import { Router, useCurrentLocation } from "./route.js"; import { InformationCircleIcon } from "@heroicons/react/24/solid"; +import { + useLocalStorage, + useMemoryStorage, + useNotifications, +} from "@gnu-taler/web-util/browser"; /** * references between forms @@ -259,6 +266,7 @@ export function Dashboard({ setSidebarOpen(true); }} /> +
void }) { + const password = useMemoryStorage("password"); + const officer = useLocalStorage("officer"); + return (
@@ -473,3 +490,115 @@ function Footer() { ); } + +function Notifications() { + const ns = useNotifications(); + + // useEffect(() => { + // if (ns.length) { + // // remove notifications after some timeout + // } + // }, []); + { + /* */ + } + console.log("render", ns.length); + return ( +
+
+ {/* */} + {ns.map(({ message, remove }) => { + switch (message.type) { + case "error": { + return ( +
+
+
+
+ +
+
+

+ {message.title} +

+ {message.description && ( +

+ {message.description} +

+ )} +
+
+ +
+
+
+
+ ); + } + case "info": { + return ( +
+
+
+
+ +
+
+

+ {message.title} +

+
+
+ +
+
+
+
+ ); + } + } + })} +
+
+ ); +} -- cgit v1.2.3