Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: improve dialog ui & simplify signup flow

thecodrr0f1f2b9640d7
diff --git a/apps/web/src/common/reminders.js b/apps/web/src/common/reminders.js
index 2c624c6be..95bf21c76 100644
--- a/apps/web/src/common/reminders.js
+++ b/apps/web/src/common/reminders.js
@@ -63,8 +63,8 @@ export const Reminders = {
},
email: {
key: "email",
- title: "Please confirm your email",
- subtitle: "Confirm your email to sync notes",
+ title: "Your email is not confirmed",
+ subtitle: "Confirm your email to get 7 more days of free trial",
action: () => hashNavigate("/email/verify"),
icon: Icon.Email,
},
diff --git a/apps/web/src/components/dialogs/dialog.js b/apps/web/src/components/dialogs/dialog.js
index 3e7e4f0ac..67d3252eb 100644
--- a/apps/web/src/components/dialogs/dialog.js
+++ b/apps/web/src/components/dialogs/dialog.js
@@ -51,9 +51,8 @@ function Dialog(props) {
}}
>
<Flex
- p={props.padding || 30}
flexDirection="column"
- width={["100%", "90%", props.width || "33%"]}
+ width={["100%", "90%", props.width || "25%"]}
maxHeight={["100%", "80%", "70%"]}
height={["100%", "auto", "auto"]}
bg="background"
@@ -64,7 +63,7 @@ function Dialog(props) {
position: "relative",
overflow: "hidden",
boxShadow: "4px 5px 18px 2px #00000038",
- borderRadius: "default",
+ borderRadius: "dialog",
}}
>
{props.showClose && (
@@ -81,38 +80,61 @@ function Dialog(props) {
onClick={props.onClose}
/>
)}
- <Flex
- flexDirection="column"
- pb={props.headerPaddingBottom || 2}
- //sx={{ borderBottom: "1px solid", borderColor: "border" }}
- >
- {/* {props.icon && (
- <props.icon size={props.iconSize || 38} color="primary" />
- )} */}
- <Text variant="heading" textAlign="left" color="text">
+ <Flex flexDirection="column" p={4} pb={0}>
+ <Text
+ variant="heading"
+ fontSize="subheading"
+ textAlign="left"
+ color="text"
+ >
{props.title}
</Text>
{props.description && (
- <Text variant="body" textAlign="left" color="fontTertiary" mt={1}>
+ <Text variant="body" textAlign="left" color="fontTertiary">
{props.description}
</Text>
)}
</Flex>
- {props.children}
-
+ <Flex flexDirection="column" my={1} mx={4}>
+ {props.children}
+ </Flex>
{(props.positiveButton || props.negativeButton) && (
<Flex
sx={{ justifyContent: props.buttonsAlignment || "flex-end" }}
- mt={3}
+ bg="bgSecondary"
+ p={1}
+ px={2}
+ mt={2}
>
+ {props.negativeButton && (
+ <RebassButton
+ variant="primary"
+ data-test-id="dialog-no"
+ onClick={props.negativeButton.onClick}
+ color="text"
+ fontWeight="bold"
+ bg={"transparent"}
+ sx={{
+ opacity: props.negativeButton.disabled ? 0.7 : 1,
+ ":hover": { bg: "bgSecondary" },
+ }}
+ >
+ {props.negativeButton.text || "Cancel"}
+ </RebassButton>
+ )}
{props.positiveButton && (
<RebassButton
{...props.positiveButton.props}
variant="primary"
+ color="primary"
+ fontWeight="bold"
+ bg={"transparent"}
data-test-id="dialog-yes"
- sx={{ opacity: props.positiveButton.disabled ? 0.7 : 1 }}
- mx={1}
- autoFocus={props.positiveButton.autoFocus}
+ sx={{
+ opacity: props.positiveButton.disabled ? 0.7 : 1,
+ ":hover": { bg: "bgSecondary" },
+ }}
+ autoFocus
disabled={props.positiveButton.disabled || false}
onClick={
!props.positiveButton.disabled
@@ -121,21 +143,12 @@ function Dialog(props) {
}
>
{props.positiveButton.loading ? (
- <Icon.Loading rotate={true} color="static" />
+ <Icon.Loading size={16} color="primary" />
) : (
props.positiveButton.text || "OK"
)}
</RebassButton>
)}
- {props.negativeButton && (
- <RebassButton
- variant="secondary"
- data-test-id="dialog-no"
- onClick={props.negativeButton.onClick}
- >
- {props.negativeButton.text || "Cancel"}
- </RebassButton>
- )}
</Flex>
)}
{props.footer}
diff --git a/apps/web/src/components/dialogs/email-verification-dialog.js b/apps/web/src/components/dialogs/email-verification-dialog.js
index 82690a5db..5e060ffbb 100644
--- a/apps/web/src/components/dialogs/email-verification-dialog.js
+++ b/apps/web/src/components/dialogs/email-verification-dialog.js
@@ -1,15 +1,37 @@
-import React from "react";
+import React, { useEffect } from "react";
import { Flex, Button, Text } from "rebass";
import Dialog from "./dialog";
import { useStore as useUserStore } from "../../stores/user-store";
import { db } from "../../common/db";
import { useState } from "react";
+import { useSessionState } from "../../utils/hooks";
+var interval = 0;
function EmailVerificationDialog(props) {
const user = useUserStore((store) => store.user);
- const [error, setError] = useState();
const [isSending, setIsSending] = useState(false);
- const [canSendAgain, setCanSendAgain] = useState(true);
+ const [canSendAgain, setCanSendAgain] = useSessionState("canSendAgain", true);
+ const [resetTimer, setResetTimer] = useSessionState("resetTimer", 60);
+
+ useEffect(() => {
+ if (!canSendAgain) {
+ interval = setInterval(() => {
+ setResetTimer((s) => {
+ --s;
+ if (s <= 0) {
+ setCanSendAgain(true);
+ clearInterval(interval);
+ return 60;
+ }
+ return s;
+ });
+ }, 1000);
+ }
+ return () => {
+ clearInterval(interval);
+ };
+ }, [canSendAgain, setResetTimer, setCanSendAgain]);
+
if (!user) {
props.onCancel();
return null;
@@ -18,12 +40,29 @@ function EmailVerificationDialog(props) {
<Dialog
isOpen={true}
title={"Verify your email"}
- description={"Please check your inbox for the confirmation email."}
+ description={
+ "Check your spam folder if you haven't received an email yet."
+ }
onClose={props.onCancel}
positiveButton={{
- text: "Done",
- onClick: props.onCancel,
+ text: canSendAgain || isSending ? "Resend" : `Resend (${resetTimer})`,
+ onClick: async () => {
+ setIsSending(true);
+ try {
+ await db.user.sendVerificationEmail();
+ setCanSendAgain(false);
+ } catch (e) {
+ console.error(e);
+ } finally {
+ setIsSending(false);
+ }
+ },
loading: isSending,
+ disabled: isSending || !canSendAgain,
+ }}
+ negativeButton={{
+ text: "Cancel",
+ onClick: props.onCancel,
disabled: isSending,
}}
>
@@ -31,43 +70,14 @@ function EmailVerificationDialog(props) {
<Text
as="span"
variant="body"
- bg="shade"
- color="primary"
- p={1}
alignSelf="stretch"
sx={{ borderRadius: "default" }}
>
- We have sent the email with the confirmation link to{" "}
- <b>{user.email}</b>.
- </Text>
- {canSendAgain && (
- <Button
- mt={2}
- variant="anchor"
- onClick={async () => {
- try {
- setIsSending(true);
- setCanSendAgain(false);
- setTimeout(() => setCanSendAgain(true), 60 * 1000);
- await db.user.sendVerificationEmail();
- } catch (e) {
- setError(e.message);
- } finally {
- setIsSending(false);
- }
- }}
- >
- Resend confirmation email
- </Button>
- )}
- <Text variant="error" mt={2} color={error ? "error" : "success"}>
- {isSending
- ? "Sending confirmation email. Please wait..."
- : !canSendAgain && !isSending
- ? "Confirmation email sent. You can resend the email after 1 minute in case you didn't receive it."
- : !!error
- ? error
- : ""}
+ We have sent the confirmation link to your email at{" "}
+ <Text as="b" fontWeight="bold">
+ {user.email}
+ </Text>
+ .
</Text>
</Flex>
</Dialog>
diff --git a/apps/web/src/components/dialogs/featuredialog.js b/apps/web/src/components/dialogs/featuredialog.js
index 09b86bed8..bf8beaaef 100644
--- a/apps/web/src/components/dialogs/featuredialog.js
+++ b/apps/web/src/components/dialogs/featuredialog.js
@@ -1,8 +1,8 @@
import React from "react";
-import { Text, Flex, Button } from "rebass";
+import { Text, Flex } from "rebass";
import Dialog from "./dialog";
import * as Icon from "../icons";
-import Config from "../../utils/config";
+import { getHomeRoute, hardNavigate } from "../../navigation";
const features = {
monographs: {
@@ -39,6 +39,66 @@ const features = {
},
],
},
+ welcome: {
+ title: "Thank you for signing up!",
+ subtitle:
+ "You can use all features of Notesnook for 7 days. No limitations. No commitments.",
+
+ subFeatures: [
+ {
+ title: "Unlimited notes & notebooks",
+ icon: Icon.Note,
+ },
+ {
+ title: "Unlimited file & image attachments",
+ icon: Icon.Attachment,
+ },
+ {
+ title: "Lock any note with a password",
+ icon: Icon.Vault,
+ },
+ {
+ title: "Automatic encrypted backups",
+ icon: Icon.Backup,
+ },
+ ],
+ help: {
+ title: "What else is included in the free trial?",
+ link: "https://notesnook.com/pricing",
+ },
+ cta: { title: "Start taking notes", icon: Icon.Write },
+ },
+ confirmed: {
+ title: "Email confirmed!",
+ subtitle: "Your have been rewarded 7 more days of free trial. Enjoy!",
+ subFeatures: [
+ {
+ title: "Unlimited notes & notebooks",
+ icon: Icon.Note,
+ },
+ {
+ title: "Unlimited file & image attachments",
+ icon: Icon.Attachment,
+ },
+ {
+ title: "Lock any note with a password",
+ icon: Icon.Vault,
+ },
+ {
+ title: "Automatic encrypted backups",
+ icon: Icon.Backup,
+ },
+ ],
+ help: {
+ title: "What else is included in the free trial?",
+ link: "https://notesnook.com/pricing",
+ },
+ cta: {
+ title: "Start taking notes",
+ icon: Icon.Write,
+ action: () => hardNavigate(getHomeRoute()),
+ },
+ },
};
function FeatureDialog(props) {
@@ -48,56 +108,54 @@ function FeatureDialog(props) {
return (
<Dialog
isOpen={true}
- // showClose
- headerPaddingBottom={"0px"}
+ title={feature.title}
+ scrollable
+ description={feature.subtitle}
+ buttonsAlignment="center"
+ positiveButton={{
+ text: (
+ <Flex>
+ <feature.cta.icon color="primary" size={16} sx={{ mr: 1 }} />
+ {feature.cta.title}
+ </Flex>
+ ),
+ onClick: () => {
+ if (feature.cta.action) feature.cta.action();
+ props.onClose(true);
+ },
+ }}
>
- <Flex flexDirection="column" flex={1} overflowY="hidden">
- <Flex sx={{ position: "relative" }} alignSelf="center">
- <Text variant="heading" textAlign="center" fontSize="28px">
- {feature.title}
- <Text
- variant="subBody"
- textAlign="center"
- fontWeight="normal"
- fontSize="title"
- >
- {feature.subtitle}
- </Text>
- </Text>
- </Flex>
- <Flex flexDirection="column" py={2} overflowY="auto">
- {feature.subFeatures.map((feature) => (
- <Flex my={2}>
- <feature.icon size={28} color="primary" />
- <Text variant="title" fontWeight="normal" ml={2} flex={1}>
- {feature.title}
+ <Flex flexDirection="column" overflowY="auto">
+ {feature.subFeatures.map((feature) => (
+ <Flex
+ my={feature.subtitle ? 2 : 1}
+ bg="bgSecondary"
+ p={1}
+ sx={{ borderRadius: "default" }}
+ >
+ <feature.icon size={18} color="primary" />
+ <Text variant="subtitle" fontWeight="normal" ml={2} flex={1}>
+ {feature.title}
+ {feature.subtitle && (
<Text variant="body" color="fontTertiary">
{feature.subtitle}
</Text>
- </Text>
- </Flex>
- ))}
- </Flex>
- <Flex pb={2}>
- <Text as="a" href={feature.help.link} target="_blank" variant="body">
- {feature.help.title}
- </Text>
- </Flex>
- <Button
- display="flex"
- fontSize="title"
- fontWeight="bold"
- alignSelf="center"
- mt={2}
- onClick={() => {
- Config.set(`feature:${featureName}`, true);
- props.onClose(true);
- }}
- >
- <feature.cta.icon color="static" size={18} sx={{ mr: 1 }} />
- {feature.cta.title}
- </Button>
+ )}
+ </Text>
+ </Flex>
+ ))}
</Flex>
+ {feature.help && (
+ <Text
+ as="a"
+ mt={1}
+ href={feature.help.link}
+ target="_blank"
+ variant="body"
+ >
+ {feature.help.title}
+ </Text>
+ )}
</Dialog>
);
}
diff --git a/apps/web/src/components/dialogs/tracking-details-dialog.js b/apps/web/src/components/dialogs/tracking-details-dialog.js
index 008a42c82..5926dc178 100644
--- a/apps/web/src/components/dialogs/tracking-details-dialog.js
+++ b/apps/web/src/components/dialogs/tracking-details-dialog.js
@@ -21,10 +21,10 @@ function TrackingDetailsDialog(props) {
<Box overflowY="auto">
<table>
<tr>
- <Text as="th" textAlign="left" variant="title">
+ <Text as="th" textAlign="left" variant="subtitle">
Event name
</Text>{" "}
- <Text as="th" textAlign="left" variant="title">
+ <Text as="th" textAlign="left" variant="subtitle">
Event detail
</Text>
</tr>
diff --git a/apps/web/src/components/editor/header.js b/apps/web/src/components/editor/header.js
index 53a2a41dc..6a7178d9f 100644
--- a/apps/web/src/components/editor/header.js
+++ b/apps/web/src/components/editor/header.js
@@ -105,6 +105,7 @@ function Autosuggest({
>
<Input
ref={inputRef}
+ variant="clean"
width="auto"
alignSelf="flex-start"
sx={{ width: "auto", border: "none", p: 0 }}
diff --git a/apps/web/src/components/editor/titlebox.js b/apps/web/src/components/editor/titlebox.js
index edd8ef795..ac0ea8554 100644
--- a/apps/web/src/components/editor/titlebox.js
+++ b/apps/web/src/components/editor/titlebox.js
@@ -52,6 +52,7 @@ function TitleBox(props) {
></Text>
<Input
ref={inputRef}
+ variant="clean"
data-test-id="editor-title"
className="editorTitle"
autoFocus={shouldFocus}
@@ -68,7 +69,6 @@ function TitleBox(props) {
fontWeight: "heading",
border: "none",
resize: "none",
- ":focus": { outline: "none" },
}}
onKeyDown={(e) => {
if (e.key === "Enter") e.preventDefault();
diff --git a/apps/web/src/components/icons/index.js b/apps/web/src/components/icons/index.js
index 54aa8bc3e..f4fd4c5a1 100644
--- a/apps/web/src/components/icons/index.js
+++ b/apps/web/src/components/icons/index.js
@@ -95,6 +95,9 @@ import {
mdiAlertOctagramOutline,
mdiEyeOutline,
mdiEyeOffOutline,
+ mdiAttachment,
+ mdiPen,
+ mdiPencilOutline,
} from "@mdi/js";
import { useTheme } from "emotion-theming";
import { AnimatedFlex } from "../animated";
@@ -207,6 +210,8 @@ export const CheckCircle = createIcon(mdiCheckCircle);
export const Properties = createIcon(mdiDotsVertical);
export const Markdown = createIcon(mdiLanguageMarkdownOutline);
export const PDF = createIcon(mdiFilePdfOutline);
+export const Attachment = createIcon(mdiAttachment);
+export const Write = createIcon(mdiPencilOutline);
export const HTML = createIcon(mdiLanguageHtml5);
export const Text = createIcon(mdiFormatTitle);
export const Success = createIcon(mdiCheckCircle);
diff --git a/apps/web/src/components/reminder-bar/index.js b/apps/web/src/components/reminder-bar/index.js
index ab99eeb56..735b8996c 100644
--- a/apps/web/src/components/reminder-bar/index.js
+++ b/apps/web/src/components/reminder-bar/index.js
@@ -37,12 +37,12 @@ function ReminderBar() {
sx={{ bg: "shade", mr: 2, p: 2, borderRadius: 80 }}
/>
<Flex variant="columnCenter" alignItems="flex-start">
- <Text display={["block", "none", "block"]} variant="subBody">
- {reminder.subtitle}
- </Text>
<Text variant="body" fontSize={"body"}>
{reminder.title}
</Text>
+ <Text display={["block", "none", "block"]} variant="subBody">
+ {reminder.subtitle}
+ </Text>
</Flex>
</Flex>
{reminder.dismissable && (
diff --git a/apps/web/src/components/status-bar/index.js b/apps/web/src/components/status-bar/index.js
index 2072e684e..19e795cf8 100644
--- a/apps/web/src/components/status-bar/index.js
+++ b/apps/web/src/components/status-bar/index.js
@@ -57,14 +57,16 @@ function StatusBar() {
{user.isEmailConfirmed ? "" : " (not verified)"}
</Text>
</Button>
- <Button
- variant="statusitem"
- display="flex"
- onClick={sync}
- sx={{ alignItems: "center", justifyContent: "center" }}
- >
- <SyncStatus />
- </Button>
+ {SyncStatus && (
+ <Button
+ variant="statusitem"
+ display="flex"
+ onClick={sync}
+ sx={{ alignItems: "center", justifyContent: "center" }}
+ >
+ <SyncStatus />
+ </Button>
+ )}
</>
) : (
<Button
@@ -147,9 +149,8 @@ function statusToInfoText(status) {
function SyncStatus() {
const syncStatus = useAppStore((state) => state.syncStatus);
const lastSynced = useAppStore((state) => state.lastSynced);
- const user = useUserStore((state) => state.user);
- if (!user.isEmailConfirmed || !lastSynced) return null;
+ if (!lastSynced) return null;
switch (syncStatus) {
case "synced":
return (
diff --git a/apps/web/src/components/trash-item/index.js b/apps/web/src/components/trash-item/index.js
index 1d48d083b..9b8a675d6 100644
--- a/apps/web/src/components/trash-item/index.js
+++ b/apps/web/src/components/trash-item/index.js
@@ -52,9 +52,9 @@ const menuItems = [
color: "red",
onClick: ({ item }) => {
confirm({
- title: `Permanently Delete ${toTitleCase(item.itemType)}`,
+ title: `Permanently delete ${item.itemType}`,
subtitle: `Are you sure you want to permanently delete this ${item.itemType}?`,
- yesText: `Delete ${item.itemType}`,
+ yesText: `Delete`,
noText: "Cancel",
message: (
<>
@@ -63,7 +63,7 @@ const menuItems = [
IRREVERSIBLE
</Text>
. You will{" "}
- <Text as="span" color="primary">
+ <Text as="span" color="error">
not be able to recover this {item.itemType}.
</Text>
</>
diff --git a/apps/web/src/navigation/hash-routes.js b/apps/web/src/navigation/hash-routes.js
index 859a03f9e..68025efd9 100644
--- a/apps/web/src/navigation/hash-routes.js
+++ b/apps/web/src/navigation/hash-routes.js
@@ -5,6 +5,7 @@ import {
showCreateTagDialog,
showEditTagDialog,
showEmailVerificationDialog,
+ showFeatureDialog,
} from "../common/dialog-controller";
import {
showAddNotebookDialog,
@@ -114,6 +115,12 @@ const hashroutes = {
"/buy/:plan/:code": ({ plan, code }) => {
showBuyDialog(plan, code);
},
+ "/welcome": () => {
+ showFeatureDialog("welcome");
+ },
+ "/confirmed": () => {
+ showFeatureDialog("confirmed");
+ },
};
export default hashroutes;
diff --git a/apps/web/src/navigation/index.js b/apps/web/src/navigation/index.js
index b776ff2ea..2e0811141 100644
--- a/apps/web/src/navigation/index.js
+++ b/apps/web/src/navigation/index.js
@@ -92,6 +92,10 @@ export function getHomeRoute() {
return HOMEPAGE_ROUTE[Config.get("homepage", 0)];
}
+export function extendHomeRoute(route) {
+ return `${getHomeRoute()}${route}`;
+}
+
export function hardNavigate(route) {
- window.location.assign(route);
+ window.open(route, "_self");
}
diff --git a/apps/web/src/stores/user-store.js b/apps/web/src/stores/user-store.js
index c1a967322..2310a400d 100644
--- a/apps/web/src/stores/user-store.js
+++ b/apps/web/src/stores/user-store.js
@@ -8,6 +8,7 @@ import { showSessionExpiredDialog } from "../common/dialog-controller";
import { showAccountLoggedOutNotice } from "../common/dialog-controller";
import Config from "../utils/config";
import { onPageVisibilityChanged } from "../utils/page-visibility";
+import { extendHomeRoute, hardNavigate, hashNavigate } from "../navigation";
class UserStore extends BaseStore {
isLoggedIn = false;
@@ -57,8 +58,8 @@ class UserStore extends BaseStore {
EV.subscribe(EVENTS.userSubscriptionUpdated, (subscription) => {
this.set((state) => (state.user.subscription = subscription));
});
- EV.subscribe(EVENTS.userEmailConfirmed, async () => {
- window.location.reload();
+ EV.subscribe(EVENTS.userEmailConfirmed, () => {
+ hashNavigate("/confirmed");
});
EV.subscribe(EVENTS.databaseSyncRequested, async () => {
diff --git a/apps/web/src/theme/font/fontsize.js b/apps/web/src/theme/font/fontsize.js
index c77eec5a1..c70a7799c 100644
--- a/apps/web/src/theme/font/fontsize.js
+++ b/apps/web/src/theme/font/fontsize.js
@@ -2,6 +2,7 @@ class FontSizeFactory {
constructor() {
return {
heading: "1.5rem",
+ subheading: "1.2rem",
input: "0.875rem",
title: "0.95rem",
subtitle: "0.85rem",
diff --git a/apps/web/src/theme/variants/button.js b/apps/web/src/theme/variants/button.js
index bc7d78df9..f5d5761d3 100644
--- a/apps/web/src/theme/variants/button.js
+++ b/apps/web/src/theme/variants/button.js
@@ -26,19 +26,17 @@ class Default {
borderRadius: "default",
cursor: "pointer",
p: 2,
- px: 2,
transition: "filter 200ms ease-in",
- ":hover": {
+ ":hover:not(:disabled)": {
filter: "brightness(90%)",
},
":active": {
- filter: "brightness(110%)",
+ filter: "brightness(98%)",
+ },
+ outline: "none",
+ ":focus-visible:not(:active)": {
+ boxShadow: "0px 0px 0px 2px var(--text)",
},
- ":focus:not(:active), :focus-within:not(:active), :focus-visible:not(:active)":
- {
- outline: "none",
- boxShadow: "0px 0px 0px 2px var(--primary)",
- },
":disabled": {
opacity: 0.5,
cursor: "not-allowed",
@@ -53,10 +51,7 @@ class Primary {
variant: "buttons.default",
color: "static",
bg: "primary",
- px: 4,
- ":focus-visible": {
- boxShadow: "0px 0px 0px 2px var(--text)",
- },
+ px: 2,
};
}
}
@@ -73,7 +68,6 @@ class Secondary {
variant: "buttons.default",
color: "text",
bg: "border",
- ":hover:not(:disabled)": { bg: "hover", filter: "brightness(90%)" },
};
}
}
diff --git a/apps/web/src/theme/variants/input.js b/apps/web/src/theme/variants/input.js
index 1ff5b4d37..e98dd29e8 100644
--- a/apps/web/src/theme/variants/input.js
+++ b/apps/web/src/theme/variants/input.js
@@ -3,6 +3,7 @@ class InputFactory {
return {
input: new Default(),
error: new Error(),
+ clean: new Clean(),
};
}
}
@@ -14,17 +15,33 @@ class Default {
borderRadius: "default",
border: "none",
// borderColor: "border",
- boxShadow: "0px 0px 0px 1px var(--border)",
+ boxShadow: "0px 0px 0px 1px var(--border) inset",
fontFamily: "body",
fontWeight: "body",
fontSize: "input",
color: "text",
- ":focus, :focus-within": {
- outline: "none",
- boxShadow: "0px 0px 0px 2px var(--primary)",
+ outline: "none",
+ ":focus": {
+ boxShadow: "0px 0px 0px 2px var(--primary) inset",
+ },
+ ":hover:not(:focus)": {
+ boxShadow: "0px 0px 0px 1px var(--dimPrimary) inset",
+ },
+ };
+ }
+}
+
+class Clean {
+ constructor() {
+ return {
+ variant: "forms.input",
+ outline: "none",
+ boxShadow: "none",
+ ":focus": {
+ boxShadow: "none",
},
":hover:not(:focus)": {
- boxShadow: "0px 0px 0px 1px var(--dimPrimary)",
+ boxShadow: "none",
},
};
}
diff --git a/apps/web/src/utils/hooks.js b/apps/web/src/utils/hooks.js
index a7325828c..0fc6631e3 100644
--- a/apps/web/src/utils/hooks.js
+++ b/apps/web/src/utils/hooks.js
@@ -1,12 +1,26 @@
-import { useState } from "react";
+import { useEffect, useState } from "react";
import config from "./config";
export const usePersistentState = (key, def) => {
let defState = config.get(key, def);
- const [k, setKey] = useState(defState);
- const _setKey = (s) => {
- setKey(s);
- config.set(key, s);
- };
- return [k, _setKey];
+ const [value, setValue] = useState(defState);
+
+ useEffect(() => {
+ config.set(key, value);
+ }, [key, value]);
+
+ return [value, setValue];
+};
+
+const memory = {};
+export const useSessionState = (key, def) => {
+ const [value, setValue] = useState(
+ memory[key] === undefined ? def : memory[key]
+ );
+
+ useEffect(() => {
+ memory[key] = value;
+ }, [key, value]);
+
+ return [value, setValue];
};
diff --git a/apps/web/src/views/auth.js b/apps/web/src/views/auth.js
index 829e0f54e..64eef09f3 100644
--- a/apps/web/src/views/auth.js
+++ b/apps/web/src/views/auth.js
@@ -31,6 +31,9 @@ const authTypes = {
},
secondaryAction: {
text: "Continue without creating an account",
+ onClick: () => {
+ redirectToURL("/");
+ },
},
loading: {
title: "Creating your account",
@@ -67,8 +70,8 @@ const authTypes = {
}
return await userstore
.signup(form)
- .then(async () => {
- redirectToURL(form.redirect || "/");
+ .then(() => {
+ redirectToURL("/notes/#/welcome");
})
.catch((e) => onError(e.message));
},
@@ -384,271 +387,13 @@ function Auth(props) {
</Flex>
)}
{data.agreementText && (
- <Text mt={2} variant="subBody">
+ <Text mt={2} variant="subBody" textAlign="center">
{data.agreementText}
</Text>
)}
</>
)}
</Flex>
-
- {/* <Flex
- bg="background"
- height={"100%"}
- overflowY="auto"
- flexDirection={"row"}
- >
- <Button
- variant="secondary"
- display="flex"
- alignItems="center"
- sx={{ position: "absolute", top: 3, right: 30, cursor: "pointer" }}
- title="Go to app"
- onClick={() => {
- redirectToURL("/");
- }}
- >
- <ArrowRight size={16} />
- <Text variant="body" ml={1}>
- Go to app
- </Text>
- </Button>
- <Box
- flexDirection="column"
- justifyContent="center"
- flex={0.35}
- bg="primary"
- p={50}
- display={["none", "none", "flex"]}
- >
- <Flex
- flexDirection="column"
- justifyContent="center"
- alignItems="start"
- >
- <Text
- color="static"
- variant="title"
- fontWeight="heading"
- ml={1}
- fontSize={20}
- >
- Notesnook
- </Text>
-
- <Flex mt={100} flexDirection="column" height={250}>
- <Text
- color="static"
- variant="heading"
- fontWeight="bold"
- fontSize="2em"
- >
- {feature.title}
- </Text>
- <Text mt={4} variant="body" fontSize={"1.1em"} color="static">
- {feature.description}
- </Text>
- {feature.link && (
- <Flex
- as="a"
- sx={{
- textDecorationLine: "underline",
- textDecorationColor: "#fff",
- }}
- href={feature.link}
- mt={4}
- alignItems="center"
- >
- <ArrowRight size={18} color="static" />
- <Text variant="title" ml={1} color="static">
- {feature.linkText}
- </Text>
- </Flex>
- )}
- </Flex>
- <Flex alignSelf="center" mt={50}>
- {features.map((_, i) => (
- <Box
- key={i}
- height={5}
- width={20}
- mr={1}
- sx={{ borderRadius: 100 }}
- bg={featureIndex === i ? "static" : "#ffffff99"}
- onClick={() => setFeatureIndex(i)}
- />
- ))}
- </Flex>
- </Flex>
- </Box>
- <Flex justifyContent="center" flex={1} flexShrink={0}>
- {isAppLoaded ? (
- <Flex
- as="form"
- id="authForm"
- flexDirection="column"
- justifyContent="center"
- alignItems="stretch"
- width={["95%", "55%", "35%"]}
- onSubmit={async (e) => {
- e.preventDefault();
- setIsSubmitting(true);
- const form = new FormData(e.target);
- const obj = Object.fromEntries(form.entries());
- obj.redirect = redirect;
- await data.onSubmit(
- obj,
- (error) => {
- setIsSubmitting(false);
- setError(error);
- },
- setSuccess
- );
- setIsSubmitting(false);
- }}
- >
- <Text variant="heading" textAlign="center" fontWeight="heading">
- {data.title}
- </Text>
- <Text
- variant="body"
- mt={1}
- textAlign="center"
- color="fontTertiary"
- >
- {data.subtitle.text}{" "}
- {data.subtitle.action && (
- <Text
- sx={{
- ":hover": { color: "dimPrimary" },
- cursor: "pointer",
- }}
- as="b"
- color="primary"
- onClick={data.subtitle.action.onClick}
- >
- {data.subtitle.action.text}
- </Text>
- )}
- </Text>
- <Field
- styles={{
- container: { mt: 50 },
- }}
- data-test-id="email"
- id="email"
- required
- name="email"
- autoComplete="email"
- label={data.labels.email}
- helpText={data.helpTexts?.email}
- />
- {data.labels.password && (
- <Field
- styles={{
- container: { mt: 2 },
- }}
- data-test-id="password"
- id="password"
- required
- name="password"
- autoComplete={data.autoComplete?.password}
- label={data.labels.password}
- type="password"
- />
- )}
-
- {data.confirmPassword && (
- <Field
- styles={{
- container: { mt: 2 },
- }}
- data-test-id="confirm-password"
- id="confirmPassword"
- required
- name="confirmPassword"
- autoComplete="confirm-password"
- label="Confirm your password"
- type="password"
- />
- )}
-
- {/* {data.supportsPasswordRecovery && (
- <Button
- type="button"
- alignSelf="start"
- mt={2}
- variant="anchor"
- onClick={() => hardNavigate("/recover", getQueryParams())}
- >
- Forgot password?
- </Button>
- )}
- <Button
- data-test-id="submitButton"
- display="flex"
- type="submit"
- mt={4}
- variant="primary"
- disabled={isSubmitting}
- sx={{ borderRadius: "default" }}
- justifyContent="center"
- alignItems="center"
- >
- {isSubmitting ? (
- <>
- <Loading color="static" size={16} sx={{ mr: 1 }} />{" "}
- {data.primaryAction.loadingText}
- </>
- ) : (
- data.primaryAction.text
- )}
- </Button>
- {data.secondaryAction && (
- <Button
- type="button"
- variant="secondary"
- mt={1}
- onClick={data.secondaryAction.onClick}
- >
- {data.secondaryAction.text}
- </Button>
- )}
- {error && (
- <Flex
- bg="errorBg"
- p={1}
- mt={2}
- sx={{ borderRadius: "default" }}
- >
- <Error size={15} color="error" />
- <Text variant="error" ml={1}>
- {error}
- </Text>
- </Flex>
- )}
- {success && (
- <Flex bg="shade" p={1} mt={2} sx={{ borderRadius: "default" }}>
- <CheckCircle size={15} color="primary" />
- <Text variant="error" color="primary" ml={1}>
- {success}
- </Text>
- </Flex>
- )}
- {data.agreementText && (
- <Text mt={2} variant="subBody">
- {data.agreementText}
- </Text>
- )}
- </Flex>
- ) : (
- <Loader
- title="Did you know?"
- text="Your password never leaves your device. Ever."
- />
- )}
- </Flex>
- </Flex> */}
</Flex>
</ThemeProvider>
);
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index cb19c9b5f..9cddf0a26 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -777,20 +777,6 @@ function AccountStatus(props) {
}
}, [user]);
- if (!user.isEmailConfirmed)
- return (
- <AccountStatusContainer user={user} bg={"errorBg"} color={"error"}>
- <Button mt={2} bg="error" onClick={() => hashNavigate("/email/verify")}>
- <Flex alignItems="center">
- <Icon.Warn color="static" size={13} />
- <Text color="static" ml={1}>
- Please verify your email.
- </Text>
- </Flex>
- </Button>
- </AccountStatusContainer>
- );
-
return (
<AccountStatusContainer user={user} color={"fontTertiary"}>
<Text