GithubHelp home page GithubHelp logo

isosphere / logseq-journals-nextprev Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 3.02 MB

Provides buttons to jump to the next or previous journal entry

License: MIT License

HTML 3.76% JavaScript 26.21% Vue 61.94% CSS 8.08%
logseq logseq-plugin

logseq-journals-nextprev's Introduction

Logseq journals next/prev

A plugin that provides a "next" and "previous" button to the toolbar to switch to the next or previous journal entry that already exists. Dates that do not already have a journal page are skipped, by design.

Installation

It is recommended that you use the built-in Logseq plugin marketplace.

  1. Push the "..." menu in the top-right of an open Logseq window
  2. Click Plugins
  3. Click Marketplace
  4. Search for "Journals Next/Prev"
  5. Click Install

Once the plugin is installed, you will have to manually enable the toolbar buttons.

  1. Press the puzzle piece icon on the Logseq toolbar, near the top right of an open Logseq window
  2. Find and "pin" "open-a-next-day" and "open-d-next-day" to enable them in your toolbar.

The naming of the toolbar buttons was designed to put them on either side of the "open-calendar" button from the Journals calendar plugin by xyhp915. Toolbar buttons are arranged alphabetically.

Demo

demo

Licence

MIT

logseq-journals-nextprev's People

Contributors

abhinav avatar huaouo avatar isosphere avatar mbudde avatar sethyuan avatar vitor12xx avatar xxchan avatar xyhp915 avatar yu000jp avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

yu000jp

logseq-journals-nextprev's Issues

Doesn't work with journals

Currently, It only works on single page. It is possible to make the back button function assuming today's date, on journals. I can make a pull request.

An expensive query is run on every click

Running these queries fresh on every click is unnecessarily expensive:

async _getNewerJournals(currentJournalDate) {
let ret
try {
ret = await logseq.DB.datascriptQuery(`
[:find (pull ?p [*])
:where
[?b :block/page ?p]
[?p :block/journal? true]
[?p :block/journal-day ?d]
[(> ?d ${currentJournalDate})]]
`)
} catch (e) {
console.error(e)
}
return this._cleanJournalQueryReturn(ret)
},
async _getOlderJournals(currentJournalDate) {
let ret
try {
ret = await logseq.DB.datascriptQuery(`
[:find (pull ?p [*])
:where
[?b :block/page ?p]
[?p :block/journal? true]
[?p :block/journal-day ?d]
[(< ?d ${currentJournalDate})]]
`)
} catch (e) {
console.error(e)
}
return this._cleanJournalQueryReturn(ret)
},

We need only to cache the result and, if the appropriate hooks are available, hook into new journal creation or existing journal deletion to update the cache.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.