Skip to content

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

feat: add grouping in every list

thecodrrf3e50df4a4c4
diff --git a/apps/web/src/components/group-header/index.js b/apps/web/src/components/group-header/index.js
index 76b176118..19b237f18 100644
--- a/apps/web/src/components/group-header/index.js
+++ b/apps/web/src/components/group-header/index.js
@@ -1,72 +1,130 @@
import * as Icon from "../icons";
-import React, { useState } from "react";
-import { Flex, Text } from "rebass";
+import React, { useMemo } from "react";
+import { Button, Flex, Text } from "rebass";
import Animated from "../animated";
-import { usePersistentState } from "../../utils/hooks";
-import { useStore as useNoteStore } from "../../stores/note-store";
-import { useTheme } from "emotion-theming";
+import { db } from "../../common/db";
+import { useOpenContextMenu } from "../../utils/useContextMenu";
+import { useStore as useSettingsStore } from "../../stores/setting-store";
+import useMobile from "../../utils/use-mobile";
-const groups = [
- { type: undefined, title: "Default" },
- { type: "abc", title: "Alphabetic" },
- { type: "year", title: "Year" },
- { type: "week", title: "Week" },
- { type: "month", title: "Month" },
+const groupByToTitleMap = {
+ [undefined]: "Default",
+ default: "Default",
+ abc: "A - Z",
+ year: "Year",
+ week: "Week",
+ month: "Month",
+};
+
+const menuItems = [
+ {
+ key: "sortDirection:asc",
+ title: () => "Order by ascending",
+ },
+ { key: "sortDirection:desc", title: () => "Order by descending" },
+ { key: "orderSeperator", type: "seperator" },
+ {
+ key: "sortBy:dateCreated",
+ title: () => "Sort by date created",
+ },
+ {
+ key: "sortBy:dateEdited",
+ title: () => "Sort by date edited",
+ },
+ {
+ key: "sortBy:title",
+ title: () => "Sort by title",
+ },
+ { key: "sortSeperator", type: "seperator" },
+ { key: "groupBy:default", title: () => "Group by default" },
+ { key: "groupBy:year", title: () => "Group by year" },
+ { key: "groupBy:month", title: () => "Group by month" },
+ { key: "groupBy:week", title: () => "Group by week" },
+ { key: "groupBy:abc", title: () => "Group by A - Z" },
];
-function getGroupTitleByType(type) {
- return groups.find((v) => v.type === type).title;
+function changeGroupOptions({ groupOptions, type, refresh }, { key: itemKey }) {
+ let [key, value] = itemKey.split(":");
+ groupOptions[key] = value;
+ if (key === "groupBy") {
+ if (value === "abc") groupOptions.sortBy = "title";
+ else groupOptions.sortBy = "dateEdited";
+}
+ db.settings.setGroupOptions(type, groupOptions);
+ refresh();
}
+const getMenuItems = (groupOptions) => {
+ return menuItems.map((item) => {
+ if (item.type === "seperator") return item;
+ let [key, value] = item.key.split(":");
+
+ item.checked = groupOptions[key] === value;
+
+ if (key === "sortBy") {
+ if (value === "title")
+ item.disabled = () => groupOptions.groupBy !== "abc";
+ else item.disabled = () => groupOptions.groupBy === "abc";
+ }
+
+ item.onClick = changeGroupOptions;
+ return item;
+ });
+};
+
function GroupHeader(props) {
- const { title, groups, onJump, wasJumpedTo, index } = props;
- const [selectedGroup] = usePersistentState("selectedGroup", undefined);
- const [isExpanded, setIsExpanded] = useState(false);
- const [menuType, setMenuType] = useState();
- const theme = useTheme();
+ const { title, groups, onJump, index, type, refresh } = props;
+ const groupOptions = useMemo(() => db.settings.getGroupOptions(type), [type]);
+ const openContextMenu = useOpenContextMenu();
+
if (!title) return null;
return (
<Animated.Flex
- bg={"bgSecondary"}
- flexDirection="column"
- sx={{ cursor: "pointer" }}
- animate={{
- backgroundColor: wasJumpedTo
- ? theme.colors["dimPrimary"]
- : "bgSecondary",
- }}
transition={{ duration: 0.3, repeatType: "reverse", repeat: 3 }}
- onClick={() => {
+ onClick={(e) => {
if (groups.length <= 0) return;
- setMenuType("jumpto");
- setIsExpanded((s) => !s);
+ e.stopPropagation();
+ const items = groups.map((group) => ({
+ key: group.title,
+ title: () => group.title,
+ onClick: () => onJump(group.title),
+ checked: group.title === title,
+ }));
+ openContextMenu(e, items, {
+ title: "Jump to group",
+ });
}}
- >
- <Flex
- //my={2}
- pl={2}
- py={1}
+ p={1}
+ mx={1}
+ my={1}
+ py={index > 0 ? [2, "8px"] : 1}
alignItems="center"
justifyContent="space-between"
- sx={{ borderBottom: "1px solid", borderBottomColor: "border" }}
+ bg="bgSecondary"
+ sx={{ borderRadius: "default" }}
>
<Text variant="subtitle" color="primary">
{title}
</Text>
+
{index === 0 && (
+ <Flex mr={1}>
<IconButton
- text={getGroupTitleByType(selectedGroup)}
icon={
- isExpanded ? (
- <Icon.ChevronUp size={18} />
- ) : (
- <Icon.ChevronDown size={18} />
- )
+ groupOptions.sortDirection === "asc"
+ ? Icon.SortAsc
+ : Icon.SortDesc
}
- onClick={() => {
- setMenuType("groupby");
- setIsExpanded((s) => !s);
+ title={`Grouped by ${groupByToTitleMap[groupOptions.groupBy]}`}
+ onClick={(e) => {
+ const items = getMenuItems(groupOptions);
+ openContextMenu(e, items, {
+ title: "Group & sort",
+ groupOptions,
+ refresh,
+ type,
+ });
}}
/>
)}
@@ -99,121 +157,35 @@ function GroupHeader(props) {
isVisible={menuType === "jumpto"}
groups={groups}
/>
- <GroupByMenu isVisible={menuType === "groupby"} />
</Flex>
+ )}
</Animated.Flex>
);
}
export default GroupHeader;
function IconButton(props) {
- const { text, icon, onClick, textStyle, sx } = props;
+ const { text, title, onClick } = props;
+ const isMobile = useMobile();
return (
- <Flex
+ <Button
+ variant="secondary"
+ bg="transparent"
+ display="flex"
+ alignItems="center"
+ title={title}
+ p={1}
+ mr={[2, 0]}
+ sx={{ ":last-of-type": { mr: 0 } }}
onClick={(e) => {
e.stopPropagation();
onClick(e);
}}
- px={1}
- sx={{
- borderRadius: "default",
- cursor: "pointer",
- ":hover": { bg: "hover" },
- ...sx,
- }}
- alignItems="center"
>
- <Text variant="subtitle" fontWeight="normal" sx={textStyle}>
- {text}
- </Text>
- {icon}
- </Flex>
- );
-}
-
-function JumpToGroupMenu(props) {
- const { groups, isVisible, onJump } = props;
- if (!isVisible) return null;
- return (
- <>
- <Text color="primary" variant="title" mb={1}>
- Jump to
- </Text>
- <Flex flexWrap="wrap">
- {groups.map((group) => (
- <IconButton
- text={group.title}
- textStyle={{ fontSize: "body" }}
- onClick={() => onJump(group.title)}
- sx={{ bg: "shade", mr: 1, mt: 1 }}
- ></IconButton>
- ))}
- </Flex>
- </>
- );
-}
-
-function GroupByMenu(props) {
- const { isVisible } = props;
-
- const [sortDirection, setSortDirection] = usePersistentState(
- "sortDirection",
- "desc"
- );
- const [selectedGroup, setSelectedGroup] = usePersistentState(
- "selectedGroup",
- undefined
- );
- const refresh = useNoteStore((store) => store.refresh);
-
- if (!isVisible) return null;
- return (
- <>
- <Flex
- pl={2}
- pr={1}
- mb={1}
- justifyContent="space-between"
- alignItems="center"
- >
- <Text color="primary" variant="title">
- Group by
- </Text>
- <IconButton
- text={sortDirection === "desc" ? "Ascending" : "Descending"}
- icon={
- sortDirection === "desc" ? (
- <Icon.SortDesc size={14} />
- ) : (
- <Icon.SortAsc size={14} />
- )
- }
- textStyle={{ mr: 1 }}
- onClick={() => {
- setSortDirection(sortDirection === "desc" ? "asc" : "desc");
- refresh();
- }}
- />
- </Flex>
- {groups.map((item) => (
- <Flex
- key={item.title}
- justifyContent="space-between"
- alignItems="center"
- p={1}
- px={2}
- sx={{ cursor: "pointer", ":hover": { bg: "shade" } }}
- onClick={() => {
- setSelectedGroup(item.type);
- refresh();
- }}
- >
- <Text variant="body">{item.title}</Text>
- {selectedGroup === item.type && (
- <Icon.Checkmark size={16} color="primary" />
+ {text && <Text variant="body">{text}</Text>}
+ {props.icon && (
+ <props.icon size={isMobile ? 20 : 14} sx={{ ml: text ? 1 : 0 }} />
)}
- </Flex>
- ))}
- </>
+ </Button>
);
}
diff --git a/apps/web/src/components/list-container/index.js b/apps/web/src/components/list-container/index.js
index cb03d341e..ecf8b67bc 100644
--- a/apps/web/src/components/list-container/index.js
+++ b/apps/web/src/components/list-container/index.js
@@ -24,7 +24,6 @@ function ListContainer(props) {
const profile = useMemo(() => ListProfiles[type], [type]);
const shouldSelectAll = useSelectionStore((store) => store.shouldSelectAll);
const setSelectedItems = useSelectionStore((store) => store.setSelectedItems);
- const [jumpToIndex, setJumpToIndex] = useState(-1);
const listRef = useRef();
useEffect(() => {
@@ -86,27 +85,21 @@ function ListContainer(props) {
case "header":
return (
<GroupHeader
+ type={groupType}
+ refresh={refresh}
title={item.title}
index={index}
- groups={props.items.filter(
- (v) =>
- v.type === "header" &&
- v.title !== item.title
- )}
- wasJumpedTo={index === jumpToIndex}
+ groups={props.items.filter((v) => v.type === "header")}
onJump={(title) => {
const index = props.items.findIndex(
(v) => v.title === title
);
if (index < 0) return;
- setJumpToIndex(index);
- listRef.current.scrollToItem(
- index,
- "center"
- );
- setTimeout(() => {
- setJumpToIndex(-1);
- }, 1900);
+ listRef.current.scrollToIndex({
+ index,
+ align: "center",
+ behavior: "smooth",
+ });
}}
/>
);
diff --git a/apps/web/src/components/menu/index.js b/apps/web/src/components/menu/index.js
index 5e37d8a2b..006f0a1db 100644
--- a/apps/web/src/components/menu/index.js
+++ b/apps/web/src/components/menu/index.js
@@ -1,4 +1,5 @@
import { useAnimation } from "framer-motion";
+import { Check } from "../icons";
import React, { useEffect, useMemo } from "react";
import { Flex, Box, Text, Button } from "rebass";
import { useIsUserPremium } from "../../hooks/use-is-user-premium";
@@ -15,91 +16,116 @@ function Menu(props) {
);
return (
- <Container id={id} style={style} sx={sx} state={state}>
+ <Container id={id} title={data?.title} style={style} sx={sx} state={state}>
{menuItems.map(
- ({
- title,
- key,
- onClick,
- component: Component,
- color,
- isPro,
- isNew,
- disabled,
- disableReason,
- icon: Icon,
- }) => (
- <Button
- variant="anchor"
- title={disableReason || title(data)}
- disabled={disabled && disabled(data)}
- data-test-id={`menuitem-${title(data)
- .split(" ")
- .join("")
- .toLowerCase()}`}
- key={key}
- onClick={async (e) => {
- e.stopPropagation();
- if (closeMenu) {
- closeMenu();
+ (
+ {
+ title,
+ key,
+ onClick,
+ component: Component,
+ color,
+ isPro,
+ isNew,
+ disabled,
+ disableReason,
+ checked,
+ icon: Icon,
+ type,
+ },
+ index
+ ) =>
+ type === "seperator" ? (
+ <Box
+ key={key}
+ width="95%"
+ height="0.5px"
+ bg="border"
+ my={2}
+ alignSelf="center"
+ />
+ ) : (
+ <Button
+ variant="anchor"
+ title={
+ (disabled && disabled(data) && disableReason) || title(data)
}
+ disabled={disabled && disabled(data)}
+ data-test-id={`menuitem-${title(data)
+ .split(" ")
+ .join("")
+ .toLowerCase()}`}
+ key={key}
+ onClick={async (e) => {
+ e.stopPropagation();
+ if (closeMenu) {
+ closeMenu();
+ }
- if (!Component) {
- onClick(data);
- }
- }}
- display="flex"
- flexDirection="row"
- alignItems="center"
- py={"0.7em"}
- px={3}
- sx={{
- borderRadius: 0,
- color: color || "text",
- cursor: "pointer",
- ":hover:not(:disabled)": {
- backgroundColor: "shade",
- },
- }}
- >
- {Icon && <Icon color={color || "text"} size={16} sx={{ mr: 1 }} />}
- {Component ? (
- <Component data={data} />
- ) : (
- <Text
- as="span"
- textAlign="left"
- fontFamily="body"
- fontSize="menu"
- flex={1}
- >
- {title(data)}
- </Text>
- )}
- {isPro && !isUserPremium && (
- <Text
- fontSize="subBody"
- bg="primary"
- color="static"
- px={1}
- sx={{ borderRadius: "default" }}
- >
- Pro
- </Text>
- )}
- {isNew && (
- <Text
- fontSize="subBody"
- bg="primary"
- color="static"
- px={1}
- sx={{ borderRadius: "default" }}
- >
- NEW
- </Text>
- )}
- </Button>
- )
+ if (!Component) {
+ onClick(data, menuItems[index]);
+ }
+ }}
+ display="flex"
+ flexDirection="row"
+ alignItems="center"
+ justifyContent="center"
+ py={"0.7em"}
+ px={3}
+ sx={{
+ borderRadius: 0,
+ color: color || "text",
+ cursor: "pointer",
+ ":hover:not(:disabled)": {
+ backgroundColor: "hover",
+ },
+ }}
+ >
+ {Icon && (
+ <Icon
+ color={color || "text"}
+ size={15}
+ sx={{ mr: 2, ml: -1 }}
+ />
+ )}
+ {Component ? (
+ <Component data={data} />
+ ) : (
+ <Text
+ as="span"
+ textAlign="left"
+ fontFamily="body"
+ fontSize="menu"
+ flex={1}
+ >
+ {title(data)}
+ </Text>
+ )}
+ {isPro && !isUserPremium && (
+ <Text
+ fontSize="subBody"
+ bg="primary"
+ color="static"
+ px={1}
+ sx={{ borderRadius: "default" }}
+ >
+ Pro
+ </Text>
+ )}
+ {isNew && (
+ <Text
+ fontSize="subBody"
+ bg="primary"
+ color="static"
+ px={1}
+ sx={{ borderRadius: "default" }}
+ >
+ NEW
+ </Text>
+ )}
+ {checked && <Check size={14} />}
+ </Button>
+ )
)}
</Container>
);
@@ -108,7 +134,7 @@ export default React.memo(Menu, (prev, next) => {
return prev.state === next.state;
});
-function MenuContainer({ id, style, sx, children }) {
+function MenuContainer({ id, style, sx, title, children }) {
return (
<Flex
id={id}
@@ -117,10 +143,11 @@ function MenuContainer({ id, style, sx, children }) {
style={style}
sx={{
position: "relative",
+ width: "11em",
borderRadius: "default",
- border: "2px solid",
+ boxShadow: "0px 10px 10px 0px #00000022",
+ border: "1px solid",
borderColor: "border",
- width: "11em",
...sx,
}}
>
@@ -133,7 +160,7 @@ function MenuContainer({ id, style, sx, children }) {
px={3}
sx={{ borderBottom: "1px solid", borderBottomColor: "border" }}
>
- Properties
+ {title || "Properties"}
</Text>
{children}
</Flex>
@@ -141,7 +168,7 @@ function MenuContainer({ id, style, sx, children }) {
);
}
-function MobileMenuContainer({ style, id, state, children }) {
+function MobileMenuContainer({ style, id, state, title, children }) {
const animation = useAnimation();
useEffect(() => {
@@ -190,7 +217,7 @@ function MobileMenuContainer({ style, id, state, children }) {
/>
<Flex flex="1" flexDirection="column" overflowY="scroll">
<Text variant="title" mt={2} alignSelf="center">
- Properties
+ {title || "Properties"}
</Text>
{children}
</Flex>
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js
index 6dfaa20b3..d0fd442b5 100644
--- a/apps/web/src/stores/note-store.js
+++ b/apps/web/src/stores/note-store.js
@@ -10,6 +10,7 @@ import Config from "../utils/config";
import { showToast } from "../utils/toast";
import { qclone } from "qclone";
import { hashNavigate } from "../navigation";
+import { groupArray } from "notes-core/utils/grouping";
class NoteStore extends BaseStore {
notes = [];
@@ -30,12 +31,11 @@ class NoteStore extends BaseStore {
};
refresh = () => {
- const notes = db.notes.group(
- Config.get("selectedGroup"),
- Config.get("sortDirection", "desc")
- );
this.set((state) => {
- state.notes = qclone(notes);
+ state.notes = groupArray(
+ db.notes.all,
+ db.settings.getGroupOptions("home")
+ );
});
this.refreshContext();
};
diff --git a/apps/web/src/stores/notebook-store.js b/apps/web/src/stores/notebook-store.js
index 82d7ef196..7f2026691 100644
--- a/apps/web/src/stores/notebook-store.js
+++ b/apps/web/src/stores/notebook-store.js
@@ -4,6 +4,7 @@ import { store as appStore } from "./app-store";
import { store as noteStore } from "./note-store";
import BaseStore from "./index";
import { showToast } from "../utils/toast";
+import { groupArray } from "notes-core/utils/grouping";
class NotebookStore extends BaseStore {
notebooks = [];
@@ -12,7 +13,10 @@ class NotebookStore extends BaseStore {
refresh = () => {
this.set((state) => {
- state.notebooks = db.notebooks.all;
+ state.notebooks = groupArray(
+ db.notebooks.all,
+ db.settings.getGroupOptions("notebooks")
+ );
});
this.setSelectedNotebook(this.get().selectedNotebookId);
};
@@ -34,10 +38,13 @@ class NotebookStore extends BaseStore {
};
setSelectedNotebook = (id) => {
- const topics = db.notebooks.notebook(id)?.topics.all;
+ const topics = db.notebooks.notebook(id)?.topics?.all;
if (!topics) return;
this.set((state) => {
- state.selectedNotebookTopics = topics;
+ state.selectedNotebookTopics = groupArray(
+ topics,
+ db.settings.getGroupOptions("topics")
+ );
state.selectedNotebookId = id;
});
};
diff --git a/apps/web/src/stores/tag-store.js b/apps/web/src/stores/tag-store.js
index 731bef221..591ff6487 100644
--- a/apps/web/src/stores/tag-store.js
+++ b/apps/web/src/stores/tag-store.js
@@ -1,12 +1,19 @@
import createStore from "../common/store";
import { db } from "../common/db";
import BaseStore from "./index";
+import { groupArray } from "notes-core/utils/grouping";
class TagStore extends BaseStore {
tags = [];
refresh = () => {
- this.set((state) => (state.tags = db.tags.all));
+ this.set(
+ (state) =>
+ (state.tags = groupArray(
+ db.tags.all,
+ db.settings.getGroupOptions("tags")
+ ))
+ );
};
}
diff --git a/apps/web/src/stores/trash-store.js b/apps/web/src/stores/trash-store.js
index c8489a77d..8ee0e0470 100644
--- a/apps/web/src/stores/trash-store.js
+++ b/apps/web/src/stores/trash-store.js
@@ -3,12 +3,19 @@ import createStore from "../common/store";
import BaseStore from "./index";
import { store as appStore } from "./app-store";
import { store as notestore } from "./note-store";
+import { groupArray } from "notes-core/utils/grouping";
class TrashStore extends BaseStore {
trash = [];
refresh = () => {
- this.set((state) => (state.trash = db.trash.all));
+ this.set(
+ (state) =>
+ (state.trash = groupArray(
+ db.trash.all,
+ db.settings.getGroupOptions("trash")
+ ))
+ );
};
delete = (id, commit = false) => {
@@ -23,7 +30,7 @@ class TrashStore extends BaseStore {
restore = (id) => {
return db.trash.restore(id).then(() => {
- this.set((state) => (state.trash = db.trash.all));
+ this.refresh();
appStore.refreshColors();
notestore.refresh();
});
diff --git a/apps/web/src/views/home.js b/apps/web/src/views/home.js
index 5fce48509..a90b1e6f0 100644
--- a/apps/web/src/views/home.js
+++ b/apps/web/src/views/home.js
@@ -8,6 +8,7 @@ import useNavigate from "../utils/use-navigate";
function Home() {
const notes = useStore((store) => store.notes);
+ const refresh = useStore((store) => store.refresh);
const clearContext = useStore((store) => store.clearContext);
const [isLoading, setIsLoading] = useState(true);
useNavigate("home", () => {
@@ -39,6 +40,8 @@ function Home() {
return (
<ListContainer
type="home"
+ groupType="home"
+ refresh={refresh}
isLoading={isLoading}
items={notes}
placeholder={NotesPlaceholder}
diff --git a/apps/web/src/views/monographs.js b/apps/web/src/views/monographs.js
index c87142ff9..656916439 100644
--- a/apps/web/src/views/monographs.js
+++ b/apps/web/src/views/monographs.js
@@ -12,6 +12,7 @@ function Monographs() {
return (
<ListContainer
type="notes"
+ groupType="notes"
items={monographs}
placeholder={MonographsPlaceholder}
/>
diff --git a/apps/web/src/views/notebooks.js b/apps/web/src/views/notebooks.js
index 6e5ca3e69..710ac71ec 100644
--- a/apps/web/src/views/notebooks.js
+++ b/apps/web/src/views/notebooks.js
@@ -8,11 +8,14 @@ import useNavigate from "../utils/use-navigate";
function Notebooks() {
useNavigate("notebooks", () => store.refresh());
const notebooks = useStore((state) => state.notebooks);
+ const refresh = useStore((state) => state.refresh);
return (
<>
<ListContainer
type="notebooks"
+ groupType="notebooks"
+ refresh={refresh}
items={notebooks}
placeholder={NotebooksPlaceholder}
button={{
diff --git a/apps/web/src/views/notes.js b/apps/web/src/views/notes.js
index a15646291..a281ecb63 100644
--- a/apps/web/src/views/notes.js
+++ b/apps/web/src/views/notes.js
@@ -4,17 +4,23 @@ import { useStore as useNotesStore } from "../stores/note-store";
import NotesPlaceholder from "../components/placeholders/notesplacholder";
import { hashNavigate } from "../navigation";
import FavoritesPlaceholder from "../components/placeholders/favorites-placeholder";
+import { groupArray } from "notes-core/utils/grouping";
+import { db } from "../common/db";
function Notes() {
const context = useNotesStore((store) => store.context);
+ const refreshContext = useNotesStore((store) => store.refreshContext);
+ const type = context?.type === "favorite" ? "favorites" : "notes";
if (!context) return null;
return (
<ListContainer
type="notes"
+ groupType={type}
+ refresh={refreshContext}
context={{ ...context, notes: undefined }}
- items={context.notes}
+ items={groupArray(context.notes, db.settings.getGroupOptions(type))}
placeholder={
- context.type === "favorites" ? FavoritesPlaceholder : NotesPlaceholder
+ context.type === "favorite" ? FavoritesPlaceholder : NotesPlaceholder
}
button={{
content: "Make a new note",
diff --git a/apps/web/src/views/tags.js b/apps/web/src/views/tags.js
index 7fb40e310..8896e6183 100644
--- a/apps/web/src/views/tags.js
+++ b/apps/web/src/views/tags.js
@@ -7,8 +7,15 @@ import useNavigate from "../utils/use-navigate";
function Tags() {
useNavigate("tags", () => store.refresh());
const tags = useStore((store) => store.tags);
+ const refresh = useStore((store) => store.refresh);
return (
- <ListContainer type="tags" items={tags} placeholder={TagsPlaceholder} />
+ <ListContainer
+ type="tags"
+ groupType="tags"
+ refresh={refresh}
+ items={tags}
+ placeholder={TagsPlaceholder}
+ />
);
}
diff --git a/apps/web/src/views/topics.js b/apps/web/src/views/topics.js
index 12bbad9cd..b0ddf78bd 100644
--- a/apps/web/src/views/topics.js
+++ b/apps/web/src/views/topics.js
@@ -9,11 +9,14 @@ function Topics() {
(store) => store.selectedNotebookTopics
);
const selectedNotebookId = useNbStore((store) => store.selectedNotebookId);
+ const refresh = useNbStore((store) => store.setSelectedNotebook);
return (
<>
<ListContainer
type="topics"
+ groupType="topics"
+ refresh={() => refresh(selectedNotebookId)}
items={selectedNotebookTopics}
context={{ notebookId: selectedNotebookId }}
placeholder={TopicsPlaceholder}
diff --git a/apps/web/src/views/trash.js b/apps/web/src/views/trash.js
index 6058cfb86..0e4165c76 100644
--- a/apps/web/src/views/trash.js
+++ b/apps/web/src/views/trash.js
@@ -15,11 +15,14 @@ function Trash() {
store.refresh();
});
const items = useStore((store) => store.trash);
+ const refresh = useStore((store) => store.refresh);
const clearTrash = useStore((store) => store.clear);
return (
<ListContainer
type="trash"
+ groupType="trash"
+ refresh={refresh}
placeholder={TrashPlaceholder}
items={items}
button={{
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index 8b54a4d98..66565784d 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -2667,6 +2667,18 @@
"@typescript-eslint/types" "4.15.0"
eslint-visitor-keys "^2.0.0"
+"@virtuoso.dev/react-urx@^0.2.5":
+ version "0.2.6"
+ resolved "https://registry.yarnpkg.com/@virtuoso.dev/react-urx/-/react-urx-0.2.6.tgz#e1d8bc717723b2fc23d80ea4e07703dbc276448b"
+ integrity sha512-+PLQ2iWmSH/rW7WGPEf+Kkql+xygHFL43Jij5aREde/O9mE0OFFGqeetA2a6lry3LDVWzupPntvvWhdaYw0TyA==
+ dependencies:
+ "@virtuoso.dev/urx" "^0.2.6"
+
+"@virtuoso.dev/urx@^0.2.5", "@virtuoso.dev/urx@^0.2.6":
+ version "0.2.6"
+ resolved "https://registry.yarnpkg.com/@virtuoso.dev/urx/-/urx-0.2.6.tgz#0028c49e52037e673993900d32abea83262fbd53"
+ integrity sha512-EKJ0WvJgWaXIz6zKbh9Q63Bcq//p8OHXHbdz4Fy+ruhjJCyI8ADE8E5gwSqBoUchaiYlgwKrT+sX4L2h/H+hMg==
+
"@webassemblyjs/[email protected]":
version "1.9.0"
resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz"
@@ -4717,6 +4729,11 @@ dayjs@^1.10.4:
resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.10.4.tgz"
integrity sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw==
+dayjs@^1.10.6:
+ version "1.10.6"
+ resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.6.tgz#288b2aa82f2d8418a6c9d4df5898c0737ad02a63"
+ integrity sha512-AztC/IOW4L1Q41A86phW5Thhcrco3xuAA+YX/BLpLWWjRcTj5TOt/QImBLmCKlrF7u7k47arTnOyL6GnbG8Hvw==
+
[email protected], debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9:
version "2.6.9"
resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz"
@@ -8591,11 +8608,25 @@ normalize-url@^3.0.0:
resolved "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz"
integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==
+notes-core@../notes-core/:
+ version "6.8.0"
+ dependencies:
+ "@stablelib/blake2s" "^1.0.1"
+ dayjs "^1.10.6"
+ fast-sort "^2.0.1"
+ lean-he "^2.1.2"
+ no-internet "^1.5.2"
+ qclone "^1.0.4"
+ quill-delta-to-html "^0.12.0"
+ showdown "https://github.com/thecodrr/showdown"
+ spark-md5 "^3.0.1"
+
"notes-core@git+https://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:[email protected]/streetwriters/notesnook-core.git":
- version "6.7.2"
- resolved "git+https://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:[email protected]/streetwriters/notesnook-core.git#7f99956cb606b2fee80d74931c756ade0c8a5cf6"
+ version "6.8.0"
+ resolved "git+https://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:[email protected]/streetwriters/notesnook-core.git#928ed8ca7c770ec15fbf3bc7f2f398d14620ae65"
dependencies:
"@stablelib/blake2s" "^1.0.1"
+ dayjs "^1.10.6"
fast-sort "^2.0.1"
lean-he "^2.1.2"
no-internet "^1.5.2"
@@ -10354,6 +10385,15 @@ react-virtualized-auto-sizer@^1.0.4:
resolved "https://registry.npmjs.org/react-virtualized-auto-sizer/-/react-virtualized-auto-sizer-1.0.4.tgz"
integrity sha512-fdrY0ZX4Ywv0IIYPY/grQXcVQ44OLOsftl2u81coKe2Ga1wT3ps4JXaeu1JdlfjQxDI5BVsWjZQbpzmjmtI7Qw==
+react-virtuoso@^1.9.3:
+ version "1.9.3"
+ resolved "https://registry.yarnpkg.com/react-virtuoso/-/react-virtuoso-1.9.3.tgz#0ee83f777a466fcb5ef8ef0416ff59f69f7f1699"
+ integrity sha512-uij0oVlYEFSq1IJKuhCp7edR52oJr9kQjCZk4RCsL2lkNH+Yqbp+CZ8RLIIyPV652BtPyd7ijKOdI8qg0FqLXQ==
+ dependencies:
+ "@virtuoso.dev/react-urx" "^0.2.5"
+ "@virtuoso.dev/urx" "^0.2.5"
+ resize-observer-polyfill "^1.5.1"
+
react-window@^1.8.6:
version "1.8.6"
resolved "https://registry.npmjs.org/react-window/-/react-window-1.8.6.tgz"
@@ -10650,6 +10690,11 @@ requires-port@^1.0.0:
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=
+resize-observer-polyfill@^1.5.1:
+ version "1.5.1"
+ resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"
+ integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==
+
resolve-cwd@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz"