settings tab
This commit is contained in:
parent
848f44733e
commit
42b6c58db8
@ -40,6 +40,7 @@ import { HistoryEvent } from "../../types/history";
|
|||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { Timestamp } from "../../util/time";
|
import { Timestamp } from "../../util/time";
|
||||||
import { classifyTalerUri, TalerUriType } from "../../util/taleruri";
|
import { classifyTalerUri, TalerUriType } from "../../util/taleruri";
|
||||||
|
import { PermissionsCheckbox } from "./welcome";
|
||||||
|
|
||||||
// FIXME: move to newer react functions
|
// FIXME: move to newer react functions
|
||||||
/* eslint-disable react/no-deprecated */
|
/* eslint-disable react/no-deprecated */
|
||||||
@ -153,6 +154,7 @@ class WalletNavBar extends React.Component<any, any> {
|
|||||||
<div className="nav" id="header">
|
<div className="nav" id="header">
|
||||||
<Tab target="/balance">{i18n.str`Balance`}</Tab>
|
<Tab target="/balance">{i18n.str`Balance`}</Tab>
|
||||||
<Tab target="/history">{i18n.str`History`}</Tab>
|
<Tab target="/history">{i18n.str`History`}</Tab>
|
||||||
|
<Tab target="/settings">{i18n.str`Settings`}</Tab>
|
||||||
<Tab target="/debug">{i18n.str`Debug`}</Tab>
|
<Tab target="/debug">{i18n.str`Debug`}</Tab>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -624,6 +626,15 @@ const HistoryComponent = (props: any): JSX.Element => {
|
|||||||
return formatHistoryItem(record);
|
return formatHistoryItem(record);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class WalletSettings extends React.Component<any, any> {
|
||||||
|
render(): JSX.Element {
|
||||||
|
return <div>
|
||||||
|
<h2>Permissions</h2>
|
||||||
|
<PermissionsCheckbox />
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class WalletHistory extends React.Component<any, any> {
|
class WalletHistory extends React.Component<any, any> {
|
||||||
private myHistory: any[];
|
private myHistory: any[];
|
||||||
private gotError = false;
|
private gotError = false;
|
||||||
@ -876,6 +887,7 @@ function WalletPopup(): JSX.Element {
|
|||||||
<Router>
|
<Router>
|
||||||
<WalletBalanceView route="/balance" default />
|
<WalletBalanceView route="/balance" default />
|
||||||
<WalletHistory route="/history" />
|
<WalletHistory route="/history" />
|
||||||
|
<WalletSettings route="/settings" />
|
||||||
<WalletDebug route="/debug" />
|
<WalletDebug route="/debug" />
|
||||||
</Router>
|
</Router>
|
||||||
</div>
|
</div>
|
||||||
|
@ -96,7 +96,7 @@ function Diagnostics(): JSX.Element | null {
|
|||||||
return <p>Running diagnostics ...</p>;
|
return <p>Running diagnostics ...</p>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Welcome(): JSX.Element {
|
export function PermissionsCheckbox(): JSX.Element {
|
||||||
const [extendedPermissions, setExtendedPermissions] = useState(false);
|
const [extendedPermissions, setExtendedPermissions] = useState(false);
|
||||||
async function handleExtendedPerm(newVal: boolean): Promise<void> {
|
async function handleExtendedPerm(newVal: boolean): Promise<void> {
|
||||||
const res = await wxApi.setExtendedPermissions(newVal);
|
const res = await wxApi.setExtendedPermissions(newVal);
|
||||||
@ -104,42 +104,48 @@ function Welcome(): JSX.Element {
|
|||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getExtendedPermValue(): Promise<void> {
|
async function getExtendedPermValue(): Promise<void> {
|
||||||
const res = await wxApi.getExtendedPermissions()
|
const res = await wxApi.getExtendedPermissions();
|
||||||
setExtendedPermissions(res.newValue);
|
setExtendedPermissions(res.newValue);
|
||||||
}
|
}
|
||||||
getExtendedPermValue();
|
getExtendedPermValue();
|
||||||
});
|
});
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<input
|
||||||
|
checked={extendedPermissions}
|
||||||
|
onChange={(x) => handleExtendedPerm(x.target.checked)}
|
||||||
|
type="checkbox"
|
||||||
|
id="checkbox-perm"
|
||||||
|
style={{ width: "1.5em", height: "1.5em", verticalAlign: "middle" }}
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
htmlFor="checkbox-perm"
|
||||||
|
style={{ marginLeft: "0.5em", fontWeight: "bold" }}
|
||||||
|
>
|
||||||
|
Automatically open wallet based on page content
|
||||||
|
</label>
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
color: "#383838",
|
||||||
|
fontSize: "smaller",
|
||||||
|
display: "block",
|
||||||
|
marginLeft: "2em",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
(Enabling this option below will make using the wallet faster, but
|
||||||
|
requires more permissions from your browser.)
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Welcome(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<p>Thank you for installing the wallet.</p>
|
<p>Thank you for installing the wallet.</p>
|
||||||
<Diagnostics />
|
<Diagnostics />
|
||||||
<h2>Permissions</h2>
|
<h2>Permissions</h2>
|
||||||
<div>
|
<PermissionsCheckbox />
|
||||||
<input
|
|
||||||
checked={extendedPermissions}
|
|
||||||
onChange={(x) => handleExtendedPerm(x.target.checked)}
|
|
||||||
type="checkbox"
|
|
||||||
id="checkbox-perm"
|
|
||||||
style={{ width: "1.5em", height: "1.5em", verticalAlign: "middle" }}
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
htmlFor="checkbox-perm"
|
|
||||||
style={{ marginLeft: "0.5em", fontWeight: "bold" }}
|
|
||||||
>
|
|
||||||
Automatically open wallet based on page content
|
|
||||||
</label>
|
|
||||||
<span
|
|
||||||
style={{
|
|
||||||
color: "#383838",
|
|
||||||
fontSize: "smaller",
|
|
||||||
display: "block",
|
|
||||||
marginLeft: "2em",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
(Enabling this option below will make using the wallet faster, but
|
|
||||||
requires more permissions from your browser.)
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<h2>Next Steps</h2>
|
<h2>Next Steps</h2>
|
||||||
<a href="https://demo.taler.net/" style={{ display: "block" }}>
|
<a href="https://demo.taler.net/" style={{ display: "block" }}>
|
||||||
Try the demo »
|
Try the demo »
|
||||||
|
Loading…
Reference in New Issue
Block a user