This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
455 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import { Flex } from 'rebass/styled-components' | ||
import { FormattedMessage } from 'react-intl' | ||
import { Dialog, Heading, Button, DialogOverlay, Text } from 'components/UI' | ||
import { Form } from 'components/Form' | ||
import messages from './messages' | ||
|
||
const LnurlAuthPrompt = ({ params, onOk, onCancel, onClose }) => { | ||
const { service } = params | ||
const buttons = ( | ||
<> | ||
<Button type="submit" variant="normal"> | ||
<FormattedMessage {...messages.lnurl_auth_prompt_dialog_confirm_text} /> | ||
</Button> | ||
<Button onClick={onCancel} type="button" variant="secondary"> | ||
<FormattedMessage {...messages.lnurl_auth_prompt_dialog_decline_text} /> | ||
</Button> | ||
</> | ||
) | ||
|
||
const header = ( | ||
<Flex alignItems="center" flexDirection="column" mb={4}> | ||
<Heading.h1> | ||
<FormattedMessage {...messages.lnurl_auth_prompt_dialog_header} /> | ||
</Heading.h1> | ||
</Flex> | ||
) | ||
|
||
const handleSubmit = values => onOk(values) | ||
|
||
return ( | ||
<DialogOverlay alignItems="center" justifyContent="center"> | ||
<Form onSubmit={handleSubmit}> | ||
<Dialog buttons={buttons} header={header} onClose={onClose} width={640}> | ||
<Text color="gray"> | ||
<FormattedMessage values={{ service }} {...messages.lnurl_auth_prompt_dialog_body} /> | ||
</Text> | ||
</Dialog> | ||
</Form> | ||
</DialogOverlay> | ||
) | ||
} | ||
|
||
LnurlAuthPrompt.propTypes = { | ||
onCancel: PropTypes.func.isRequired, | ||
onClose: PropTypes.func.isRequired, | ||
onOk: PropTypes.func.isRequired, | ||
params: PropTypes.object.isRequired, | ||
} | ||
|
||
export default LnurlAuthPrompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export LnurlAuthPrompt from './LnurlAuthPrompt' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineMessages } from 'react-intl' | ||
|
||
/* eslint-disable max-len */ | ||
export default defineMessages({ | ||
lnurl_auth_prompt_dialog_header: 'Confirm login', | ||
lnurl_auth_prompt_dialog_body: 'Do you confirm authentication request from {service}', | ||
lnurl_auth_prompt_dialog_confirm_text: 'Confirm', | ||
lnurl_auth_prompt_dialog_decline_text: 'Decline', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { connect } from 'react-redux' | ||
import { finishLnurlAuth, lnurlSelectors, clearLnurlAuth, declineLnurlAuth } from 'reducers/lnurl' | ||
import { LnurlAuthPrompt } from 'components/Lnurl' | ||
|
||
const mapStateToProps = state => ({ | ||
params: lnurlSelectors.lnurlAuthParams(state), | ||
}) | ||
|
||
const mapDispatchToProps = { | ||
onOk: finishLnurlAuth, | ||
onCancel: declineLnurlAuth, | ||
onClose: clearLnurlAuth, | ||
} | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(LnurlAuthPrompt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.