Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Daily Notes #66

Closed
3 of 4 tasks
tangjeff0 opened this issue May 15, 2020 · 11 comments
Closed
3 of 4 tasks

Daily Notes #66

tangjeff0 opened this issue May 15, 2020 · 11 comments

Comments

@tangjeff0
Copy link
Collaborator

tangjeff0 commented May 15, 2020

Tasks

Original Post

Click to open

When a user open their Roam, they should automatically generate a notes page for the current
date. User should be able to scroll down to previous days.

Note: these Daily Notes pages are different from other pages in that their titles are not allowed to be changed. Attempt to do so leads to a warning.

Warning

Screen Shot 2020-05-15 at 7 44 29 PM

Screenshot

image

jelmerderonde pushed a commit to jelmerderonde/athens that referenced this issue May 17, 2020
- TODO: use the event when updating title is supported in the ui
- TODO: handle edge cases athensresearch#61 and athensresearch#66
jelmerderonde pushed a commit to jelmerderonde/athens that referenced this issue May 18, 2020
- Extract patterns from page.cljs and adds some tests
- TODO: use the event when updating title is supported in the ui
- TODO: handle edge cases athensresearch#61 and athensresearch#66
jeroenvandijk added a commit that referenced this issue May 18, 2020
…rged with master) (#77)

* feat: add event :node/rename that also updates referencing blocks

- Extract patterns from page.cljs and adds some tests
- TODO: use the event when updating title is supported in the ui
- TODO: handle edge cases #61 and #66

* Reapply formatting

Co-authored-by: Jelmer de Ronde <jelmer.deronde@surfnet.nl>
@tangjeff0 tangjeff0 changed the title Create a Daily Notes page Daily Notes May 27, 2020
@jeroenvandijk
Copy link
Contributor

jeroenvandijk commented May 30, 2020

TASKS

  • Core work: scrolling down and opening a new page (add onscroll event listener)
  • Add warning when title of date page is changed (possibly a regexp check on the page title is enough for this. Maybe no need to check if it is a special page)
  • Bonus: when you are in the Daily Notes view and time passes into the next day (in your timezone), a new day should be added. Could be done by triggering a re-render in X seconds via (setTimeout ...)
  • Bonus: to keep the app performant endless scrolling down should also clean up day views on top. With scrollup event these views would have to be added again

@Bardia95
Copy link
Contributor

Bardia95 commented Jun 8, 2020

Working on it with @pinned5th as part of ClojureFam, looking to get a working version by end of week!

@tangjeff0
Copy link
Collaborator Author

@Bardia95 that's awesome — glad you are setting a deliverable for yourself! I'm personally more curious about how you two are mapping these scopes, and what scopes will be discovered and refactored over time. Please update this issue at various checkpoints so you can teach the rest of us :)

@Bardia95
Copy link
Contributor

Bardia95 commented Jun 9, 2020

@tangjeff0 right now, the path is uncharted, my plan for today is to experiment with how we could accomplish this feature and update with any findings, and then once we've scoped out a bit will update with what we're each working on. We have planned a pair programming session once we've scoped out more granularly

@tangjeff0
Copy link
Collaborator Author

tangjeff0 commented Jun 10, 2020

Sounds good, you may want to look into date libraries. We have Google Closure already available or cljs-time. Please tell us the tradeoffs between these two, other libs, or if we should roll our own, etc.


I think page creation has more discovered tasks.

Jeroen touches upon this here, but it assumes Athens is already open:

Bonus: when you are in the Daily Notes view and time passes into the next day (in your timezone), a new day should be added

What happens when Athens is first opened? What happens when a user doesn't log into Athens for a few days — are those dates not created? What happens when a user creates a date in the future, and then that date arrives? Roam has their own behavior for these cases, but I'm not certain these implementations are best or how we want to do it.

@Bardia95
Copy link
Contributor

Bardia95 commented Jun 10, 2020

Sounds good, you may want to look into date libraries. We have Google Closure already available or cljs-time. Please tell us the tradeoffs between these two, other libs, or if we should roll our own, etc.

