A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
feat: add feature introduction dialog
thecodrrdada371e5e9f
diff --git a/apps/web/package.json b/apps/web/package.jsonindex 70c6697d5..d23b2bf3b 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -8,7 +8,6 @@"homepage": "https://notesnook.com/","repository": "https://github.com/streetwriters/notesnook","dependencies": {- "@inlightmedia/react-countdown-timer": "^1.1.2","@mdi/js": "^5.9.55","@mdi/react": "^1.4.0","@rebass/forms": "^4.0.6",@@ -37,7 +36,6 @@"react-dom": "^17.0.1","react-modal": "^3.12.1","react-qrcode-logo": "^2.2.1",- "react-responsive-carousel": "^3.2.12","react-scripts": "4.0.2","react-scroll-sync": "^0.9.0","react-scrollbars-custom": "^4.0.25",diff --git a/apps/web/src/app-effects.js b/apps/web/src/app-effects.jsindex e6f4ff464..0dbded5a0 100644--- a/apps/web/src/app-effects.js+++ b/apps/web/src/app-effects.js@@ -4,7 +4,7 @@ import { useStore as useUserStore } from "./stores/user-store";import { useStore as useNotesStore } from "./stores/note-store";import useVersion, { getCachedVersion } from "./utils/useVersion";import { resetReminders } from "./common/reminders";-import { isUserPremium } from "./common";+import { introduceFeatures, isUserPremium } from "./common";import { db } from "./common/db";import { CHECK_IDS, EV, EVENTS } from "notes-core/common";import { registerKeyMap } from "./common/key-map";@@ -88,6 +88,7 @@ function AppEffects({ isMobile, isTablet, setShow }) {}, [isEditorOpen, isMobile, isTablet]);useEffect(() => {+ introduceFeatures();return () => {EV.unsubscribeAll();};diff --git a/apps/web/src/common/dialogcontroller.js b/apps/web/src/common/dialogcontroller.jsindex 8cca78383..a16f7727d 100644--- a/apps/web/src/common/dialogcontroller.js+++ b/apps/web/src/common/dialogcontroller.js@@ -498,3 +498,12 @@ export function showSessionExpiredDialog(email) {/>));}++export function showFeatureDialog(featureName) {+ return showDialog((Dialogs, perform) => (+ <Dialogs.FeatureDialog+ featureName={featureName}+ onClose={(res) => perform(res)}+ />+ ));+}diff --git a/apps/web/src/common/index.js b/apps/web/src/common/index.jsindex 12992f165..ae27c6ce7 100644--- a/apps/web/src/common/index.js+++ b/apps/web/src/common/index.js@@ -3,7 +3,10 @@ import SelectionOptions from "./selectionoptions";import { showToast } from "../utils/toast";import download from "../utils/download";import { Text } from "rebass";-import { showLoadingDialog } from "../common/dialog-controller";+import {+ showFeatureDialog,+ showLoadingDialog,+} from "../common/dialog-controller";import Config from "../utils/config";import { store as userstore } from "../stores/user-store";import { hashNavigate } from "../navigation";@@ -52,6 +55,13 @@ export const CREATE_BUTTON_MAP = {},};+export async function introduceFeatures() {+ const features = ["monographs"];+ for (let feature of features) {+ if (!Config.get(`feature:${feature}`)) await showFeatureDialog(feature);+ }+}+export const DEFAULT_CONTEXT = { colors: [], tags: [], notebook: {} };export function notesFromContext(context) {diff --git a/apps/web/src/components/dialogs/buydialog.js b/apps/web/src/components/dialogs/buydialog.jsindex 741ec041c..a007d6efd 100644--- a/apps/web/src/components/dialogs/buydialog.js+++ b/apps/web/src/components/dialogs/buydialog.js@@ -13,8 +13,6 @@ import { ReactComponent as Organize } from "../../assets/organize.svg";import { ReactComponent as RichText } from "../../assets/richtext.svg";import { ReactComponent as Sync } from "../../assets/sync.svg";import { ReactComponent as Vault } from "../../assets/vault.svg";-import "react-responsive-carousel/lib/styles/carousel.min.css"; // requires a loader-import { changeSvgTheme } from "../../utils/css";import getSymbolFromCurrency from "currency-symbol-map";import { trackEvent } from "../../utils/analytics";@@ -119,7 +117,6 @@ function BuyDialog(props) {const [plan, setPlan] = useState("monthly");const isLoggedIn = useUserStore((store) => store.isLoggedIn);const user = useUserStore((store) => store.user);- const accent = useThemeStore((store) => store.accent);useEffect(() => {(async function () {@@ -150,7 +147,6 @@ function BuyDialog(props) {isOpen={true}// showCloseonClose={props.onCancel}- onOpen={() => changeSvgTheme(accent)}padding={"0px"}margin={"0px"}headerPaddingBottom={"0px"}diff --git a/apps/web/src/components/dialogs/featuredialog.js b/apps/web/src/components/dialogs/featuredialog.jsnew file mode 100644index 000000000..09b86bed8--- /dev/null+++ b/apps/web/src/components/dialogs/featuredialog.js@@ -0,0 +1,104 @@+import React from "react";+import { Text, Flex, Button } from "rebass";+import Dialog from "./dialog";+import * as Icon from "../icons";+import Config from "../../utils/config";++const features = {+ monographs: {+ title: "Introducing Monographs",+ subtitle: "A simple & secure way to share your notes.",+ help: {+ title: "What is a monograph & how it works?",+ link: "https://docs.notesnook.com/monographs",+ },+ cta: { title: "Start publishing", icon: Icon.Rocket },+ subFeatures: [+ {+ title: "Publish unlimited notes for free",+ subtitle: "Publish any note you want. Completely free. No limits.",+ icon: Icon.Publish,+ },+ {+ title: "Share a note with anyone in the world",+ subtitle:+ "It just takes 2 taps to publish a note to a public URL and anyone with the link can view it.",+ icon: Icon.Share,+ },+ {+ title: "Put a password to make it private",+ subtitle:+ "Turn on password protection so only people with the password can unlock and view it.",+ icon: Icon.Password,+ },+ {+ title: "Self destruct for one time notes",+ subtitle:+ "Share one-time sensitive notes with self destruct on; the note will be destroyed after the first person views it.",+ icon: Icon.Destruct,+ },+ ],+ },+};++function FeatureDialog(props) {+ const { featureName } = props;+ const feature = features[featureName];+ if (!feature) return;+ return (+ <Dialog+ isOpen={true}+ // showClose+ headerPaddingBottom={"0px"}+ >+ <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}+ <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>+ </Flex>+ </Dialog>+ );+}+export default FeatureDialog;diff --git a/apps/web/src/components/dialogs/index.js b/apps/web/src/components/dialogs/index.jsindex 4e07130fc..d7f31e42f 100644--- a/apps/web/src/components/dialogs/index.js+++ b/apps/web/src/components/dialogs/index.js@@ -12,6 +12,7 @@ import RecoveryKeyDialog from "./recoverykeydialog";import SignUpDialog from "./signupdialog";import TopicDialog from "./topicdialog";import SessionExpiredDialog from "./sessionexpireddialog";+import FeatureDialog from "./feature-dialog";const Dialogs = {AddNotebookDialog,@@ -28,5 +29,6 @@ const Dialogs = {SignUpDialog,TopicDialog,SessionExpiredDialog,+ FeatureDialog,};export default Dialogs;diff --git a/apps/web/src/components/icons/index.js b/apps/web/src/components/icons/index.jsindex fc085b108..fd0589906 100644--- a/apps/web/src/components/icons/index.js+++ b/apps/web/src/components/icons/index.js@@ -150,3 +150,8 @@ export const NotebookEdit = createIcon(Icons.mdiBookEditOutline);export const DeleteForver = createIcon(Icons.mdiDeleteForeverOutline);export const Monographs = createIcon(Icons.mdiTextBoxMultipleOutline);++export const Rocket = createIcon(Icons.mdiRocketLaunchOutline);+export const Share = createIcon(Icons.mdiShareVariantOutline);+export const Password = createIcon(Icons.mdiFormTextboxPassword);+export const Destruct = createIcon(Icons.mdiBomb);diff --git a/apps/web/yarn.lock b/apps/web/yarn.lockindex 8a3e690d3..6d5640093 100644--- a/apps/web/yarn.lock+++ b/apps/web/yarn.lock@@ -1426,13 +1426,6 @@dependencies:"@hapi/hoek" "^9.0.0"-"@inlightmedia/react-countdown-timer@^1.1.2":- version "1.1.2"- resolved "https://registry.yarnpkg.com/@inlightmedia/react-countdown-timer/-/react-countdown-timer-1.1.2.tgz#bf34d9d9b8098d8aba7117d254e2cb0ab318c25d"- integrity sha512-Ydh1Tf6f83S6a97PduDlNj/LaI2ZxTXZHpGEpiXEisfR8Afwuxd+AvZr4JUC9Mt5jLoyTHS4irShZEY+5PaAMw==- dependencies:- moment-mini "^2.24.0"-"@istanbuljs/load-nyc-config@^1.0.0":version "1.1.0"resolved "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz"@@ -8943,11 +8936,6 @@ mkdirp@^1.0.3, mkdirp@^1.0.4:resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz"integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==-moment-mini@^2.24.0:- version "2.24.0"- resolved "https://registry.yarnpkg.com/moment-mini/-/moment-mini-2.24.0.tgz#fa68d98f7fe93ae65bf1262f6abb5fb6983d8d18"- integrity sha512-9ARkWHBs+6YJIvrIp0Ik5tyTTtP9PoV0Ssu2Ocq5y9v8+NOOpWiRshAp8c4rZVWTOe+157on/5G+zj5pwIQFEQ==-move-concurrently@^1.0.1:version "1.0.1"resolved "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz"@@ -9202,18 +9190,6 @@ normalize-url@^4.1.0:resolved "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz"integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==-notes-core@../notes-core:- version "6.6.6"- dependencies:- "@stablelib/blake2s" "^1.0.1"- fast-sort "^2.0.1"- lean-he "^2.1.2"- no-internet "^1.5.2"- qclone "^1.0.4"- quill-delta-to-html "^0.12.0"- showdown "https://github.com/thecodrr/showdown"- spark-md5 "^3.0.1"-"notes-core@git+https://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:[email protected]/streetwriters/notesnook-core.git":version "6.6.6"resolved "git+https://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:[email protected]/streetwriters/notesnook-core.git#4efda31a6c6d2e9f98554630b14abe4b3caea560"@@ -10716,7 +10692,7 @@ [email protected], prompts@^2.0.1, prompts@^2.4.0:kleur "^3.0.3"sisteransi "^1.0.5"-prop-types@^15.5.10, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2:+prop-types@^15.5.10, prop-types@^15.5.7, prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2:version "15.7.2"resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz"integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==@@ -11006,13 +10982,6 @@ react-draggable@^4.4.2:classnames "^2.2.5"prop-types "^15.6.0"-react-easy-swipe@^0.0.21:- version "0.0.21"- resolved "https://registry.npmjs.org/react-easy-swipe/-/react-easy-swipe-0.0.21.tgz"- integrity sha512-OeR2jAxdoqUMHIn/nS9fgreI5hSpgGoL5ezdal4+oO7YSSgJR8ga+PkYGJrSrJ9MKlPcQjMQXnketrD7WNmNsg==- dependencies:- prop-types "^15.5.8"-react-error-overlay@^6.0.9:version "6.0.9"resolved "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz"@@ -11058,15 +11027,6 @@ react-refresh@^0.8.3:resolved "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz"integrity sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg==-react-responsive-carousel@^3.2.12:- version "3.2.12"- resolved "https://registry.npmjs.org/react-responsive-carousel/-/react-responsive-carousel-3.2.12.tgz"- integrity sha512-Wdqpu7+xvn3RPy0Q0pIVOms8SsooYmsFLPgSSxOt+G0WvXHpNOZmnLUsI8EgRRhSww8GUXERKlIYy7MZLdOHPA==- dependencies:- classnames "^2.2.5"- prop-types "^15.5.8"- react-easy-swipe "^0.0.21"-version "4.0.2"resolved "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.2.tgz"