Reset form after account creation.

Hide "get started" in sidebar on smaller screens.
Display user's pubkey after creation
Navigate to home after logout
This commit is contained in:
Bojan Mojsilovic 2023-10-13 15:41:57 +02:00
parent 325bfc5f64
commit aec83dee77
4 changed files with 28 additions and 12 deletions

View File

@ -28,6 +28,15 @@
} }
} }
@media only screen and (max-width: 1300px) {
.callToAction {
.message, .action {
display: none;
}
}
}
@media only screen and (max-width: 720px) { @media only screen and (max-width: 720px) {
.navMenu { .navMenu {
width: 100%; width: 100%;
@ -50,5 +59,9 @@
position: fixed; position: fixed;
bottom: 56px; bottom: 56px;
right: 24px; right: 24px;
.message, .action {
display: none;
}
} }
} }

View File

@ -91,12 +91,6 @@ const CreateAccount: Component = () => { const intl = useIntl();
return url ?? src; return url ?? src;
} }
const setProfile = (hex: string | undefined) => {
profile?.actions.setProfileKey(hex);
profile?.actions.clearNotes();
profile?.actions.fetchNotes(hex);
}
const getScrollHeight = (elm: AutoSizedTextArea) => { const getScrollHeight = (elm: AutoSizedTextArea) => {
var savedValue = elm.value var savedValue = elm.value
elm.value = '' elm.value = ''
@ -212,7 +206,9 @@ const CreateAccount: Component = () => { const intl = useIntl();
const pubkey = account.publicKey; const pubkey = account.publicKey;
const data = new FormData(e.target as HTMLFormElement); const form = e.target as HTMLFormElement;
const data = new FormData(form);
const name = data.get('name')?.toString() || ''; const name = data.get('name')?.toString() || '';
@ -259,6 +255,8 @@ const CreateAccount: Component = () => { const intl = useIntl();
getProfileContactList(account?.publicKey, `user_contacts_${APP_ID}`); getProfileContactList(account?.publicKey, `user_contacts_${APP_ID}`);
} }
form.reset();
setShowCreatePin(true); setShowCreatePin(true);
return false; return false;

View File

@ -9,6 +9,7 @@ import { Link } from '@solidjs/router';
import PageTitle from '../../components/PageTitle/PageTitle'; import PageTitle from '../../components/PageTitle/PageTitle';
import { useAccountContext } from '../../contexts/AccountContext'; import { useAccountContext } from '../../contexts/AccountContext';
import Avatar from '../../components/Avatar/Avatar'; import Avatar from '../../components/Avatar/Avatar';
import { hexToNpub } from '../../lib/keys';
const Account: Component = () => { const Account: Component = () => {
@ -48,9 +49,9 @@ const Account: Component = () => {
</div> </div>
<button <button
class={styles.copy} class={styles.copy}
onClick={() => onCopy(account?.activeUser?.npub || '')} onClick={() => onCopy(hexToNpub(account?.publicKey) || '')}
> >
<Show when={isCoppied() === account?.activeUser?.npub}> <Show when={isCoppied() === hexToNpub(account?.publicKey)}>
<div class={styles.checkIcon}></div> <div class={styles.checkIcon}></div>
</Show> </Show>
{intl.formatMessage(tActions.copyPubkey)} {intl.formatMessage(tActions.copyPubkey)}
@ -63,7 +64,7 @@ const Account: Component = () => {
size="vs" size="vs"
/> />
<div class={styles.key}> <div class={styles.key}>
{account?.activeUser?.npub} {hexToNpub(account?.publicKey)}
</div> </div>
</div> </div>

View File

@ -4,7 +4,7 @@ import styles from './Settings.module.scss';
import { useIntl } from '@cookbook/solid-intl'; import { useIntl } from '@cookbook/solid-intl';
import { settings as t, actions as tActions } from '../../translations'; import { settings as t, actions as tActions } from '../../translations';
import PageCaption from '../../components/PageCaption/PageCaption'; import PageCaption from '../../components/PageCaption/PageCaption';
import { Link } from '@solidjs/router'; import { Link, useNavigate } from '@solidjs/router';
import { useAccountContext } from '../../contexts/AccountContext'; import { useAccountContext } from '../../contexts/AccountContext';
import ButtonPrimary from '../../components/Buttons/ButtonPrimary'; import ButtonPrimary from '../../components/Buttons/ButtonPrimary';
@ -12,6 +12,7 @@ const Menu: Component = () => {
const intl = useIntl(); const intl = useIntl();
const account = useAccountContext(); const account = useAccountContext();
const navigate = useNavigate();
const version = import.meta.env.PRIMAL_VERSION; const version = import.meta.env.PRIMAL_VERSION;
@ -72,7 +73,10 @@ const Menu: Component = () => {
<Show when={account?.sec}> <Show when={account?.sec}>
<div class={styles.webVersion}> <div class={styles.webVersion}>
<ButtonPrimary onClick={account?.actions.logout}> <ButtonPrimary onClick={() => {
account?.actions.logout();
navigate('/');
}}>
{intl.formatMessage(tActions.logout)} {intl.formatMessage(tActions.logout)}
</ButtonPrimary> </ButtonPrimary>
</div> </div>