Skip to content

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

feat: allow dismissing a reminder permanently

thecodrrca8ef91b37f1
diff --git a/apps/web/src/common/reminders.js b/apps/web/src/common/reminders.js
index 0cb7bfed1..2c624c6be 100644
--- a/apps/web/src/common/reminders.js
+++ b/apps/web/src/common/reminders.js
@@ -11,6 +11,8 @@ import saveFile from "../commands/save-file";
import { PATHS } from "@notesnook/desktop/paths";
export async function shouldAddBackupReminder() {
+ if (isIgnored("backup")) return false;
+
const backupReminderOffset = Config.get("backupReminderOffset", 0);
if (!backupReminderOffset) return false;
@@ -24,6 +26,8 @@ export async function shouldAddBackupReminder() {
}
export async function shouldAddRecoveryKeyBackupReminder() {
+ if (isIgnored("recoverykey")) return false;
+
const recoveryKeyBackupDate = Config.get("recoveryKeyBackupDate", 0);
if (!recoveryKeyBackupDate) return true;
return dayjs(recoveryKeyBackupDate).add(7, "d").isBefore(dayjs());
@@ -41,7 +45,9 @@ export async function shouldAddConfirmEmailReminder() {
export const Reminders = {
backup: {
+ key: "backup",
subtitle: "Create a backup to keep your notes safe",
+ dismissable: true,
title: "Back up your data",
action: async () => {
if (await verifyAccount()) await createBackup();
@@ -49,20 +55,24 @@ export const Reminders = {
icon: Icon.Backup,
},
login: {
+ key: "login",
title: "Login to sync your notes",
subtitle: "You are not logged in",
action: () => hardNavigate("/login"),
icon: Icon.User,
},
email: {
+ key: "email",
title: "Please confirm your email",
subtitle: "Confirm your email to sync notes",
action: () => hashNavigate("/email/verify"),
icon: Icon.Email,
},
recoverykey: {
+ key: "recoverykey",
title: "Backup your recovery key",
subtitle: "Keep your recovery key safe",
+ dismissable: true,
action: async () => {
if (await verifyAccount()) await showRecoveryKeyDialog();
},
@@ -96,3 +106,7 @@ export async function resetReminders() {
}
appStore.get().setReminders(...reminders);
}
+
+function isIgnored(key) {
+ return Config.get(`ignored:${key}`, false);
+}
diff --git a/apps/web/src/components/reminder-bar/index.js b/apps/web/src/components/reminder-bar/index.js
index b889c0abe..ab99eeb56 100644
--- a/apps/web/src/components/reminder-bar/index.js
+++ b/apps/web/src/components/reminder-bar/index.js
@@ -3,6 +3,7 @@ import { Button, Flex, Text } from "rebass";
import { useStore as useAppStore } from "../../stores/app-store";
import { Reminders } from "../../common/reminders";
import * as Icon from "../icons";
+import Config from "../../utils/config";
function ReminderBar() {
const reminders = useAppStore((store) => store.reminders);
@@ -44,22 +45,30 @@ function ReminderBar() {
</Text>
</Flex>
</Flex>
- <Button
- onClick={(e) => {
- e.stopPropagation();
- dismissReminders(reminder);
- }}
- sx={{
- borderRadius: 50,
- p: 1,
- mr: 1,
- bg: "transparent",
- ":hover": { backgroundColor: "shade" },
- }}
- variant="tool"
- >
- <Icon.Dismiss size={20} color="primary" />
- </Button>
+ {reminder.dismissable && (
+ <Button
+ onClick={(e) => {
+ e.stopPropagation();
+ const dontShowAgain = window.confirm(
+ "Don't show again on this device?"
+ );
+ dismissReminders(reminder);
+ if (dontShowAgain) {
+ Config.set(`ignored:${reminder.key}`, true);
+ }
+ }}
+ sx={{
+ borderRadius: 50,
+ p: 1,
+ mr: 1,
+ bg: "transparent",
+ ":hover": { backgroundColor: "shade" },
+ }}
+ variant="tool"
+ >
+ <Icon.Dismiss size={20} color="primary" />
+ </Button>
+ )}
</Flex>
);
}