Here are some notes I took:

  • CLJS
    • cljs-time
      • Imitates the API of the clj-time library
        • Not a drop-in replacement though
      • Leans on Google Closure goog.date library for basic date/time functionality
      • Date objects are mutable
        • But operations that alter a date object return a copy
        • Looking to move towards immutability
      • Limited timezone functionality (but that is a JS issue)
      • Good test coverage
      • Good for keeping a consistent API across client and server
        • But equality in goog.date and JS dates are not the same as in clj-time though, so you can use their own = operator
      • Can also serialize
      • Easy library to learn
  • CLJS / CLJ
    • juxt/tick
      • Replacement for clj-time
      • Runs on JVM and JS runtime
      • Alpha but ready to use
        • Expect minor changes
        • Not heavily documented
      • Built on top of cljc.java-time
        • Provides a single ns
        • Batteries-included
        • Power tools (interval algebra and scheduling)
  • JS
    • Luxon
      • Built by the guy who maintained moment.js but with immutable dates
      • Better time zone and API names according to author
      • Use directly or create wrappers
    • goog.date
      • Already included in the Closure library
      • Simplest solution
      • Use directly or create wrappers
      • Probably will require utility functions
    • date-fns
      • Uses existing native type and does not extend core objects
      • Functional programming submodule for composition
      • Pure functions
      • Immutable by default
    • moment.js
      • Defacto JS library
      • OOP APIs
      • Most powerful
      • Big bundle
    • day.js
      • Tiny replacement for moment.js
        • Same API

My first choice was cljs-time as I'm already familiar with cli-time, but I'm a little worried that the dates are mutable even though the functions return copies. Not sure what could happen but seems to go against Clojure's paradigm. The other thing that troubles me is that it mimics clj-time but is not compatible with the backend. I think juxt/tick could be a better solution, this is what the author wrote about the difference between using tick and using cljs-time and clj-time for a full-stack app:

Most Clojure applications use clj-time which is based on Joda Time. However, cljs-time objects are mutable goog.date objects which in turn wrap JavaScript Date objects.

This works OK as a proxy for Instant, but is not a great foundation for local dates etc.

The author of cljs-time, Andrew McVeigh, has said he would ideally move cljs-time off goog.date but is unlikely to do so at this point. For one thing, there could be more than a few current users relying on the JS Date nature of the cljs-time objects.

Taking a fresh look at the date/time landscape, we now have java.time (JSR-310) and implementations in both Java and Javascript and so it is possible to create tick, which combines the excellent JSR-310 with an expressive, cross-platform Clojure(Script) API.

For some use cases it is possible to write cross-platform code with clj/s-time, conditionally requiring clj-time or cljs-time in a cljc file. In our experience though, the fact that cljs-time doesn’t have complete fidelity with clj-time often comes to be a problem.

@Bardia95
Copy link
Contributor

It seems like juxt/tick is probably our best bet, what do you think? @jeroenvandijk @tangjeff0

@tangjeff0
Copy link
Collaborator Author

tangjeff0 commented Jun 10, 2020

@Bardia95 love the research and see no reason why we can't move forward with your recommendation. Go for it!

This is a tangential reason, but juxt is also behind OpenCrux. Temporality is important to them so I believe this library will only get better over time! #9 (comment)

@tangjeff0 tangjeff0 mentioned this issue Jun 14, 2020
2 tasks
@tangjeff0
Copy link
Collaborator Author

Working on it with @pinned5th as part of ClojureFam, looking to get a working version by end of week!

How are scopes progressing @Bardia95 ?

@Bardia95
Copy link
Contributor

Sorry I've been unexpectedly swamped with work from my job. But I'm focussing on the issue all day tomorrow and will have some commits to look over. I've made some notes of things that need to be considered in the mean time:

  • Create new page at 12:00 am (localized) (need to get location / timezone) every day with title being the date
    • Make sure you can't edit the title of this page
      • Show warning
    • Everything else is like a normal page
  • Display pages on Daily Notes page
    • Only show days from current day and before (no future dates)
  • Have the Daily Notes page update at 12:00 am when the new page is created
  • What happens when Athens is first opened?
    • Creates new page with the day
  • What happens when a user doesn't log into Athens for a few days — are those dates not created?
    • No, the daily notes is only created when on the app
      • On connect
        • Query db to see if page exists of today
          • (maybe make this every few seconds)
            • If so just update
            • If not create new page and update
  • What happens when a user creates a date in the future, and then that date arrives?
    • Covered in above

@tangjeff0 tangjeff0 mentioned this issue Jul 4, 2020
7 tasks
@Roc-kit
Copy link

Roc-kit commented Jun 3, 2021

Hi, Where's the calendar button? I can't find it 😂

korlaism pushed a commit to korlaism/athens that referenced this issue Jul 19, 2021
…rged with master) (athensresearch#77)

* feat: add event :node/rename that also updates referencing blocks

- Extract patterns from page.cljs and adds some tests
- TODO: use the event when updating title is supported in the ui
- TODO: handle edge cases athensresearch#61 and athensresearch#66

* Reapply formatting

Co-authored-by: Jelmer de Ronde <jelmer.deronde@surfnet.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants