generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render view based on daily note (#123)
* feat: when opening a daily note new setting to enable this feature refactor reduceTimeSpans function to allow other dates than today debounce rendering for some Obsidian events * chore: update core-plugins.json and adjust npm script generateNotes * chore: extract more logic from reduceTimeSpans to simplify * chore: simplify Main.tsx * chore: bumb version
- Loading branch information
Showing
9 changed files
with
132 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
import TimeSpan from "./TimeSpan"; | ||
import { RenderedTimeSpan } from "../constants"; | ||
import useContext from "../hooks/useContext"; | ||
import { Moment } from "moment"; | ||
|
||
interface Props { | ||
timeSpans: RenderedTimeSpan[]; | ||
startDate?: Moment; | ||
} | ||
|
||
const Main = ({ timeSpans }: Props) => ( | ||
<div id="journal-review"> | ||
<h2>On this day...</h2> | ||
const Main = ({ timeSpans, startDate }: Props) => { | ||
const { settings } = useContext(); | ||
|
||
<ul className="list"> | ||
{timeSpans.map(({ title, notes }) => ( | ||
<TimeSpan key={title} title={title} notes={notes} wrapper={<li />} /> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
return ( | ||
<div id="journal-review"> | ||
{settings.renderOnFileSwitch && startDate ? ( | ||
<h2>On {startDate.format("ll")}...</h2> | ||
) : ( | ||
<h2>On today...</h2> | ||
)} | ||
|
||
<ul className="list"> | ||
{timeSpans.map(({ title, notes }) => ( | ||
<TimeSpan key={title} title={title} notes={notes} wrapper={<li />} /> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
[ | ||
"file-explorer", | ||
"global-search", | ||
"switcher", | ||
"graph", | ||
"backlink", | ||
"canvas", | ||
"outgoing-link", | ||
"tag-pane", | ||
"page-preview", | ||
"daily-notes", | ||
"templates", | ||
"note-composer", | ||
"command-palette", | ||
"editor-status", | ||
"bookmarks", | ||
"outline", | ||
"word-count", | ||
"file-recovery" | ||
] | ||
{ | ||
"file-explorer": true, | ||
"global-search": true, | ||
"switcher": true, | ||
"graph": true, | ||
"backlink": true, | ||
"canvas": true, | ||
"outgoing-link": true, | ||
"tag-pane": true, | ||
"properties": false, | ||
"page-preview": true, | ||
"daily-notes": true, | ||
"templates": true, | ||
"note-composer": true, | ||
"command-palette": true, | ||
"slash-command": false, | ||
"editor-status": true, | ||
"bookmarks": true, | ||
"markdown-importer": false, | ||
"zk-prefixer": false, | ||
"random-note": false, | ||
"outline": true, | ||
"word-count": true, | ||
"slides": false, | ||
"audio-recorder": false, | ||
"workspaces": false, | ||
"file-recovery": true, | ||
"publish": false, | ||
"sync": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters