mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 14:39:34 +01:00
refactor: remove unused imports & refs
This commit is contained in:
@@ -14,7 +14,7 @@ const NavMenuItem = props => {
|
|||||||
if (props.selected) {
|
if (props.selected) {
|
||||||
navigate(props.item.key);
|
navigate(props.item.key);
|
||||||
}
|
}
|
||||||
}, []);
|
}, [props.item.key, props.selected]);
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
onClick={props.onSelected}
|
onClick={props.onSelected}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Flex, Box, Text } from "rebass";
|
import { Flex, Box, Text } from "rebass";
|
||||||
import * as Icon from "react-feather";
|
import * as Icon from "react-feather";
|
||||||
import { ButtonPressedStyle } from "../../theme";
|
|
||||||
import Dropdown, { DropdownTrigger, DropdownContent } from "../dropdown";
|
import Dropdown, { DropdownTrigger, DropdownContent } from "../dropdown";
|
||||||
import Menu from "../menu";
|
import Menu from "../menu";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Box, Flex, Text } from "rebass";
|
import { Flex, Text } from "rebass";
|
||||||
import Button from "../button";
|
import Button from "../button";
|
||||||
import { ev } from "../../common";
|
import { ev } from "../../common";
|
||||||
import ListItem from "../list-item";
|
import ListItem from "../list-item";
|
||||||
@@ -20,7 +20,7 @@ function ListView({ type, getItems, menu, button }) {
|
|||||||
return () => {
|
return () => {
|
||||||
ev.removeListener(`refresh${type}`, onRefreshItems);
|
ev.removeListener(`refresh${type}`, onRefreshItems);
|
||||||
};
|
};
|
||||||
}, []);
|
}, [getItems, type]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex flexDirection="column" flex="1 1 auto">
|
<Flex flexDirection="column" flex="1 1 auto">
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Flex, Box, Text } from "rebass";
|
import { Flex, Box, Text } from "rebass";
|
||||||
import { SHADOW } from "../../theme";
|
|
||||||
|
|
||||||
function Menu(props) {
|
function Menu(props) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState, useRef } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Flex, Text, Box } from "rebass";
|
import { Flex, Text, Box } from "rebass";
|
||||||
import * as Icon from "react-feather";
|
import * as Icon from "react-feather";
|
||||||
import { db, ev, sendNewNoteEvent } from "../common";
|
import { db, ev, sendNewNoteEvent } from "../common";
|
||||||
@@ -39,7 +39,7 @@ function Home() {
|
|||||||
}}
|
}}
|
||||||
groupCounts={notes.groupCounts}
|
groupCounts={notes.groupCounts}
|
||||||
group={groupIndex =>
|
group={groupIndex =>
|
||||||
notes.groups[groupIndex].title == "Pinned" ? (
|
notes.groups[groupIndex].title === "Pinned" ? (
|
||||||
<Box px={3} bg="background" py={1} />
|
<Box px={3} bg="background" py={1} />
|
||||||
) : (
|
) : (
|
||||||
<Box px={3} bg="background">
|
<Box px={3} bg="background">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Flex, Box, Text, Button as RebassButton } from "rebass";
|
|||||||
import { Input, Checkbox, Label } from "@rebass/forms";
|
import { Input, Checkbox, Label } from "@rebass/forms";
|
||||||
import Button from "../components/button";
|
import Button from "../components/button";
|
||||||
import * as Icon from "react-feather";
|
import * as Icon from "react-feather";
|
||||||
import theme, { DIALOG_SHADOW } from "../theme";
|
import theme from "../theme";
|
||||||
import Search from "../components/search";
|
import Search from "../components/search";
|
||||||
import Modal from "react-modal";
|
import Modal from "react-modal";
|
||||||
import { db, ev } from "../common";
|
import { db, ev } from "../common";
|
||||||
@@ -23,11 +23,10 @@ const Notebooks = props => {
|
|||||||
const [intent, setIntent] = useState(props.intent);
|
const [intent, setIntent] = useState(props.intent);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function onRefresh() {
|
function onRefresh() {
|
||||||
console.log("Refreshing notebooks");
|
|
||||||
setNotebooks(db.getNotebooks());
|
setNotebooks(db.getNotebooks());
|
||||||
}
|
}
|
||||||
onRefresh();
|
onRefresh();
|
||||||
navigationEvents.onWillNavigateAway = (routeName, params) => {
|
navigationEvents.onWillNavigateAway = routeName => {
|
||||||
if (routeName !== "notebooks" && intent === "moveNote") {
|
if (routeName !== "notebooks" && intent === "moveNote") {
|
||||||
return window.confirm(
|
return window.confirm(
|
||||||
"Are you sure you want to navigate away? Your note selection will be lost."
|
"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);
|
ev.addListener("refreshNotebooks", onRefresh);
|
||||||
return () => {
|
return () => {
|
||||||
ev.removeListener("refreshNotebooks", onRefresh);
|
ev.removeListener("refreshNotebooks", onRefresh);
|
||||||
|
navigationEvents.onWillNavigateAway = undefined;
|
||||||
Notebooks.onRefresh = undefined;
|
Notebooks.onRefresh = undefined;
|
||||||
};
|
};
|
||||||
}, []);
|
}, [intent]);
|
||||||
function navigate(item, save = true, title = undefined) {
|
function navigate(item, save = true, title = undefined) {
|
||||||
//transform notes in a topic to real notes
|
//transform notes in a topic to real notes
|
||||||
if (item.notes) {
|
if (item.notes) {
|
||||||
|
|||||||
Reference in New Issue
Block a user