Skip to content

Commit

Permalink
feat: ✨ Supports edit journal task in calendar view
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenull committed Mar 26, 2022
1 parent 8c466bf commit a9a5d2d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { sidebar } from './configs'

export default defineUserConfig<DefaultThemeOptions>({
head:[
['link', { rel: 'icon', href: '/images/favicon.ico' }],
['link', { rel: 'icon', href: './images/favicon.ico' }],
],
base: '/logseq-plugin-agenda/',
locales: {
Expand Down
36 changes: 35 additions & 1 deletion docs/other/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,38 @@ Date Formatter:
![](../../screenshots//otherQuery2.png)

Calendar:
![](../../screenshots//otherQuery3.png)
![](../../screenshots//otherQuery3.png)

## Exclude specified page from default journal calendar

Defaut journal calendar will search all pages, but you can exclude some pages by setting query script.

If you want to exclude a page named `your project`, you can add the following code to your query script:
```clojure
[?page :block/name ?pname]
[?block :block/page ?page]
(not [(contains? #{"your project"} ?pname)])
```

The original query script of query1 is as follows:
```clojure
[:find (pull ?block [*])
:where
[?block :block/marker ?marker]
[(missing? $ ?block :block/deadline)]
(not [(missing? $ ?block :block/scheduled)])
[(contains? #{"TODO" "DOING" "NOW" "LATER" "WAITING" "DONE"} ?marker)]]
```

The script after the modification is as follows:
```clojure{6-8}
[:find (pull ?block [*])
:where
[?block :block/marker ?marker]
[(missing? $ ?block :block/deadline)]
(not [(missing? $ ?block :block/scheduled)])
[?page :block/name ?pname]
[?block :block/page ?page]
(not [(contains? #{"your project"} ?pname)])
[(contains? #{"TODO" "DOING" "NOW" "LATER" "WAITING" "DONE"} ?marker)]]
```
6 changes: 5 additions & 1 deletion docs/zh/other/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ Date Formatter:

## 从默认 journal 日历中排除指定页面

将以下代码添加到 query 1 2 4 的 script 中:
默认 journal 日历会在所有笔记中查询符合条件的任务, 但是可以通过配置 query script 排除指定页面.

假如我们希望 journal 日历不显示 `your project` 页面的任务.

只需要将以下代码添加到 query 1 2 4 的 script 中:
```clojure
[?page :block/name ?pname]
[?block :block/page ?page]
Expand Down
2 changes: 1 addition & 1 deletion src/components/ModifySchedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const ModifySchedule: React.FC<{
if (calendarId?.value === 'journal') {
console.log('[faiz:] === values', values)
const journalName = format(start.valueOf(), preferredDateFormat)
const newPage = await logseq.Editor.createPage(journalName, { journal: true })
const newPage = await logseq.Editor.createPage(journalName, {}, { journal: true })
if (newPage) newCalendarId = newPage.originalName
console.log('[faiz:] === journalName', journalName, newPage)
// const newPage = await logseq.Editor.createPage()
Expand Down
15 changes: 15 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,22 @@ html, body {
box-sizing: border-box;
vertical-align: middle;
}
/* checked border */
.check-box.checked::before {
content: "";
box-sizing: border-box;
display: inline-block;
width: 8px;
height: 11px;
border: 4px solid rgba(4, 85, 62, 0.5);
border-top: 0;
border-left: 0;
position: absolute;
left: 4px;
top: 7px;
transform: translateY(-50%) rotate(45deg);
}
.check-box.checked::after {
content: "";
box-sizing: border-box;
display: inline-block;
Expand Down
1 change: 1 addition & 0 deletions src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const DEFAULT_SETTINGS: ISettingsForm = {
[:find (pull
?block
[:block/uuid
:db/id
:block/parent
:block/left
:block/collapsed?
Expand Down

0 comments on commit a9a5d2d

Please sign in to comment.