chore: tweak new user flow
This commit is contained in:
parent
8e2f01fdff
commit
364637ab54
|
@ -1,4 +1,4 @@
|
||||||
import { HexKey, TaggedRawEvent, UserMetadata } from "@snort/nostr";
|
import { HexKey, RawEvent, UserMetadata } from "@snort/nostr";
|
||||||
import { hexToBech32, unixNowMs } from "Util";
|
import { hexToBech32, unixNowMs } from "Util";
|
||||||
import { DmCache } from "./DMCache";
|
import { DmCache } from "./DMCache";
|
||||||
import { UserCache } from "./UserCache";
|
import { UserCache } from "./UserCache";
|
||||||
|
@ -30,7 +30,7 @@ export interface MetadataCache extends UserMetadata {
|
||||||
zapService?: HexKey;
|
zapService?: HexKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapEventToProfile(ev: TaggedRawEvent) {
|
export function mapEventToProfile(ev: RawEvent) {
|
||||||
try {
|
try {
|
||||||
const data: UserMetadata = JSON.parse(ev.content);
|
const data: UserMetadata = JSON.parse(ev.content);
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -166,33 +166,6 @@ export default function LoginPage() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateKey() {
|
|
||||||
if (!hasSubtleCrypto) return;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="flex login-or">
|
|
||||||
<FormattedMessage defaultMessage="OR" description="Seperator text for Login / Generate Key" />
|
|
||||||
<div className="divider w-max"></div>
|
|
||||||
</div>
|
|
||||||
<h1 dir="auto">
|
|
||||||
<FormattedMessage defaultMessage="Create an Account" description="Heading for generate key flow" />
|
|
||||||
</h1>
|
|
||||||
<p>
|
|
||||||
<FormattedMessage
|
|
||||||
defaultMessage="Generate a public / private key pair. Do not share your private key with anyone, this acts as your password. Once lost, it cannot be “reset” or recovered. Keep safe!"
|
|
||||||
description="Note about key security before generating a new key"
|
|
||||||
/>
|
|
||||||
</p>
|
|
||||||
<div className="login-actions">
|
|
||||||
<AsyncButton onClick={() => makeRandomKey()}>
|
|
||||||
<FormattedMessage defaultMessage="Generate Key" description="Button: Generate a new key" />
|
|
||||||
</AsyncButton>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function installExtension() {
|
function installExtension() {
|
||||||
if (hasSubtleCrypto) return;
|
if (hasSubtleCrypto) return;
|
||||||
|
|
||||||
|
@ -256,9 +229,9 @@ export default function LoginPage() {
|
||||||
<div className="login">
|
<div className="login">
|
||||||
<div>
|
<div>
|
||||||
<div className="login-container">
|
<div className="login-container">
|
||||||
<div className="logo" onClick={() => navigate("/")}>
|
<h1 className="logo" onClick={() => navigate("/")}>
|
||||||
Snort
|
Snort
|
||||||
</div>
|
</h1>
|
||||||
<h1 dir="auto">
|
<h1 dir="auto">
|
||||||
<FormattedMessage defaultMessage="Login" description="Login header" />
|
<FormattedMessage defaultMessage="Login" description="Login header" />
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -291,9 +264,11 @@ export default function LoginPage() {
|
||||||
<button type="button" onClick={doLogin}>
|
<button type="button" onClick={doLogin}>
|
||||||
<FormattedMessage defaultMessage="Login" description="Login button" />
|
<FormattedMessage defaultMessage="Login" description="Login button" />
|
||||||
</button>
|
</button>
|
||||||
|
<AsyncButton onClick={() => makeRandomKey()}>
|
||||||
|
<FormattedMessage defaultMessage="Create Account" />
|
||||||
|
</AsyncButton>
|
||||||
{altLogins()}
|
{altLogins()}
|
||||||
</div>
|
</div>
|
||||||
{generateKey()}
|
|
||||||
{installExtension()}
|
{installExtension()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -32,6 +32,11 @@ export default function GetVerified() {
|
||||||
<h1>
|
<h1>
|
||||||
<FormattedMessage {...messages.Identifier} />
|
<FormattedMessage {...messages.Identifier} />
|
||||||
</h1>
|
</h1>
|
||||||
|
<div className="next-actions continue-actions">
|
||||||
|
<button className="secondary" type="button" onClick={onNext}>
|
||||||
|
<FormattedMessage {...messages.Skip} />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<h4>
|
<h4>
|
||||||
<FormattedMessage {...messages.PreviewOnSnort} />
|
<FormattedMessage {...messages.PreviewOnSnort} />
|
||||||
</h4>
|
</h4>
|
||||||
|
|
|
@ -68,9 +68,6 @@ export default function ImportFollows() {
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div className="next-actions continue-actions">
|
<div className="next-actions continue-actions">
|
||||||
<button className="secondary" type="button" onClick={() => navigate("/new/discover")}>
|
|
||||||
<FormattedMessage {...messages.Skip} />
|
|
||||||
</button>
|
|
||||||
<button type="button" onClick={() => navigate("/new/discover")}>
|
<button type="button" onClick={() => navigate("/new/discover")}>
|
||||||
<FormattedMessage {...messages.Next} />
|
<FormattedMessage {...messages.Next} />
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -46,7 +46,7 @@ export default defineMessages({
|
||||||
PopularAccounts: { defaultMessage: "Follow some popular accounts" },
|
PopularAccounts: { defaultMessage: "Follow some popular accounts" },
|
||||||
Skip: { defaultMessage: "Skip" },
|
Skip: { defaultMessage: "Skip" },
|
||||||
Done: { defaultMessage: "Done!" },
|
Done: { defaultMessage: "Done!" },
|
||||||
ImportTwitter: { defaultMessage: "Import Twitter Follows (optional)" },
|
ImportTwitter: { defaultMessage: "Import Twitter Follows" },
|
||||||
TwitterPlaceholder: { defaultMessage: "Twitter username..." },
|
TwitterPlaceholder: { defaultMessage: "Twitter username..." },
|
||||||
FindYourFollows: { defaultMessage: "Find your twitter follows on nostr (Data provided by {provider})" },
|
FindYourFollows: { defaultMessage: "Find your twitter follows on nostr (Data provided by {provider})" },
|
||||||
TwitterUsername: { defaultMessage: "Twitter username" },
|
TwitterUsername: { defaultMessage: "Twitter username" },
|
||||||
|
@ -56,7 +56,7 @@ export default defineMessages({
|
||||||
Check: { defaultMessage: "Check" },
|
Check: { defaultMessage: "Check" },
|
||||||
Next: { defaultMessage: "Next" },
|
Next: { defaultMessage: "Next" },
|
||||||
SetupProfile: { defaultMessage: "Setup your Profile" },
|
SetupProfile: { defaultMessage: "Setup your Profile" },
|
||||||
Identifier: { defaultMessage: "Get an identifier (optional)" },
|
Identifier: { defaultMessage: "Get an identifier" },
|
||||||
IdentifierHelp: {
|
IdentifierHelp: {
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"Getting an identifier helps confirm the real you to people who know you. Many people can have a username @jack, but there is only one jack@cash.app.",
|
"Getting an identifier helps confirm the real you to people who know you. Many people can have a username @jack, but there is only one jack@cash.app.",
|
||||||
|
|
|
@ -80,7 +80,7 @@ export default function ProfileSettings(props: ProfileSettingsProps) {
|
||||||
const ev = await publisher.metadata(userCopy);
|
const ev = await publisher.metadata(userCopy);
|
||||||
publisher.broadcast(ev);
|
publisher.broadcast(ev);
|
||||||
|
|
||||||
const newProfile = mapEventToProfile(ev as TaggedRawEvent);
|
const newProfile = mapEventToProfile(ev);
|
||||||
if (newProfile) {
|
if (newProfile) {
|
||||||
await UserCache.set(newProfile);
|
await UserCache.set(newProfile);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue