Skip to content

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

web: migrate views to typescript

Abdullah Atta20835e1fb385
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js
index 21dfd86e9..077b39006 100644
--- a/apps/web/src/stores/note-store.js
+++ b/apps/web/src/stores/note-store.js
@@ -34,6 +34,9 @@ import { groupArray } from "@notesnook/core/utils/grouping";
*/
class NoteStore extends BaseStore {
notes = [];
+ /**
+ * @type {{ type: "tag" | "color" | "notebook" | "topic" | "favorite" | "monographs", notes: any[] } | undefined}
+ */
context = undefined;
selectedNote = 0;
nonce = 0;
diff --git a/apps/web/src/views/email-confirmed.jsx b/apps/web/src/views/email-confirmed.tsx
similarity index 98%
rename from apps/web/src/views/email-confirmed.jsx
rename to apps/web/src/views/email-confirmed.tsx
index 8f3876ca0..ccdec5b74 100644
--- a/apps/web/src/views/email-confirmed.jsx
+++ b/apps/web/src/views/email-confirmed.tsx
@@ -96,7 +96,7 @@ function EmailConfirmed() {
p={5}
sx={{ flexDirection: "column", justifyContent: "center" }}
>
- <BlogPromoBanner link="https://blog.notesnook.com/why-another-note-taking-app/" />
+ <BlogPromoBanner />
</Flex>
</Flex>
</ThemeProvider>
@@ -152,7 +152,6 @@ function BlogPromoBanner() {
{social.map((account) => (
<account.icon
key={account.title}
- hoverColor={account.hoverColor}
title={account.title}
onClick={() => {
window.open(account.link, "_blank");
diff --git a/apps/web/src/views/notebooks.jsx b/apps/web/src/views/notebooks.tsx
similarity index 97%
rename from apps/web/src/views/notebooks.jsx
rename to apps/web/src/views/notebooks.tsx
index 201c26fa7..01afa5007 100644
--- a/apps/web/src/views/notebooks.jsx
+++ b/apps/web/src/views/notebooks.tsx
@@ -37,7 +37,6 @@ function Notebooks() {
items={notebooks}
placeholder={<Placeholder context="notebooks" />}
button={{
- content: "Create a notebook",
onClick: () => hashNavigate("/notebooks/create")
}}
/>
diff --git a/apps/web/src/views/notes.jsx b/apps/web/src/views/notes.tsx
similarity index 95%
rename from apps/web/src/views/notes.jsx
rename to apps/web/src/views/notes.tsx
index c91b899aa..8b457b440 100644
--- a/apps/web/src/views/notes.jsx
+++ b/apps/web/src/views/notes.tsx
@@ -45,7 +45,7 @@ function Notes() {
refresh={refreshContext}
compact={isCompact}
context={{ ...context, notes: undefined }}
- items={groupArray(context.notes, db.settings.getGroupOptions(type))}
+ items={groupArray(context.notes, db.settings?.getGroupOptions(type))}
placeholder={
<Placeholder
context={
@@ -58,7 +58,6 @@ function Notes() {
/>
}
button={{
- content: "Make a new note",
onClick: () =>
hashNavigate("/notes/create", { addNonce: true, replace: true })
}}
diff --git a/apps/web/src/views/tags.jsx b/apps/web/src/views/tags.tsx
similarity index 100%
rename from apps/web/src/views/tags.jsx
rename to apps/web/src/views/tags.tsx
diff --git a/apps/web/src/views/trash.jsx b/apps/web/src/views/trash.tsx
similarity index 90%
rename from apps/web/src/views/trash.jsx
rename to apps/web/src/views/trash.tsx
index faef92349..0ebaf67f8 100644
--- a/apps/web/src/views/trash.jsx
+++ b/apps/web/src/views/trash.tsx
@@ -39,9 +39,6 @@ function Trash() {
placeholder={<Placeholder context="trash" />}
items={items}
button={{
- show: !!items.length,
- content: "Clear Trash",
- icon: TrashIcon,
onClick: function () {
confirm({
title: "Clear Trash",
@@ -55,10 +52,11 @@ function Trash() {
await clearTrash();
showToast("success", "Trash cleared successfully!");
} catch (e) {
- showToast(
- "error",
- `Could not clear trash. Error: ${e.message}`
- );
+ if (e instanceof Error)
+ showToast(
+ "error",
+ `Could not clear trash. Error: ${e.message}`
+ );
}
}
});