edit(doc.id)}
- className="hover:underline-offset flex cursor-pointer hover:underline"
- >
+
{/* Without mono font, dates won't be a uniform width */}
{doc.createdAt.slice(0, 10)}
-
+
edit(doc.id)}
+ >
{doc.title}
-
-
- {getName(doc.journalId)}
-
-
+
search.addToken(`in:${getName(doc.journalId)}`)}
+ >
+ in:{getName(doc.journalId)}
+
);
}
diff --git a/src/views/documents/SearchStore.ts b/src/views/documents/SearchStore.ts
index 7eb8f16..8ec6208 100644
--- a/src/views/documents/SearchStore.ts
+++ b/src/views/documents/SearchStore.ts
@@ -207,6 +207,7 @@ export class SearchStore {
@action
addToken = (searchStr: string, resetPagination = true) => {
const token = this.parser.parseToken(searchStr);
+ console.log("token:", token);
// todo: only search if the token string changes
if (token) {
diff --git a/src/views/documents/sidebar/JournalItem.tsx b/src/views/documents/sidebar/JournalItem.tsx
index 218586c..66d81b5 100644
--- a/src/views/documents/sidebar/JournalItem.tsx
+++ b/src/views/documents/sidebar/JournalItem.tsx
@@ -1,6 +1,6 @@
import * as ContextMenu from "@radix-ui/react-context-menu";
import { cn } from "@udecode/cn";
-import { Heading, Pane, toaster } from "evergreen-ui";
+import { toaster } from "evergreen-ui";
import { noop } from "lodash";
import { observer } from "mobx-react-lite";
import React, { useContext } from "react";
@@ -11,27 +11,6 @@ import { useIsMounted } from "../../../hooks/useIsMounted";
import { JournalsStoreContext } from "../../../hooks/useJournalsLoader";
import { SidebarStore } from "./store";
-/**
- * Collapse component that can be toggled open and closed.
- */
-export function Collapse(props: { defaultOpen?: boolean; children: any }) {
- const [isOpen, setIsOpen] = React.useState(
- props.defaultOpen == null ? false : props.defaultOpen,
- );
-
- const Icon = isOpen ? Icons.chevronDown : Icons.chevronRight;
-
- return (
-
- setIsOpen(!isOpen)} cursor="pointer">
- Archived Journals
-
-
- {isOpen && props.children}
-
- );
-}
-
export function JournalCreateForm({ done }: { done: () => any }) {
const [journal, _] = React.useState<{ name: string }>({
name: "My new journal",
diff --git a/src/views/documents/sidebar/Sidebar.tsx b/src/views/documents/sidebar/Sidebar.tsx
index 4198ae2..1b77bee 100644
--- a/src/views/documents/sidebar/Sidebar.tsx
+++ b/src/views/documents/sidebar/Sidebar.tsx
@@ -1,9 +1,10 @@
import { Root as VisuallyHidden } from "@radix-ui/react-visually-hidden";
import React from "react";
-import { Card, Heading, IconButton, Pane, PlusIcon } from "evergreen-ui";
+import { IconButton, PlusIcon } from "evergreen-ui";
import { observer } from "mobx-react-lite";
+import { Collapse } from "../../../components/Collapse";
import {
Sheet,
SheetContent,
@@ -12,7 +13,7 @@ import {
SheetTitle,
} from "../../../components/Sidesheet";
import { SearchStore } from "../SearchStore";
-import { Collapse, JournalCreateForm, JournalItem } from "./JournalItem";
+import { JournalCreateForm, JournalItem } from "./JournalItem";
import { TagsList } from "./TagsList";
import { SidebarStore, useSidebarStore } from "./store";
@@ -60,27 +61,22 @@ export default observer(function JournalSelectionSidebar(props: SidebarProps) {
const InnerContent = observer(({ store }: { store: SidebarStore }) => {
return (
- <>
- {" "}
-
-
-
- Active Journals{" "}
+
+
+
+
+ Active Journals
Add Journal
-
-
+
+
{store.adding && (
-
@@ -102,8 +98,10 @@ const InnerContent = observer(({ store }: { store: SidebarStore }) => {
);
})}
+
-
+
+
{store.journalStore.archived.map((j) => {
return (
@@ -120,8 +118,8 @@ const InnerContent = observer(({ store }: { store: SidebarStore }) => {
})}
-
+
- >
+
);
});
diff --git a/src/views/documents/sidebar/TagsList.tsx b/src/views/documents/sidebar/TagsList.tsx
index 95e7729..2fa52e6 100644
--- a/src/views/documents/sidebar/TagsList.tsx
+++ b/src/views/documents/sidebar/TagsList.tsx
@@ -1,12 +1,6 @@
-import {
- Card,
- FolderCloseIcon,
- Heading,
- ListItem,
- UnorderedList,
-} from "evergreen-ui";
import React from "react";
+import { ClickableTag as Tag } from "../../../components/TagInput";
import { useTags } from "../../../hooks/useTags";
/**
@@ -24,20 +18,20 @@ export function TagsList(props: { search: (tag: string) => boolean }) {
return "error loading tags";
}
- const tagItems = tags.map((t) => {
- return (
-
- props.search(t)}>
- {t}
-
-
- );
- });
-
return (
-
- Tags
- {tagItems}
-
+
+
+ Tags
+
+
+ {tags.map((t) => {
+ return (
+ props.search(t)}>
+ #{t}
+
+ );
+ })}
+
+
);
}
diff --git a/src/views/edit/FrontMatter.tsx b/src/views/edit/FrontMatter.tsx
index 64c7478..25b24ed 100644
--- a/src/views/edit/FrontMatter.tsx
+++ b/src/views/edit/FrontMatter.tsx
@@ -143,6 +143,7 @@ const FrontMatter = observer(
onRemove={onRemoveTag}
placeholder="Add tags"
ghost={true}
+ prefixHash={true}
/>