From a5406c5a5dc437e036168eb068db11d88e05bb0f Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 19 Sep 2023 08:31:08 -0300 Subject: some ui --- packages/demobank-ui/src/components/CopyButton.tsx | 102 ++++++++++----------- packages/demobank-ui/src/components/Routing.tsx | 5 + .../src/components/Transactions/views.tsx | 76 +++++++-------- packages/demobank-ui/src/components/app.tsx | 1 - 4 files changed, 96 insertions(+), 88 deletions(-) (limited to 'packages/demobank-ui/src/components') diff --git a/packages/demobank-ui/src/components/CopyButton.tsx b/packages/demobank-ui/src/components/CopyButton.tsx index c61083074..97ccbf2bf 100644 --- a/packages/demobank-ui/src/components/CopyButton.tsx +++ b/packages/demobank-ui/src/components/CopyButton.tsx @@ -4,57 +4,57 @@ import { useEffect, useState } from "preact/hooks"; export function CopyIcon(): VNode { - return ( - - - - - ) - }; - - export function CopiedIcon(): VNode { - return ( - - - - ) - }; - -export function CopyButton({ getContent }: { getContent: () => string }): VNode { - const [copied, setCopied] = useState(false); - function copyText(): void { - navigator.clipboard.writeText(getContent() || ""); - setCopied(true); - } - useEffect(() => { - if (copied) { - setTimeout(() => { - setCopied(false); - }, 1000); - } - }, [copied]); - - if (!copied) { - return ( - - ); + return ( + + + + + ) +}; + +export function CopiedIcon(): VNode { + return ( + + + + ) +}; + +export function CopyButton({ getContent }: { getContent: () => string }): VNode { + const [copied, setCopied] = useState(false); + function copyText(): void { + navigator.clipboard.writeText(getContent() || ""); + setCopied(true); + } + useEffect(() => { + if (copied) { + setTimeout(() => { + setCopied(false); + }, 1000); } + }, [copied]); + + if (!copied) { return ( -
- -
+ ); - } \ No newline at end of file + } + return ( +
+ +
+ ); +} \ No newline at end of file diff --git a/packages/demobank-ui/src/components/Routing.tsx b/packages/demobank-ui/src/components/Routing.tsx index d5ea44e10..2c532e863 100644 --- a/packages/demobank-ui/src/components/Routing.tsx +++ b/packages/demobank-ui/src/components/Routing.tsx @@ -23,6 +23,7 @@ import { BusinessAccount } from "../pages/BusinessAccount.js"; import { HomePage, WithdrawalOperationPage } from "../pages/HomePage.js"; import { PublicHistoriesPage } from "../pages/PublicHistoriesPage.js"; import { RegistrationPage } from "../pages/RegistrationPage.js"; +import { Test } from "../pages/Test.js"; export function Routing(): VNode { const history = createHashHistory(); @@ -34,6 +35,10 @@ export function Routing(): VNode { }} > + ( diff --git a/packages/demobank-ui/src/components/Transactions/views.tsx b/packages/demobank-ui/src/components/Transactions/views.tsx index 34d078c16..f4a78e516 100644 --- a/packages/demobank-ui/src/components/Transactions/views.tsx +++ b/packages/demobank-ui/src/components/Transactions/views.tsx @@ -33,42 +33,46 @@ export function LoadingUriView({ error }: State.LoadingUriError): VNode { export function ReadyView({ transactions }: State.Ready): VNode { const { i18n } = useTranslationContext(); return ( -
- - - - - - - - - - - {transactions.map((item, idx) => { - return ( - - - - - - - ); - })} - -
{i18n.str`Date`}{i18n.str`Amount`}{i18n.str`Counterpart`}{i18n.str`Subject`}
- {item.when.t_ms === "never" - ? "" - : format(item.when.t_ms, "dd/MM/yyyy HH:mm:ss")} - - {item.negative ? "-" : ""} - {item.amount ? ( - `${Amounts.stringifyValue(item.amount)} ${ - item.amount.currency - }` - ) : ( - <invalid value> - )} - {item.counterpart}{item.subject}
+
+
+
+

Latest transactions

+
+
+
+ + + + + + + + + + + {transactions.map((item, idx) => { + return ( + + + + + + + ); + })} + +
{i18n.str`Date`}{i18n.str`Amount`}{i18n.str`Counterpart`}{i18n.str`Subject`}
+
{item.when.t_ms === "never" + ? "" + : format(item.when.t_ms, "dd/MM/yyyy HH:mm:ss")}
+
{item.negative ? "-" : ""} + {item.amount ? ( + `${Amounts.stringifyValue(item.amount)} ${item.amount.currency + }` + ) : ( + <{i18n.str`invalid value`}> + )}{item.counterpart}{item.subject}
+
); } diff --git a/packages/demobank-ui/src/components/app.tsx b/packages/demobank-ui/src/components/app.tsx index 1f7034bc5..22752ab78 100644 --- a/packages/demobank-ui/src/components/app.tsx +++ b/packages/demobank-ui/src/components/app.tsx @@ -24,7 +24,6 @@ import { SWRConfig } from "swr"; import { BackendStateProvider } from "../context/backend.js"; import { strings } from "../i18n/strings.js"; import { Routing } from "./Routing.js"; - const WITH_LOCAL_STORAGE_CACHE = false; /** -- cgit v1.2.3