fix cta navbar and added an withdrawal button when the wallet didnt find a tos (with a warning)

This commit is contained in:
Sebastian 2021-10-13 09:54:18 -03:00
parent e227fa4e47
commit 021d508337
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
5 changed files with 26 additions and 14 deletions

View File

@ -36,6 +36,7 @@ export enum Pages {
manual_withdraw = '/manual-withdraw',
settings = '/settings',
dev = '/dev',
cta = '/cta',
backup = '/backup',
history = '/history',
transaction = '/transaction/:tid',

View File

@ -21,7 +21,10 @@ import { h } from 'preact';
export function ExchangeXmlTos({ doc }: { doc: Document }) {
const termsNode = doc.querySelector('[ids=terms-of-service]')
if (!termsNode) {
return <div>not found</div>
return <div>
<p>The exchange send us an xml but there is no node with 'ids=terms-of-service'. This is the content:</p>
<pre>{new XMLSerializer().serializeToString(doc)}</pre>
</div>
}
return <Fragment>
{Array.from(termsNode.children).map(renderChild)}

View File

@ -214,10 +214,18 @@ export function View({ details, knownExchanges, amount, onWithdraw, onSwitchExch
{i18n.str`Confirm withdrawal`}
</ButtonSuccess>
}
{terms.status === 'notfound' &&
<LinkWarning upperCased>
{terms.status === 'notfound' && <Fragment>
<LinkWarning>
{i18n.str`Exchange doesn't have terms of service`}
</LinkWarning>
<ButtonWarning
upperCased
disabled={!details.exchangeInfo.baseUrl}
onClick={onWithdraw}
>
{i18n.str`Withdraw anyway`}
</ButtonWarning>
</Fragment>
}
</section>
</WalletAction>

View File

@ -3,7 +3,7 @@ import { ButtonPrimary, ButtonSuccess, PopupBox } from "../components/styled/ind
export interface Props {
url: string;
onDismiss: (s: boolean) => void;
onDismiss: () => void;
}
export function TalerActionFound({ url, onDismiss }: Props) {
@ -49,7 +49,7 @@ export function TalerActionFound({ url, onDismiss }: Props) {
</section>
<footer>
<div />
<ButtonPrimary onClick={() => onDismiss(true)}> Dismiss </ButtonPrimary>
<ButtonPrimary onClick={() => onDismiss()}> Dismiss </ButtonPrimary>
</footer>
</PopupBox>;

View File

@ -66,14 +66,9 @@ if (document.readyState === "loading") {
function Application() {
const [talerActionUrl, setDismissed] = useTalerActionURL()
if (talerActionUrl) {
return <div>
<WalletNavBar />
<div style={{ width: 400, height: 290 }}>
<TalerActionFound url={talerActionUrl} onDismiss={setDismissed} />
</div>
</div>
}
useEffect(() => {
if (talerActionUrl) route(Pages.cta)
},[talerActionUrl])
return (
<div>
@ -81,11 +76,16 @@ function Application() {
<WalletNavBar />
<div style={{ width: 400, height: 290 }}>
<Router history={createHashHistory()}>
<Route path={Pages.dev} component={DeveloperPage} />
<Route path={Pages.balance} component={BalancePage}
goToWalletManualWithdraw={() => goToWalletPage(Pages.manual_withdraw)}
/>
<Route path={Pages.settings} component={SettingsPage} />
<Route path={Pages.dev} component={DeveloperPage} />
<Route path={Pages.cta} component={() => <TalerActionFound url={talerActionUrl!} onDismiss={() => {
setDismissed(true)
route(Pages.balance)
}} />} />
<Route path={Pages.transaction}
component={({ tid }: { tid: string }) => goToWalletPage(Pages.transaction.replace(':tid', tid))}