extract lang

This commit is contained in:
Kieran 2023-09-01 13:15:02 +01:00
parent eddf9232d6
commit 5a90164922
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
6 changed files with 85 additions and 38 deletions

View File

@ -74,7 +74,7 @@ export function LoginSignup({ close }: { close: () => void }) {
function createAccount() {
const newKey = bytesToHex(schnorr.utils.randomPrivateKey());
setNewKey(newKey);
setLnAddress(`${getPublicKey(newKey)}@zap.stream`)
setLnAddress(`${getPublicKey(newKey)}@zap.stream`);
setStage(Stage.Details);
}
@ -106,7 +106,7 @@ export function LoginSignup({ close }: { close: () => void }) {
const info = await px.info();
setProviderInfo(info);
setStage(Stage.LnAddress)
setStage(Stage.LnAddress);
}
async function saveProfile() {
@ -116,9 +116,11 @@ export function LoginSignup({ close }: { close: () => void }) {
const lnurl = new LNURL(lnAddress);
await lnurl.load();
} catch {
throw new Error(formatMessage({
defaultMessage: "Hmm, your lightning address looks wrong"
}));
throw new Error(
formatMessage({
defaultMessage: "Hmm, your lightning address looks wrong",
})
);
}
const pub = EventPublisher.privateKey(key);
const profile = {
@ -162,11 +164,13 @@ export function LoginSignup({ close }: { close: () => void }) {
<FormattedMessage defaultMessage="OR" />
<hr />
</div>
{hasNostrExtension && <>
{hasNostrExtension && (
<>
<AsyncButton type="button" className="btn btn-primary btn-block" onClick={loginNip7}>
<FormattedMessage defaultMessage="Nostr Extension" />
</AsyncButton>
</>}
</>
)}
<button type="button" className="btn btn-primary btn-block" onClick={() => setStage(Stage.LoginInput)}>
<FormattedMessage defaultMessage="Login with Private Key (insecure)" />
</button>
@ -184,21 +188,34 @@ export function LoginSignup({ close }: { close: () => void }) {
<FormattedMessage defaultMessage="Login with private key" />
</h2>
<p>
<FormattedMessage defaultMessage="This method is insecure. We recommend using a {nostrlink}" values={{
nostrlink: <a href="">
<FormattedMessage
defaultMessage="This method is insecure. We recommend using a {nostrlink}"
values={{
nostrlink: (
<a href="">
<FormattedMessage defaultMessage="nostr signer extension" />
</a>
}} />
),
}}
/>
</p>
<div className="paper">
<input type="text" value={key} onChange={e => setNewKey(e.target.value)} placeholder={formatMessage({ defaultMessage: "eg. nsec1xyz" })} />
<input
type="text"
value={key}
onChange={e => setNewKey(e.target.value)}
placeholder={formatMessage({ defaultMessage: "eg. nsec1xyz" })}
/>
</div>
<div className="flex f-space">
<div></div>
<div className="flex g8">
<button type="button" className="btn btn-secondary" onClick={() => {
<button
type="button"
className="btn btn-secondary"
onClick={() => {
setNewKey("");
setStage(Stage.Login)
setStage(Stage.Login);
}}>
<FormattedMessage defaultMessage="Cancel" />
</button>
@ -210,7 +227,7 @@ export function LoginSignup({ close }: { close: () => void }) {
{error && <b className="error">{error}</b>}
</div>
</>
)
);
}
case Stage.Details: {
return (
@ -234,7 +251,12 @@ export function LoginSignup({ close }: { close: () => void }) {
</div>
<div className="username">
<div className="paper">
<input type="text" placeholder="Username" value={username} onChange={e => setUsername(e.target.value)} />
<input
type="text"
placeholder="Username"
value={username}
onChange={e => setUsername(e.target.value)}
/>
</div>
<small>
<FormattedMessage defaultMessage="You can change this later" />
@ -258,14 +280,24 @@ export function LoginSignup({ close }: { close: () => void }) {
<p>
<FormattedMessage defaultMessage="We hooked you up with a lightning wallet so you can get paid by viewers right away!" />
</p>
{providerInfo?.balance && <p>
<FormattedMessage defaultMessage="Oh, and you have {n} sats of free streaming on us! 💜" values={{
n: <FormattedNumber value={providerInfo.balance} />
}} />
</p>}
{providerInfo?.balance && (
<p>
<FormattedMessage
defaultMessage="Oh, and you have {n} sats of free streaming on us! 💜"
values={{
n: <FormattedNumber value={providerInfo.balance} />,
}}
/>
</p>
)}
<div className="username">
<div className="paper">
<input type="text" placeholder={formatMessage({ defaultMessage: "eg. name@wallet.com" })} value={lnAddress} onChange={e => setLnAddress(e.target.value)} />
<input
type="text"
placeholder={formatMessage({ defaultMessage: "eg. name@wallet.com" })}
value={lnAddress}
onChange={e => setLnAddress(e.target.value)}
/>
</div>
<small>
<FormattedMessage defaultMessage="You can always replace it with your own address later." />
@ -277,7 +309,7 @@ export function LoginSignup({ close }: { close: () => void }) {
</AsyncButton>
</div>
</>
)
);
}
case Stage.SaveKey: {
return (

View File

@ -89,9 +89,18 @@
"BGxpTN": {
"defaultMessage": "Stream Chat"
},
"Bep/gA": {
"defaultMessage": "Private key"
},
"C81/uG": {
"defaultMessage": "Logout"
},
"D3idYv": {
"defaultMessage": "Settings"
},
"DZKuuP": {
"defaultMessage": "Logged in as"
},
"Dn82AL": {
"defaultMessage": "Live"
},
@ -155,6 +164,9 @@
"O2Cy6m": {
"defaultMessage": "Yes, I am over 18"
},
"OEW7yJ": {
"defaultMessage": "Zaps"
},
"OKhRC6": {
"defaultMessage": "Share"
},
@ -194,6 +206,9 @@
"TaTRKo": {
"defaultMessage": "Start Stream"
},
"TwyMau": {
"defaultMessage": "Account"
},
"UJBFYK": {
"defaultMessage": "Add Card"
},

View File

@ -10,7 +10,7 @@ import Copy from "element/copy";
const enum Tab {
Account,
Notifications
Notifications,
}
export function SettingsPage() {
@ -53,7 +53,7 @@ export function SettingsPage() {
</h1>
<AlbyZapsButton />
</>
)
);
}
}
}
@ -69,12 +69,9 @@ export function SettingsPage() {
<FormattedMessage defaultMessage="Account" />
</div>
</div>
<div className="tab-content">
{tabContent()}
<div className="tab-content">{tabContent()}</div>
</div>
</div>
</div>
</div>
);
}

View File

@ -29,7 +29,10 @@
"Atr2p4": "NSFW Content",
"AyGauy": "Login",
"BGxpTN": "Stream Chat",
"Bep/gA": "Private key",
"C81/uG": "Logout",
"D3idYv": "Settings",
"DZKuuP": "Logged in as",
"Dn82AL": "Live",
"ESyhzp": "Your comment for {name}",
"FjDlus": "You can always replace it with your own address later.",
@ -51,6 +54,7 @@
"LknBsU": "Stream Key",
"My6HwN": "Ok, it's safe",
"O2Cy6m": "Yes, I am over 18",
"OEW7yJ": "Zaps",
"OKhRC6": "Share",
"OWgHbg": "Edit card",
"Oxqtyf": "We hooked you up with a lightning wallet so you can get paid by viewers right away!",
@ -64,6 +68,7 @@
"RrCui3": "Summary",
"TP/cMX": "Ended",
"TaTRKo": "Start Stream",
"TwyMau": "Account",
"UJBFYK": "Add Card",
"UfSot5": "Past Streams",
"VA/Z1S": "Hide",

View File

@ -366,4 +366,3 @@
"defaultMessage": "هشدار زپ"
}
}

View File

@ -366,4 +366,3 @@
"defaultMessage": "Tahadhari ya Zap"
}
}