+ }
+ if (kind.startsWith('wallet')) {
+ const path = /wallet(\/.*).*/.exec(kind)[1];
+ return
diff --git a/packages/taler-wallet-webextension/package.json b/packages/taler-wallet-webextension/package.json
index a5908af25..e41c6cb86 100644
--- a/packages/taler-wallet-webextension/package.json
+++ b/packages/taler-wallet-webextension/package.json
@@ -12,7 +12,7 @@
"test": "jest ./tests",
"compile": "tsc && rollup -c",
"build-storybook": "build-storybook",
- "storybook": "start-storybook -s static -p 6006",
+ "storybook": "start-storybook -s . -p 6006",
"watch": "tsc --watch & rollup -w -c"
},
"dependencies": {
diff --git a/packages/taler-wallet-webextension/rollup.config.js b/packages/taler-wallet-webextension/rollup.config.js
index 7e7ec0032..5a3f0db5f 100644
--- a/packages/taler-wallet-webextension/rollup.config.js
+++ b/packages/taler-wallet-webextension/rollup.config.js
@@ -1,14 +1,13 @@
// rollup.config.js
-import commonjs from "@rollup/plugin-commonjs";
-import nodeResolve from "@rollup/plugin-node-resolve";
-import json from "@rollup/plugin-json";
-import builtins from "builtin-modules";
-import replace from "@rollup/plugin-replace";
-import ignore from "rollup-plugin-ignore"
-import image from '@rollup/plugin-image';
import linaria from '@linaria/rollup';
-import css from 'rollup-plugin-css-only';
import alias from '@rollup/plugin-alias';
+import commonjs from "@rollup/plugin-commonjs";
+import image from '@rollup/plugin-image';
+import json from "@rollup/plugin-json";
+import nodeResolve from "@rollup/plugin-node-resolve";
+import replace from "@rollup/plugin-replace";
+import css from 'rollup-plugin-css-only';
+import ignore from "rollup-plugin-ignore";
const makePlugins = () => [
alias({
diff --git a/packages/taler-wallet-webextension/src/popup/popup.tsx b/packages/taler-wallet-webextension/src/NavigationBar.tsx
similarity index 65%
rename from packages/taler-wallet-webextension/src/popup/popup.tsx
rename to packages/taler-wallet-webextension/src/NavigationBar.tsx
index 4aee48fb7..e07032d0a 100644
--- a/packages/taler-wallet-webextension/src/popup/popup.tsx
+++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx
@@ -27,10 +27,11 @@
import { i18n } from "@gnu-taler/taler-util";
import { ComponentChildren, JSX } from "preact";
import Match from "preact-router/match";
-import { useDevContext } from "../context/devContext";
-import { PopupNavigation } from '../components/styled'
+import { useDevContext } from "./context/devContext";
+import { PopupNavigation } from './components/styled'
export enum Pages {
+ welcome = '/welcome',
balance = '/balance',
settings = '/settings',
dev = '/dev',
@@ -39,6 +40,15 @@ export enum Pages {
transaction = '/transaction/:tid',
provider_detail = '/provider/:pid',
provider_add = '/provider/add',
+
+ reset_required = '/reset-required',
+ payback = '/payback',
+ return_coins = '/return-coins',
+
+ pay = '/pay',
+ refund = '/refund',
+ tips = '/tips',
+ withdraw = '/withdraw',
}
interface TabProps {
@@ -59,18 +69,23 @@ function Tab(props: TabProps): JSX.Element {
);
}
-export function NavBar({devMode, path}:{path:string, devMode:boolean}) {
+export function NavBar({ devMode, path }: { path: string, devMode: boolean }) {
return
- {i18n.str`Balance`}
- {i18n.str`History`}
- {i18n.str`Backup`}
- {i18n.str`Settings`}
- {devMode && {i18n.str`Dev`}}
+
+ {i18n.str`Balance`}
+ {i18n.str`History`}
+ {i18n.str`Backup`}
+ {i18n.str`Settings`}
+ {devMode && {i18n.str`Dev`}}
+
}
export function WalletNavBar() {
const { devMode } = useDevContext()
- return
{({ path }: any) => }
+ return
{({ path }: any) => {
+ console.log("path", path)
+ return
+ }}
}
diff --git a/packages/taler-wallet-webextension/src/components/LogoHeader.tsx b/packages/taler-wallet-webextension/src/components/LogoHeader.tsx
new file mode 100644
index 000000000..0217289eb
--- /dev/null
+++ b/packages/taler-wallet-webextension/src/components/LogoHeader.tsx
@@ -0,0 +1,13 @@
+export function LogoHeader() {
+ return
+
+
+
+}
\ No newline at end of file
diff --git a/packages/taler-wallet-webextension/src/components/styled/index.tsx b/packages/taler-wallet-webextension/src/components/styled/index.tsx
index 7f709db46..6067fa446 100644
--- a/packages/taler-wallet-webextension/src/components/styled/index.tsx
+++ b/packages/taler-wallet-webextension/src/components/styled/index.tsx
@@ -11,7 +11,7 @@ export const PaymentStatus = styled.div<{ color: string }>`
background-color: ${p => p.color};
`
-export const WalletPage = styled.section`
+export const WalletAction = styled.section`
border: solid 5px black;
border-radius: 10px;
margin-left: auto;
@@ -28,8 +28,73 @@ export const WalletPage = styled.section`
}
`
+export const DateSeparator = styled.div`
+ color: gray;
+ margin: .2em;
+ margin-top: 1em;
+`
+export const WalletBox = styled.div<{ noPadding?: boolean }>`
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ align-items: center;
+ & > * {
+ width: 400px;
+ }
+ & > section {
+ padding-left: ${({ noPadding }) => noPadding ? '0px' : '8px'};
+ padding-right: ${({ noPadding }) => noPadding ? '0px' : '8px'};
+ // this margin will send the section up when used with a header
+ margin-bottom: auto;
+ overflow: auto;
+
+ table td {
+ padding: 5px 10px;
+ }
+ table tr {
+ border-bottom: 1px solid black;
+ border-top: 1px solid black;
+ }
+ }
+
+ & > header {
+ flex-direction: row;
+ justify-content: space-between;
+ display: flex;
+ padding: 8px;
+ margin-bottom: 5px;
+
+ & > div {
+ align-self: center;
+ }
+
+ & > h3 {
+ margin: 0px;
+ }
+
+ & > .title {
+ /* margin: 1em; */
+ font-size: large;
+ color: #3c4e92;
+ }
+ }
+
+ & > footer {
+ padding-top: 8px;
+ padding-bottom: 8px;
+ flex-direction: row;
+ justify-content: space-between;
+ display: flex;
+ & button {
+ margin-right: 8px;
+ margin-left: 8px;
+ }
+ }
+`
+
export const PopupBox = styled.div<{ noPadding?: boolean }>`
height: 290px;
+ width: 400px;
display: flex;
flex-direction: column;
justify-content: space-between;
@@ -194,10 +259,32 @@ export const RowBorderGray = styled(Row)`
export const RowLightBorderGray = styled(Row2)`
border: 1px solid lightgray;
- /* border-radius: 0.5em; */
+ border-top: 0px;
+
+ ${DateSeparator} + & {
+ border: 1px solid lightgray;
+ background-color: red;
+ }
`
-export const HistoryRow = styled(RowLightBorderGray)`
+export const HistoryRow = styled.a`
+ text-decoration: none;
+
+ display: flex;
+ justify-content: space-between;
+ padding: 0.5em;
+
+ border: 1px solid lightgray;
+ border-top: 0px;
+
+ ${DateSeparator} + & {
+ border: 1px solid lightgray;
+ }
+
+ :hover {
+ background-color: lightgray;
+ }
+
& > ${Column}:last-of-type {
margin-left: auto;
align-self: center;
@@ -284,11 +371,17 @@ export const ErrorBox = styled.div`
}
}
`
-export const PopupNavigation = styled.div<{devMode?:boolean}>`
+export const PopupNavigation = styled.div<{ devMode?: boolean }>`
background-color:#0042b2;
height: 35px;
-
- & > a {
+ justify-content: space-around;
+ display: flex;
+
+ & > div {
+ width: 400px;
+ }
+
+ & > div > a {
color: #f8faf7;
display: inline-block;
width: calc(400px / ${({ devMode }) => !devMode ? 4 : 5});
@@ -298,7 +391,7 @@ export const PopupNavigation = styled.div<{devMode?:boolean}>`
line-height: 35px;
}
- & > a.active {
+ & > div > a.active {
background-color: #f8faf7;
color: #0042b2;
font-weight: bold;
diff --git a/packages/taler-wallet-webextension/src/wallet/Pay.stories.tsx b/packages/taler-wallet-webextension/src/cta/Pay.stories.tsx
similarity index 91%
rename from packages/taler-wallet-webextension/src/wallet/Pay.stories.tsx
rename to packages/taler-wallet-webextension/src/cta/Pay.stories.tsx
index 0297d6264..38e3d0f35 100644
--- a/packages/taler-wallet-webextension/src/wallet/Pay.stories.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Pay.stories.tsx
@@ -20,23 +20,16 @@
*/
import { ContractTerms, PreparePayResultType } from '@gnu-taler/taler-util';
-import { FunctionalComponent, h } from 'preact';
+import { createExample } from '../test-utils';
import { PaymentRequestView as TestedComponent } from './Pay';
-
export default {
- title: 'wallet/pay',
+ title: 'cta/pay',
component: TestedComponent,
argTypes: {
},
};
-function createExample
(Component: FunctionalComponent, props: Partial) {
- const r = (args: any) =>
- r.args = props
- return r
-}
-
export const InsufficientBalance = createExample(TestedComponent, {
payStatus: {
status: PreparePayResultType.InsufficientBalance,
diff --git a/packages/taler-wallet-webextension/src/wallet/Pay.tsx b/packages/taler-wallet-webextension/src/cta/Pay.tsx
similarity index 100%
rename from packages/taler-wallet-webextension/src/wallet/Pay.tsx
rename to packages/taler-wallet-webextension/src/cta/Pay.tsx
diff --git a/packages/taler-wallet-webextension/src/wallet/Refund.stories.tsx b/packages/taler-wallet-webextension/src/cta/Refund.stories.tsx
similarity index 85%
rename from packages/taler-wallet-webextension/src/wallet/Refund.stories.tsx
rename to packages/taler-wallet-webextension/src/cta/Refund.stories.tsx
index 044141f0c..88e714cb7 100644
--- a/packages/taler-wallet-webextension/src/wallet/Refund.stories.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Refund.stories.tsx
@@ -19,24 +19,18 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
-import { ContractTerms, OrderShortInfo, PreparePayResultType } from '@gnu-taler/taler-util';
-import { FunctionalComponent, h } from 'preact';
+import { OrderShortInfo } from '@gnu-taler/taler-util';
+import { createExample } from '../test-utils';
import { View as TestedComponent } from './Refund';
export default {
- title: 'wallet/refund',
+ title: 'cta/refund',
component: TestedComponent,
argTypes: {
},
};
-function createExample(Component: FunctionalComponent, props: Partial) {
- const r = (args: any) =>
- r.args = props
- return r
-}
-
export const Complete = createExample(TestedComponent, {
applyResult: {
amountEffectivePaid: 'USD:10',
diff --git a/packages/taler-wallet-webextension/src/wallet/Refund.tsx b/packages/taler-wallet-webextension/src/cta/Refund.tsx
similarity index 100%
rename from packages/taler-wallet-webextension/src/wallet/Refund.tsx
rename to packages/taler-wallet-webextension/src/cta/Refund.tsx
diff --git a/packages/taler-wallet-webextension/src/wallet/Tip.stories.tsx b/packages/taler-wallet-webextension/src/cta/Tip.stories.tsx
similarity index 82%
rename from packages/taler-wallet-webextension/src/wallet/Tip.stories.tsx
rename to packages/taler-wallet-webextension/src/cta/Tip.stories.tsx
index ffd976144..389b183f0 100644
--- a/packages/taler-wallet-webextension/src/wallet/Tip.stories.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Tip.stories.tsx
@@ -19,24 +19,17 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
-import { ContractTerms, PreparePayResultType } from '@gnu-taler/taler-util';
-import { FunctionalComponent, h } from 'preact';
+import { createExample } from '../test-utils';
import { View as TestedComponent } from './Tip';
export default {
- title: 'wallet/tip',
+ title: 'cta/tip',
component: TestedComponent,
argTypes: {
},
};
-function createExample(Component: FunctionalComponent, props: Partial) {
- const r = (args: any) =>
- r.args = props
- return r
-}
-
export const Accepted = createExample(TestedComponent, {
prepareTipResult: {
accepted: true,
diff --git a/packages/taler-wallet-webextension/src/wallet/Tip.tsx b/packages/taler-wallet-webextension/src/cta/Tip.tsx
similarity index 100%
rename from packages/taler-wallet-webextension/src/wallet/Tip.tsx
rename to packages/taler-wallet-webextension/src/cta/Tip.tsx
diff --git a/packages/taler-wallet-webextension/src/wallet/Withdraw.stories.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx
similarity index 66%
rename from packages/taler-wallet-webextension/src/wallet/Withdraw.stories.tsx
rename to packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx
index fef36b820..747f855fa 100644
--- a/packages/taler-wallet-webextension/src/wallet/Withdraw.stories.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw.stories.tsx
@@ -19,32 +19,27 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
-import { h } from 'preact';
-import { View, ViewProps } from './Withdraw';
+import { createExample } from '../test-utils';
+import { View as TestedComponent } from './Withdraw';
export default {
- title: 'wallet/withdraw',
- component: View,
+ title: 'cta/withdraw',
+ component: TestedComponent,
argTypes: {
},
};
-export const WithoutDetails = (a: any) => ;
-WithoutDetails.args = {
-} as ViewProps
-
-export const CompleteWithExchange = (a: any) => ;
-CompleteWithExchange.args = {
+export const CompleteWithExchange = createExample(TestedComponent, {
details: {
amount: 'USD:2',
+ possibleExchanges: [],
},
selectedExchange: 'Some exchange'
-} as ViewProps
-
-export const CompleteWithoutExchange = (a: any) => ;
-CompleteWithoutExchange.args = {
+})
+export const CompleteWithoutExchange = createExample(TestedComponent, {
details: {
amount: 'USD:2',
+ possibleExchanges: [],
},
-} as ViewProps
+})
diff --git a/packages/taler-wallet-webextension/src/wallet/Withdraw.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
similarity index 90%
rename from packages/taler-wallet-webextension/src/wallet/Withdraw.tsx
rename to packages/taler-wallet-webextension/src/cta/Withdraw.tsx
index 442ee7dae..b5182b070 100644
--- a/packages/taler-wallet-webextension/src/wallet/Withdraw.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
@@ -32,14 +32,13 @@ import {
} from "../wxApi";
import { WithdrawUriInfoResponse } from "@gnu-taler/taler-util";
import { JSX } from "preact/jsx-runtime";
-import { WalletPage } from '../components/styled';
+import { WalletAction } from '../components/styled';
interface Props {
talerWithdrawUri?: string;
}
export interface ViewProps {
- talerWithdrawUri?: string;
details: WithdrawUriInfoResponse;
selectedExchange?: string;
accept: () => Promise;
@@ -50,7 +49,7 @@ export interface ViewProps {
export function View({ details, selectedExchange, accept, setCancelled, setSelecting }: ViewProps) {
return (
-
+
❰Taler Wallet❱
@@ -101,26 +100,19 @@ export function View({ details, selectedExchange, accept, setCancelled, setSelec