Skip to content

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

fix: added note showing to favorite

alihamuh48eabd9b87c7
diff --git a/apps/web/src/components/listview/index.js b/apps/web/src/components/listview/index.js
index 40a714323..42aaffa84 100644
--- a/apps/web/src/components/listview/index.js
+++ b/apps/web/src/components/listview/index.js
@@ -6,7 +6,7 @@ import ListItem from "../list-item";
import TimeAgo from "timeago-react";
import ListContainer from "../list-container";
-function ListView({ type, getItems, menu, button }) {
+function ListView({ type, getItems, menu, button, onClick }) {
const [items, setItems] = useState([]);
useEffect(() => {
@@ -30,7 +30,7 @@ function ListView({ type, getItems, menu, button }) {
title={item.title}
body={item.headline}
index={index}
- onClick={() => {}} //TODO
+ onClick={onClick.bind(this, item)} //TODO
info={
<Flex justifyContent="center" alignItems="center">
<TimeAgo datetime={item.dateDeleted || item.dateCreated} />
diff --git a/apps/web/src/views/Favorites.js b/apps/web/src/views/Favorites.js
index e68a2e2a4..3adea2c24 100644
--- a/apps/web/src/views/Favorites.js
+++ b/apps/web/src/views/Favorites.js
@@ -1,7 +1,7 @@
import React from "react";
import { db, ev } from "../common";
import * as Icon from "react-feather";
-import ListItem from "../components/listview";
+import ListView from "../components/listview";
import { showSnack } from "../components/snackbar";
import { ask } from "../components/dialogs";
const dropdownRefs = [];
@@ -54,13 +54,22 @@ const menuItems = item => [
function Favorites() {
return (
- <ListItem
+ <ListView
type="Favorites"
getItems={db.notes.favorites}
menu={{ menuItems, dropdownRefs }}
button={undefined}
+ onClick={item => {
+ if (item.type === "note") {
+ sendOpenNoteEvent(item);
+ }
+ }}
/>
);
}
+function sendOpenNoteEvent(note) {
+ ev.emit("onOpenNote", note);
+}
+
export default Favorites;