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: show version highlights dialog
thecodrr466050bf11da
diff --git a/apps/web/src/app-effects.js b/apps/web/src/app-effects.jsindex f5e50b0be..69024b0cf 100644--- a/apps/web/src/app-effects.js+++ b/apps/web/src/app-effects.js@@ -16,6 +16,7 @@ import useAnnouncements from "./utils/use-announcements";import {showAnnouncementDialog,showBuyDialog,+ showFeatureDialog,showInvalidSystemTimeDialog,showOnboardingDialog,} from "./common/dialog-controller";@@ -79,7 +80,8 @@ export default function AppEffects({ setShow }) {await resetReminders();setIsVaultCreated(await db.vault.exists());- showOnboardingDialog(interruptedOnboarding());+ await showOnboardingDialog(interruptedOnboarding());+ await showFeatureDialog("highlights");})();return () => {userCheckStatusEvent.unsubscribe();diff --git a/apps/web/src/components/announcements/body.js b/apps/web/src/components/announcements/body.jsindex 6254aebd4..80f2f4ff3 100644--- a/apps/web/src/components/announcements/body.js+++ b/apps/web/src/components/announcements/body.js@@ -55,7 +55,7 @@ export default function AnnouncementBody({ id, components, type }) {style: { ...item.style, textAlign: "left", marginTop: 1 },}}fontSize="body"- color="text"+ color="icon"/>);case "callToActions":diff --git a/apps/web/src/components/dialogs/feature-dialog.tsx b/apps/web/src/components/dialogs/feature-dialog.tsxnew file mode 100644index 000000000..fc0b1a813--- /dev/null+++ b/apps/web/src/components/dialogs/feature-dialog.tsx@@ -0,0 +1,169 @@+import React from "react";+import { Text, Flex } from "rebass";+import Dialog from "./dialog";+import * as Icon from "../icons";+import { getHomeRoute, hardNavigate } from "../../navigation";+import { appVersion } from "../../utils/version";+import Tag from "../tag";+import IconTag from "../icon-tag";+import Config from "../../utils/config";++type CallToAction = {+ title: string;+ icon?: (props: any) => JSX.Element;+ action?: () => void;+};+type SubFeature = {+ title: string;+ icon?: (props: any) => JSX.Element;+ subtitle?: string | JSX.Element;+};+type Feature = {+ shouldShow?: () => boolean;+ title: string;+ subtitle?: string;+ cta: CallToAction;+ subFeatures?: SubFeature[];+};++type FeatureKeys = "confirmed" | "highlights";+const features: Record<FeatureKeys, Feature> = {+ confirmed: {+ title: "Email confirmed!",+ subtitle: "You can now sync your notes to unlimited devices.",+ cta: {+ title: "Continue",+ icon: Icon.ArrowRight,+ action: () => hardNavigate(getHomeRoute()),+ },+ },+ highlights: {+ title: "✨ Highlights ✨",+ subtitle: `Welcome to v${appVersion.clean}`,+ subFeatures: [+ {+ title: "Duplicate notes",+ subtitle: (+ <>+ Tired of copy-pasting notes? Wish there were templates? Not anymore.{" "}+ <Code text="Right click > Duplicate" /> on a note to create its+ duplicate.+ </>+ ),+ icon: Icon.Duplicate,+ },+ {+ title: "Disable sync for specific notes",+ subtitle: (+ <>+ Make any note 100% offline by{" "}+ <Code text="Right click > Disable sync" /> on a note.+ </>+ ),+ icon: Icon.Sync,+ },+ {+ title: "Improved pasting of code",+ subtitle:+ "Pasting code from anywhere (GitHub, VSCode etc.) will now keep the highlighting & formatting intact.",+ icon: Icon.Codeblock,+ },+ ],+ cta: {+ title: "Got it",+ icon: Icon.Checkmark,+ action: () => {+ Config.set(`${appVersion.numerical}:highlights`, true);+ },+ },+ shouldShow: () => {+ const hasShown = Config.get(+ `${appVersion.numerical}:highlights`,+ false+ ) as boolean;+ return !hasShown;+ },+ },+};++type FeatureDialogProps = {+ featureName: FeatureKeys;+ onClose: (result: boolean) => void;+};++function FeatureDialog(props: FeatureDialogProps) {+ const { featureName } = props;+ const feature = features[featureName];+ if (!feature || (feature.shouldShow && !feature.shouldShow())) return null;+ return (+ <Dialog+ isOpen={true}+ title={feature.title}+ description={feature.subtitle}+ alignment="center"+ positiveButton={{+ text: (+ <Flex>+ {feature.cta.icon && (+ <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" overflowY="auto" mt={2}>+ {feature.subFeatures?.map((feature) => (+ <Flex+ mb={2}+ bg="bgSecondary"+ p={2}+ sx={{ borderRadius: "default", ":hover": { bg: "hover" } }}+ flexDirection="column"+ >+ <Flex alignItems={"center"} justifyContent="start">+ {feature.icon && <feature.icon size={14} color="primary" />}+ <Text variant="subtitle" fontWeight="normal" ml={1}>+ {feature.title}+ </Text>+ </Flex>+ {feature.subtitle && (+ <Text variant="body" color="icon">+ {feature.subtitle}+ </Text>+ )}+ </Flex>+ ))}+ </Flex>+ </Dialog>+ );+}+export default FeatureDialog;++type CodeProps = { text: string; href?: string };+export function Code(props: CodeProps) {+ return (+ <Text+ as="code"+ sx={{+ bg: "background",+ color: "text",+ px: 1,+ borderRadius: 5,+ fontFamily: "monospace",+ fontSize: "subBody",+ border: "1px solid var(--border)",+ cursor: props.href ? "pointer" : "unset",+ }}+ onClick={() => {+ if (props.href) window.open(props.href, "_target");+ }}+ >+ {props.text}+ </Text>+ );+}diff --git a/apps/web/src/components/dialogs/featuredialog.js b/apps/web/src/components/dialogs/featuredialog.jsdeleted file mode 100644index 696e850f8..000000000--- a/apps/web/src/components/dialogs/featuredialog.js+++ /dev/null@@ -1,76 +0,0 @@-import React from "react";-import { Text, Flex } from "rebass";-import Dialog from "./dialog";-import * as Icon from "../icons";-import { getHomeRoute, hardNavigate } from "../../navigation";--const features = {- confirmed: {- title: "Email confirmed!",- subtitle: "You can now sync your notes to unlimited devices.",- cta: {- title: "Continue",- icon: Icon.ArrowRight,- action: () => hardNavigate(getHomeRoute()),- },- },-};--function FeatureDialog(props) {- const { featureName } = props;- const feature = features[featureName];- if (!feature) return;- return (- <Dialog- isOpen={true}- title={feature.title}- 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" 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>- {feature.help && (- <Text- as="a"- mt={1}- href={feature.help.link}- target="_blank"- variant="body"- >- {feature.help.title}- </Text>- )}- </Dialog>- );-}-export default FeatureDialog;diff --git a/apps/web/src/components/icons/index.js b/apps/web/src/components/icons/index.jsindex 670e7a6ea..b7b86ff37 100644--- a/apps/web/src/components/icons/index.js+++ b/apps/web/src/components/icons/index.js@@ -145,6 +145,8 @@ import {mdiCloudOffOutline,mdiContentDuplicate,mdiVectorLink,+ mdiCodeString,+ mdiCodeBraces,} from "@mdi/js";import { useTheme } from "emotion-theming";import { AnimatedFlex } from "../animated";@@ -363,3 +365,4 @@ export const Rename = createIcon(mdiFormTextbox);export const Upload = createIcon(mdiCloudOffOutline);export const Uploaded = createIcon(mdiCloudCheckOutline);export const References = createIcon(mdiVectorLink);+export const Codeblock = createIcon(mdiCodeBraces);diff --git a/apps/web/src/utils/version.js b/apps/web/src/utils/version.jsindex ecf50f4f4..b786188fb 100644--- a/apps/web/src/utils/version.js+++ b/apps/web/src/utils/version.js@@ -4,6 +4,7 @@ export const appVersion = {process.env.REACT_APP_GIT_HASH,process.env.REACT_APP_PLATFORM),+ clean: formatVersion(process.env.REACT_APP_VERSION),numerical: parseInt(process.env.REACT_APP_VERSION),};