From c680f5aa71b08e978444df07f93c381f9d47ab82 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 5 Jun 2023 10:04:09 -0300 Subject: rename aml --- packages/aml-backoffice-ui/src/App.tsx | 12 + packages/aml-backoffice-ui/src/Dashboard.tsx | 599 +++++++++++++++ packages/aml-backoffice-ui/src/NiceForm.tsx | 59 ++ packages/aml-backoffice-ui/src/account.ts | 92 +++ .../aml-backoffice-ui/src/assets/logo-2021.svg | 9 + packages/aml-backoffice-ui/src/declaration.d.ts | 30 + packages/aml-backoffice-ui/src/forms/902_11e.ts | 154 ++++ packages/aml-backoffice-ui/src/forms/902_12e.ts | 440 +++++++++++ packages/aml-backoffice-ui/src/forms/902_13e.ts | 527 +++++++++++++ packages/aml-backoffice-ui/src/forms/902_15e.ts | 197 +++++ packages/aml-backoffice-ui/src/forms/902_1e.ts | 695 +++++++++++++++++ packages/aml-backoffice-ui/src/forms/902_4e.ts | 822 +++++++++++++++++++++ packages/aml-backoffice-ui/src/forms/902_5e.ts | 281 +++++++ packages/aml-backoffice-ui/src/forms/902_9e.ts | 138 ++++ packages/aml-backoffice-ui/src/forms/index.ts | 146 ++++ packages/aml-backoffice-ui/src/forms/simplest.ts | 103 +++ .../aml-backoffice-ui/src/handlers/Caption.tsx | 35 + .../src/handlers/FormProvider.tsx | 99 +++ packages/aml-backoffice-ui/src/handlers/Group.tsx | 41 + .../aml-backoffice-ui/src/handlers/InputAmount.tsx | 34 + .../aml-backoffice-ui/src/handlers/InputArray.tsx | 183 +++++ .../src/handlers/InputChoiceHorizontal.tsx | 86 +++ .../src/handlers/InputChoiceStacked.tsx | 111 +++ .../aml-backoffice-ui/src/handlers/InputDate.tsx | 37 + .../aml-backoffice-ui/src/handlers/InputFile.tsx | 101 +++ .../src/handlers/InputInteger.tsx | 23 + .../aml-backoffice-ui/src/handlers/InputLine.tsx | 282 +++++++ .../src/handlers/InputSelectMultiple.tsx | 151 ++++ .../src/handlers/InputSelectOne.tsx | 134 ++++ .../aml-backoffice-ui/src/handlers/InputText.tsx | 8 + .../src/handlers/InputTextArea.tsx | 8 + packages/aml-backoffice-ui/src/handlers/forms.ts | 135 ++++ .../aml-backoffice-ui/src/handlers/useField.ts | 93 +++ packages/aml-backoffice-ui/src/hooks/useOfficer.ts | 100 +++ packages/aml-backoffice-ui/src/i18n/bank.pot | 486 ++++++++++++ packages/aml-backoffice-ui/src/i18n/de.po | 486 ++++++++++++ packages/aml-backoffice-ui/src/i18n/en.po | 511 +++++++++++++ packages/aml-backoffice-ui/src/i18n/es.po | 497 +++++++++++++ packages/aml-backoffice-ui/src/i18n/fr.po | 486 ++++++++++++ packages/aml-backoffice-ui/src/i18n/it.po | 521 +++++++++++++ packages/aml-backoffice-ui/src/i18n/poheader | 26 + .../aml-backoffice-ui/src/i18n/strings-prelude | 19 + packages/aml-backoffice-ui/src/i18n/strings.ts | 510 +++++++++++++ packages/aml-backoffice-ui/src/index.html | 42 ++ packages/aml-backoffice-ui/src/index.tsx | 22 + packages/aml-backoffice-ui/src/pages.ts | 55 ++ .../src/pages/AntiMoneyLaunderingForm.tsx | 90 +++ .../aml-backoffice-ui/src/pages/CaseDetails.tsx | 447 +++++++++++ packages/aml-backoffice-ui/src/pages/Cases.tsx | 288 ++++++++ .../aml-backoffice-ui/src/pages/CreateAccount.tsx | 102 +++ .../src/pages/HandleAccountNotReady.tsx | 34 + packages/aml-backoffice-ui/src/pages/Home.tsx | 5 + .../aml-backoffice-ui/src/pages/NewFormEntry.tsx | 76 ++ packages/aml-backoffice-ui/src/pages/Officer.tsx | 55 ++ packages/aml-backoffice-ui/src/pages/Settings.tsx | 5 + .../aml-backoffice-ui/src/pages/UnlockAccount.tsx | 81 ++ packages/aml-backoffice-ui/src/pages/Welcome.tsx | 9 + packages/aml-backoffice-ui/src/route.ts | 167 +++++ packages/aml-backoffice-ui/src/scss/main.css | 3 + packages/aml-backoffice-ui/src/stories.test.ts | 56 ++ packages/aml-backoffice-ui/src/stories.tsx | 44 ++ packages/aml-backoffice-ui/src/types.ts | 81 ++ 62 files changed, 11169 insertions(+) create mode 100644 packages/aml-backoffice-ui/src/App.tsx create mode 100644 packages/aml-backoffice-ui/src/Dashboard.tsx create mode 100644 packages/aml-backoffice-ui/src/NiceForm.tsx create mode 100644 packages/aml-backoffice-ui/src/account.ts create mode 100644 packages/aml-backoffice-ui/src/assets/logo-2021.svg create mode 100644 packages/aml-backoffice-ui/src/declaration.d.ts create mode 100644 packages/aml-backoffice-ui/src/forms/902_11e.ts create mode 100644 packages/aml-backoffice-ui/src/forms/902_12e.ts create mode 100644 packages/aml-backoffice-ui/src/forms/902_13e.ts create mode 100644 packages/aml-backoffice-ui/src/forms/902_15e.ts create mode 100644 packages/aml-backoffice-ui/src/forms/902_1e.ts create mode 100644 packages/aml-backoffice-ui/src/forms/902_4e.ts create mode 100644 packages/aml-backoffice-ui/src/forms/902_5e.ts create mode 100644 packages/aml-backoffice-ui/src/forms/902_9e.ts create mode 100644 packages/aml-backoffice-ui/src/forms/index.ts create mode 100644 packages/aml-backoffice-ui/src/forms/simplest.ts create mode 100644 packages/aml-backoffice-ui/src/handlers/Caption.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/FormProvider.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/Group.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputAmount.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputArray.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputChoiceHorizontal.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputChoiceStacked.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputDate.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputFile.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputInteger.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputLine.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputSelectMultiple.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputSelectOne.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputText.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/InputTextArea.tsx create mode 100644 packages/aml-backoffice-ui/src/handlers/forms.ts create mode 100644 packages/aml-backoffice-ui/src/handlers/useField.ts create mode 100644 packages/aml-backoffice-ui/src/hooks/useOfficer.ts create mode 100644 packages/aml-backoffice-ui/src/i18n/bank.pot create mode 100644 packages/aml-backoffice-ui/src/i18n/de.po create mode 100644 packages/aml-backoffice-ui/src/i18n/en.po create mode 100644 packages/aml-backoffice-ui/src/i18n/es.po create mode 100644 packages/aml-backoffice-ui/src/i18n/fr.po create mode 100644 packages/aml-backoffice-ui/src/i18n/it.po create mode 100644 packages/aml-backoffice-ui/src/i18n/poheader create mode 100644 packages/aml-backoffice-ui/src/i18n/strings-prelude create mode 100644 packages/aml-backoffice-ui/src/i18n/strings.ts create mode 100644 packages/aml-backoffice-ui/src/index.html create mode 100644 packages/aml-backoffice-ui/src/index.tsx create mode 100644 packages/aml-backoffice-ui/src/pages.ts create mode 100644 packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx create mode 100644 packages/aml-backoffice-ui/src/pages/CaseDetails.tsx create mode 100644 packages/aml-backoffice-ui/src/pages/Cases.tsx create mode 100644 packages/aml-backoffice-ui/src/pages/CreateAccount.tsx create mode 100644 packages/aml-backoffice-ui/src/pages/HandleAccountNotReady.tsx create mode 100644 packages/aml-backoffice-ui/src/pages/Home.tsx create mode 100644 packages/aml-backoffice-ui/src/pages/NewFormEntry.tsx create mode 100644 packages/aml-backoffice-ui/src/pages/Officer.tsx create mode 100644 packages/aml-backoffice-ui/src/pages/Settings.tsx create mode 100644 packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx create mode 100644 packages/aml-backoffice-ui/src/pages/Welcome.tsx create mode 100644 packages/aml-backoffice-ui/src/route.ts create mode 100644 packages/aml-backoffice-ui/src/scss/main.css create mode 100644 packages/aml-backoffice-ui/src/stories.test.ts create mode 100644 packages/aml-backoffice-ui/src/stories.tsx create mode 100644 packages/aml-backoffice-ui/src/types.ts (limited to 'packages/aml-backoffice-ui/src') diff --git a/packages/aml-backoffice-ui/src/App.tsx b/packages/aml-backoffice-ui/src/App.tsx new file mode 100644 index 000000000..600131219 --- /dev/null +++ b/packages/aml-backoffice-ui/src/App.tsx @@ -0,0 +1,12 @@ +import { TranslationProvider } from "@gnu-taler/web-util/browser"; +import { h, VNode } from "preact"; +import { Dashboard } from "./Dashboard.js"; +import "./scss/main.css"; + +export function App(): VNode { + return ( + + + + ); +} diff --git a/packages/aml-backoffice-ui/src/Dashboard.tsx b/packages/aml-backoffice-ui/src/Dashboard.tsx new file mode 100644 index 000000000..6794ca1f8 --- /dev/null +++ b/packages/aml-backoffice-ui/src/Dashboard.tsx @@ -0,0 +1,599 @@ +import { useNotifications } from "@gnu-taler/web-util/browser"; +import { Dialog, Transition } from "@headlessui/react"; +import { UserIcon, XCircleIcon } from "@heroicons/react/20/solid"; +import { CheckCircleIcon, XMarkIcon } from "@heroicons/react/24/outline"; +import { InformationCircleIcon } from "@heroicons/react/24/solid"; +import { ComponentChildren, Fragment, VNode, h } from "preact"; +import { useState } from "preact/hooks"; +import logo from "./assets/logo-2021.svg"; +import { Pages } from "./pages.js"; +import { Router, useCurrentLocation } from "./route.js"; + +function classNames(...classes: string[]) { + return classes.filter(Boolean).join(" "); +} + +/** + * mapping route to view + * not found (error page) + * nested, index element, relative routes + * link interception + * form POST interception, call action + * fromData => Object.fromEntries + * segments in the URL + * navigationState: idle, submitting, loading + * form GET interception: does a navigateTo + * form GET Sync: + * 1.- back after submit: useEffect to sync URL to form + * 2.- refresh after submit: input default value + * useSubmit for form submission onChange, history replace + * + * post form without redirect + * + * + * @param param0 + * @returns + */ + +const GIT_HASH = typeof __GIT_HASH__ !== "undefined" ? __GIT_HASH__ : undefined; +const VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : undefined; + +const versionText = VERSION + ? GIT_HASH + ? `v${VERSION} (${GIT_HASH.substring(0, 8)})` + : VERSION + : ""; + +/** + * TO BE FIXED: + * + * 1.- when the form change to other form and both form share the same structure + * the same input component may be rendered in the same place, + * since input are uncontrolled the are not re-rendered and since they are + * uncontrolled it will keep the value of the previous form. + * One solutions could be to remove the form when unloading and when the new + * form load it will start without previous vdom, preventing the cache + * to create this behavior. + * Other solutions could be using IDs in the fields that are constructed + * with the ID of the form, so two fields of different form will need to re-render + * cleaning up the state of the previous form. + * + * 2.- currently the design prop and the behavior prop of the flexible form + * are two side of the same coin. From the design point of view, it is important + * to design the form in a list-of-field manner and there may be additional + * content that is not directly mapped to the form structure (object) + * So maybe we want to change the current shape so the computation of the state + * of the form is in a field level, but this computation required the field value and + * the whole form values and state (since one field may be disabled/hidden) because + * of the value of other field. + * + * 3.- given the previous requirement, maybe the name of the field of the form could be + * a function (P: F -> V) where F is the form (or parent object) and V is the type of the + * property. That will help with the typing of the forms props + * + * 4.- tooltip are not placed correctly: the arrow should point the question mark + * and the text area should be bigger + * + * 5.- date field should have the calendar icon clickable so the user can select date without + * writing text with the correct format + */ + +function LeftMenu() { + const currentLocation = useCurrentLocation(pageList); + + return ( + + ); +} + +export function Dashboard({ + children, +}: { + children?: ComponentChildren; +}): VNode { + const [sidebarOpen, setSidebarOpen] = useState(false); + + return ( + + +
+
+
+

+ Exchange AML Backoffice +

+
+
+ +
+
+
+
+ { + setSidebarOpen(true); + }} + /> + +
+
+ { + return
not found
; + }} + /> +
+
+
+
+ ); +} + +const pageList = Object.values(Pages); + +function NavigationBar({ + isOpen, + setOpen, + children, +}: { + isOpen: boolean; + setOpen: (v: boolean) => void; + children: ComponentChildren; +}) { + return ( + + + + +
+ + +
+ + + +
+ +
+
+ {children} +
+
+
+
+
+ + +
+ ); +} + +function TopBar({ onOpenSidebar }: { onOpenSidebar: () => void }) { + return ( +
+
+ +
+
+
+ Taler +
+
+ {/*
dd
*/} +
+ ); +} + +// return ( +//
+// + +// {/* Separator */} +//