Skip to content

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

refactor: remove unused imports & refs

thecodrrf99ff565a34b
diff --git a/apps/web/src/app.js b/apps/web/src/app.js
index 818eaaca4..aca15aba3 100644
--- a/apps/web/src/app.js
+++ b/apps/web/src/app.js
@@ -14,7 +14,7 @@ const NavMenuItem = props => {
if (props.selected) {
navigate(props.item.key);
}
- }, []);
+ }, [props.item.key, props.selected]);
return (
<Button
onClick={props.onSelected}
diff --git a/apps/web/src/components/list-item/index.js b/apps/web/src/components/list-item/index.js
index 387025f07..787e6f144 100644
--- a/apps/web/src/components/list-item/index.js
+++ b/apps/web/src/components/list-item/index.js
@@ -1,7 +1,6 @@
import React from "react";
import { Flex, Box, Text } from "rebass";
import * as Icon from "react-feather";
-import { ButtonPressedStyle } from "../../theme";
import Dropdown, { DropdownTrigger, DropdownContent } from "../dropdown";
import Menu from "../menu";
diff --git a/apps/web/src/components/listview/index.js b/apps/web/src/components/listview/index.js
index e793066a4..b1e067157 100644
--- a/apps/web/src/components/listview/index.js
+++ b/apps/web/src/components/listview/index.js
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from "react";
-import { Box, Flex, Text } from "rebass";
+import { Flex, Text } from "rebass";
import Button from "../button";
import { ev } from "../../common";
import ListItem from "../list-item";
@@ -20,7 +20,7 @@ function ListView({ type, getItems, menu, button }) {
return () => {
ev.removeListener(`refresh${type}`, onRefreshItems);
};
- }, []);
+ }, [getItems, type]);
return (
<Flex flexDirection="column" flex="1 1 auto">
diff --git a/apps/web/src/components/menu/index.js b/apps/web/src/components/menu/index.js
index c205c9df3..cc3f82d8c 100644
--- a/apps/web/src/components/menu/index.js
+++ b/apps/web/src/components/menu/index.js
@@ -1,6 +1,5 @@
import React from "react";
import { Flex, Box, Text } from "rebass";
-import { SHADOW } from "../../theme";
function Menu(props) {
return (
diff --git a/apps/web/src/views/Home.js b/apps/web/src/views/Home.js
index 451434917..058ee87ad 100644
--- a/apps/web/src/views/Home.js
+++ b/apps/web/src/views/Home.js
@@ -1,4 +1,4 @@
-import React, { useEffect, useState, useRef } from "react";
+import React, { useEffect, useState } from "react";
import { Flex, Text, Box } from "rebass";
import * as Icon from "react-feather";
import { db, ev, sendNewNoteEvent } from "../common";
@@ -39,7 +39,7 @@ function Home() {
}}
groupCounts={notes.groupCounts}
group={groupIndex =>
- notes.groups[groupIndex].title == "Pinned" ? (
+ notes.groups[groupIndex].title === "Pinned" ? (
<Box px={3} bg="background" py={1} />
) : (
<Box px={3} bg="background">
diff --git a/apps/web/src/views/Notebooks.js b/apps/web/src/views/Notebooks.js
index 53c564a2f..ba61ccb07 100644
--- a/apps/web/src/views/Notebooks.js
+++ b/apps/web/src/views/Notebooks.js
@@ -3,7 +3,7 @@ import { Flex, Box, Text, Button as RebassButton } from "rebass";
import { Input, Checkbox, Label } from "@rebass/forms";
import Button from "../components/button";
import * as Icon from "react-feather";
-import theme, { DIALOG_SHADOW } from "../theme";
+import theme from "../theme";
import Search from "../components/search";
import Modal from "react-modal";
import { db, ev } from "../common";
@@ -23,11 +23,10 @@ const Notebooks = props => {
const [intent, setIntent] = useState(props.intent);
useEffect(() => {
function onRefresh() {
- console.log("Refreshing notebooks");
setNotebooks(db.getNotebooks());
}
onRefresh();
- navigationEvents.onWillNavigateAway = (routeName, params) => {
+ navigationEvents.onWillNavigateAway = routeName => {
if (routeName !== "notebooks" && intent === "moveNote") {
return window.confirm(
"Are you sure you want to navigate away? Your note selection will be lost."
@@ -38,9 +37,10 @@ const Notebooks = props => {
ev.addListener("refreshNotebooks", onRefresh);
return () => {
ev.removeListener("refreshNotebooks", onRefresh);
+ navigationEvents.onWillNavigateAway = undefined;
Notebooks.onRefresh = undefined;
};
- }, []);
+ }, [intent]);
function navigate(item, save = true, title = undefined) {
//transform notes in a topic to real notes
if (item.notes) {