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 { DmCache } from "./DMCache";
|
||||
import { UserCache } from "./UserCache";
|
||||
@ -30,7 +30,7 @@ export interface MetadataCache extends UserMetadata {
|
||||
zapService?: HexKey;
|
||||
}
|
||||
|
||||
export function mapEventToProfile(ev: TaggedRawEvent) {
|
||||
export function mapEventToProfile(ev: RawEvent) {
|
||||
try {
|
||||
const data: UserMetadata = JSON.parse(ev.content);
|
||||
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() {
|
||||
if (hasSubtleCrypto) return;
|
||||
|
||||
@ -256,9 +229,9 @@ export default function LoginPage() {
|
||||
<div className="login">
|
||||
<div>
|
||||
<div className="login-container">
|
||||
<div className="logo" onClick={() => navigate("/")}>
|
||||
<h1 className="logo" onClick={() => navigate("/")}>
|
||||
Snort
|
||||
</div>
|
||||
</h1>
|
||||
<h1 dir="auto">
|
||||
<FormattedMessage defaultMessage="Login" description="Login header" />
|
||||
</h1>
|
||||
@ -291,9 +264,11 @@ export default function LoginPage() {
|
||||
<button type="button" onClick={doLogin}>
|
||||
<FormattedMessage defaultMessage="Login" description="Login button" />
|
||||
</button>
|
||||
<AsyncButton onClick={() => makeRandomKey()}>
|
||||
<FormattedMessage defaultMessage="Create Account" />
|
||||
</AsyncButton>
|
||||
{altLogins()}
|
||||
</div>
|
||||
{generateKey()}
|
||||
{installExtension()}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -32,6 +32,11 @@ export default function GetVerified() {
|
||||
<h1>
|
||||
<FormattedMessage {...messages.Identifier} />
|
||||
</h1>
|
||||
<div className="next-actions continue-actions">
|
||||
<button className="secondary" type="button" onClick={onNext}>
|
||||
<FormattedMessage {...messages.Skip} />
|
||||
</button>
|
||||
</div>
|
||||
<h4>
|
||||
<FormattedMessage {...messages.PreviewOnSnort} />
|
||||
</h4>
|
||||
|
@ -68,9 +68,6 @@ export default function ImportFollows() {
|
||||
</p>
|
||||
|
||||
<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")}>
|
||||
<FormattedMessage {...messages.Next} />
|
||||
</button>
|
||||
|
@ -46,7 +46,7 @@ export default defineMessages({
|
||||
PopularAccounts: { defaultMessage: "Follow some popular accounts" },
|
||||
Skip: { defaultMessage: "Skip" },
|
||||
Done: { defaultMessage: "Done!" },
|
||||
ImportTwitter: { defaultMessage: "Import Twitter Follows (optional)" },
|
||||
ImportTwitter: { defaultMessage: "Import Twitter Follows" },
|
||||
TwitterPlaceholder: { defaultMessage: "Twitter username..." },
|
||||
FindYourFollows: { defaultMessage: "Find your twitter follows on nostr (Data provided by {provider})" },
|
||||
TwitterUsername: { defaultMessage: "Twitter username" },
|
||||
@ -56,7 +56,7 @@ export default defineMessages({
|
||||
Check: { defaultMessage: "Check" },
|
||||
Next: { defaultMessage: "Next" },
|
||||
SetupProfile: { defaultMessage: "Setup your Profile" },
|
||||
Identifier: { defaultMessage: "Get an identifier (optional)" },
|
||||
Identifier: { defaultMessage: "Get an identifier" },
|
||||
IdentifierHelp: {
|
||||
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.",
|
||||
|
@ -80,7 +80,7 @@ export default function ProfileSettings(props: ProfileSettingsProps) {
|
||||
const ev = await publisher.metadata(userCopy);
|
||||
publisher.broadcast(ev);
|
||||
|
||||
const newProfile = mapEventToProfile(ev as TaggedRawEvent);
|
||||
const newProfile = mapEventToProfile(ev);
|
||||
if (newProfile) {
|
||||
await UserCache.set(newProfile);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user