Skip to content

Commit

Permalink
Merge pull request #1583 from getAlby/task-align-lnurlauth
Browse files Browse the repository at this point in the history
feat: use resultcard in lnurlauth
  • Loading branch information
escapedcat authored Oct 13, 2022
2 parents a356bfa + 8bbb371 commit 8a8c548
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions src/app/screens/LNURLAuth/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Button from "@components/Button";
import ConfirmOrCancel from "@components/ConfirmOrCancel";
import Container from "@components/Container";
import ContentMessage from "@components/ContentMessage";
import PublisherCard from "@components/PublisherCard";
import SuccessMessage from "@components/SuccessMessage";
import ResultCard from "@components/ResultCard";
import { useState } from "react";
import type { MouseEvent } from "react";
import { useTranslation } from "react-i18next";
Expand All @@ -20,6 +21,7 @@ function LNURLAuth() {
const { t: tComponents } = useTranslation("components", {
keyPrefix: "confirm_or_cancel",
});
const { t: tCommon } = useTranslation("common");

const navigate = useNavigate();
const navState = useNavigationState();
Expand Down Expand Up @@ -51,7 +53,9 @@ function LNURLAuth() {
}

if (response.success) {
setSuccessMessage(t("success"));
setSuccessMessage(
t("success", { name: origin ? origin.name : details.domain })
);
// ATTENTION: if this LNURL is called through `webln.lnurl` then we immediately return and return the response. This closes the window which means the user will NOT see the above successAction.
// We assume this is OK when it is called through webln.
if (navState.isPrompt) {
Expand Down Expand Up @@ -130,18 +134,14 @@ function LNURLAuth() {
</Container>
</>
) : (
<Container maxWidth="sm">
{origin ? (
<PublisherCard
title={origin.name}
image={origin.icon}
url={details.domain}
/>
) : (
<PublisherCard title={details.domain} />
)}
<Container justifyBetween maxWidth="sm">
<ResultCard isSuccess message={successMessage} />
<div className="my-4">
<SuccessMessage message={successMessage} onClose={close} />
<Button
onClick={close}
label={tCommon("actions.close")}
fullWidth
/>
</div>
</Container>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@
"heading": "Do you want to login to"
},
"submit": "Login",
"success": "Authenticated successfully",
"success": "Login successful on {{name}}",
"errors": {
"status": "Error: Auth status is not ok"
}
Expand Down

0 comments on commit 8a8c548

Please sign in to comment.