phildenhoff / logseq-slipbox

Write notes on mobile, save them to Logseq later.
MIT License
9 stars 0 forks source link

Note entry time is not respected when inserted into logseq #5

Open isosphere opened 2 months ago

isosphere commented 2 months ago

Notes are considered to be simple strings: https://github.com/phildenhoff/logseq-slipbox/blob/0c1ab68867604219df1f3ec9caa843fb538a44be/apps/plugin/src/App.svelte#L39

... which means they have no datetime metadata associated with them. If a note is taken today and imported a week from now, that note will exist on the user's current "today" page which will lose valuable context.

phildenhoff commented 2 months ago

Well, I do like adding my notes to my current day. That way you can see all the notes you just imported. We could change that to (optionally) include a reference to the date it was created, either as a link or a property. But having built Logseq plugins in the past, properties are iffy and including it in the text probably means adding template support (which I don't think I'm interested in adding atm).

What do you think? Would an option to either "Add all imported notes to Today" or "Add all imported notes to the page for the day they were created" work? (E.g. if the note is from 10 April 2024, it is added to [[10 April 2024]])

isosphere commented 2 months ago

I would implement it in the latter way you suggest, not with properties or links. I would iterate over the notes, get a reference to the journal page, add the note, etc. We'd need some handling to determine the date format the user is using to get the right page, but we have example code for that:

https://github.com/logseq/plugins/issues/8#issuecomment-1566509582

If I'm greedy, I'd want timestamps too. I use the interstitial notes plugin which makes it easy to dump in the current time in HH:MM format, and since the slipbox could easily have that information I'd like it to include it. It's free extra context for the note - for example if I input into the slipbox that my dog is itching a lot, now I have the time when I noticed it and I don't have to worry about manually taking note of that.

This particular issue is important to me, and I'm happy to work on a PR for it if it would be welcome.

phildenhoff commented 2 months ago

Hmmmm yeah if you're wanting timestamps as well, that's a bit more tricky. Everyone has their own favourite formats for dates and times. If I'm honest, Slipbox is solving my needs right now, and that's why I built it. I don't know if I want to add more features to it.

That said, I'm open to reviewing a PR (or an approach, even if you just find the things that need to be changed and outline how to change them). If it's not too complicated, we can add it in. If it is too much for me, well, you'll be most of the way to forking slipbox into what you want!

A couple notes on the approach:

Let me know if you attempt this and get stuck anywhere. It's a bit of a rough codebase!