refactor: remove unused imports & refs

This commit is contained in:
thecodrr
2020-01-07 10:37:14 +05:00
parent fe5cd12e77
commit f99ff565a3
6 changed files with 9 additions and 11 deletions

View File

@@ -14,7 +14,7 @@ const NavMenuItem = props => {
if (props.selected) {
navigate(props.item.key);
}
}, []);
}, [props.item.key, props.selected]);
return (
<Button
onClick={props.onSelected}

View File

@@ -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";

View File

@@ -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">

View File

@@ -1,6 +1,5 @@
import React from "react";
import { Flex, Box, Text } from "rebass";
import { SHADOW } from "../../theme";
function Menu(props) {
return (

View File

@@ -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">

View File

@@ -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) {