2016-01-24 02:29:13 +01:00
|
|
|
/*
|
|
|
|
This file is part of TALER
|
|
|
|
(C) 2016 GNUnet e.V.
|
|
|
|
|
|
|
|
TALER is free software; you can redistribute it and/or modify it under the
|
|
|
|
terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 3, or (at your option) any later version.
|
|
|
|
|
|
|
|
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
2016-07-07 17:59:29 +02:00
|
|
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
2016-01-24 02:29:13 +01:00
|
|
|
*/
|
|
|
|
|
2016-03-01 19:46:20 +01:00
|
|
|
/**
|
|
|
|
* Popup shown to the user when they click
|
|
|
|
* the Taler browser action button.
|
|
|
|
*
|
2022-02-23 19:18:37 +01:00
|
|
|
* @author sebasjm
|
2016-03-01 19:46:20 +01:00
|
|
|
*/
|
|
|
|
|
2017-05-29 15:18:48 +02:00
|
|
|
/**
|
|
|
|
* Imports.
|
|
|
|
*/
|
2022-02-23 19:18:37 +01:00
|
|
|
import { i18n, Translate } from "@gnu-taler/taler-util";
|
2022-02-16 19:15:47 +01:00
|
|
|
import { VNode, h } from "preact";
|
|
|
|
import { JustInDevMode } from "./components/JustInDevMode";
|
|
|
|
import { NavigationHeader, NavigationHeaderHolder } from "./components/styled";
|
2016-10-10 00:37:08 +02:00
|
|
|
|
2022-02-23 19:18:37 +01:00
|
|
|
/**
|
|
|
|
* List of pages used by the wallet
|
|
|
|
*
|
|
|
|
* @author sebasjm
|
|
|
|
*/
|
|
|
|
|
2021-06-16 22:01:06 +02:00
|
|
|
export enum Pages {
|
2021-11-15 15:18:58 +01:00
|
|
|
welcome = "/welcome",
|
2022-01-20 17:12:28 +01:00
|
|
|
|
2021-11-15 15:18:58 +01:00
|
|
|
balance = "/balance",
|
2022-01-25 14:29:29 +01:00
|
|
|
balance_history = "/balance/history/:currency?",
|
2022-01-20 17:12:28 +01:00
|
|
|
balance_manual_withdraw = "/balance/manual-withdraw/:currency?",
|
|
|
|
balance_deposit = "/balance/deposit/:currency",
|
|
|
|
balance_transaction = "/balance/transaction/:tid",
|
|
|
|
|
2021-11-15 15:18:58 +01:00
|
|
|
dev = "/dev",
|
2022-01-20 17:12:28 +01:00
|
|
|
|
2021-11-15 15:18:58 +01:00
|
|
|
backup = "/backup",
|
2022-01-20 17:12:28 +01:00
|
|
|
backup_provider_detail = "/backup/provider/:pid",
|
|
|
|
backup_provider_add = "/backup/provider/add",
|
|
|
|
|
|
|
|
settings = "/settings",
|
|
|
|
settings_exchange_add = "/settings/exchange/add",
|
2021-08-19 05:34:47 +02:00
|
|
|
|
2022-01-20 17:12:28 +01:00
|
|
|
cta = "/cta/:action",
|
|
|
|
cta_pay = "/cta/pay",
|
|
|
|
cta_refund = "/cta/refund",
|
|
|
|
cta_tips = "/cta/tip",
|
|
|
|
cta_withdraw = "/cta/withdraw",
|
2021-06-16 22:01:06 +02:00
|
|
|
}
|
|
|
|
|
2022-02-16 19:15:47 +01:00
|
|
|
export function PopupNavBar({ path = "" }: { path?: string }): VNode {
|
|
|
|
const innerUrl = chrome.runtime
|
|
|
|
? new URL(chrome.runtime.getURL("/static/wallet.html#/settings")).href
|
|
|
|
: "#";
|
2016-10-10 00:37:08 +02:00
|
|
|
return (
|
2022-02-16 19:15:47 +01:00
|
|
|
<NavigationHeader>
|
2022-02-23 19:18:37 +01:00
|
|
|
<a href="/balance" class={path.startsWith("/balance") ? "active" : ""}>
|
2022-02-23 19:44:14 +01:00
|
|
|
<i18n.Translate>Balance</i18n.Translate>
|
2022-02-23 19:18:37 +01:00
|
|
|
</a>
|
|
|
|
<a href="/backup" class={path.startsWith("/backup") ? "active" : ""}>
|
2022-02-23 19:44:14 +01:00
|
|
|
<i18n.Translate>Backup</i18n.Translate>
|
2022-02-23 19:18:37 +01:00
|
|
|
</a>
|
2022-02-16 19:15:47 +01:00
|
|
|
<a />
|
|
|
|
<a href={innerUrl} target="_blank" rel="noreferrer">
|
2022-02-23 19:18:37 +01:00
|
|
|
<div class="settings-icon" title={i18n.str`Settings`} />
|
2022-02-16 19:15:47 +01:00
|
|
|
</a>
|
|
|
|
</NavigationHeader>
|
2016-10-10 00:37:08 +02:00
|
|
|
);
|
2016-01-24 02:29:13 +01:00
|
|
|
}
|
|
|
|
|
2022-02-16 19:15:47 +01:00
|
|
|
export function WalletNavBar({ path = "" }: { path?: string }): VNode {
|
2021-11-15 15:18:58 +01:00
|
|
|
return (
|
2022-02-16 19:15:47 +01:00
|
|
|
<NavigationHeaderHolder>
|
|
|
|
<NavigationHeader>
|
2022-02-23 19:18:37 +01:00
|
|
|
<a href="/balance" class={path.startsWith("/balance") ? "active" : ""}>
|
2022-02-23 19:44:14 +01:00
|
|
|
<i18n.Translate>Balance</i18n.Translate>
|
2022-02-23 19:18:37 +01:00
|
|
|
</a>
|
|
|
|
<a href="/backup" class={path.startsWith("/backup") ? "active" : ""}>
|
2022-02-23 19:44:14 +01:00
|
|
|
<i18n.Translate>Backup</i18n.Translate>
|
2022-02-23 19:18:37 +01:00
|
|
|
</a>
|
2022-02-16 19:15:47 +01:00
|
|
|
|
|
|
|
<JustInDevMode>
|
2022-02-23 19:18:37 +01:00
|
|
|
<a href="/dev" class={path.startsWith("/dev") ? "active" : ""}>
|
2022-02-23 19:44:14 +01:00
|
|
|
<i18n.Translate>Dev</i18n.Translate>
|
2022-02-23 19:18:37 +01:00
|
|
|
</a>
|
2022-02-16 19:15:47 +01:00
|
|
|
</JustInDevMode>
|
|
|
|
|
|
|
|
<a />
|
|
|
|
<a
|
|
|
|
href="/settings"
|
|
|
|
class={path.startsWith("/settings") ? "active" : ""}
|
|
|
|
>
|
2022-02-23 19:44:14 +01:00
|
|
|
<i18n.Translate>Settings</i18n.Translate>
|
2022-02-16 19:15:47 +01:00
|
|
|
</a>
|
|
|
|
</NavigationHeader>
|
|
|
|
</NavigationHeaderHolder>
|
2021-11-15 15:18:58 +01:00
|
|
|
);
|
2021-07-16 17:00:39 +02:00
|
|
|
}
|