Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 48 additions & 8 deletions compact.cirru
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

{} (:package |app)
{} (:about "|file is generated - never edit directly; learn cr edit/tree workflows before changing") (:package |app)
:configs $ {} (:init-fn |app.client/main!) (:reload-fn |app.client/reload!) (:version |0.0.1)
:modules $ [] |respo.calcit/ |lilac/ |recollect/ |memof/ |respo-ui.calcit/ |ws-edn.calcit/ |cumulo-util.calcit/ |respo-message.calcit/ |cumulo-reel.calcit/ |respo-feather.calcit/ |alerts.calcit/
:entries $ {}
Expand Down Expand Up @@ -276,10 +276,18 @@
{} $ :class-name css/row-middle
<> "\"Short review" $ {} (:font-size 20) (:font-family ui/font-fancy)
:color $ hsl 0 0 80
=< 20 nil
div
{} $ :class-name css/row-middle
when
and (blank? (:food diary)) (blank? (:pains diary))
button $ {} (:class-name css/button) (:inner-text "|Like last day")
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The button text 'Like last day' is ambiguous. Consider renaming to 'Copy from yesterday' or 'Reuse yesterday's entry' to make the action clearer to users.

Suggested change
button $ {} (:class-name css/button) (:inner-text "|Like last day")
button $ {} (:class-name css/button) (:inner-text "|Copy from yesterday")

Copilot uses AI. Check for mistakes.
:style $ {} (:margin-left 16)
:on-click $ fn (e d!)
d! :diary/copy-yesterday $ {} (:date-info date-info)
when
not= (:text diary) (:text state)
button $ {} (:class-name css/button-primary) (:inner-text "\"Save")
:style $ {} (:margin-left 16)
:on-click $ fn (e d!)
when
not $ blank? (:text state)
Expand All @@ -292,12 +300,13 @@
lost-copy "\"diary-lost-copy"
js/localStorage.setItem lost-copy $ :text state
js/console.info "\"Latest diary saved to" $ to-lispy-string lost-copy
when
not= (:text diary) (:text state)
a
{} (:class-name css/link)
:on-click $ fn (e d!) (d! cursor nil)
<> "\"Reset"
when
not= (:text diary) (:text state)
a
{} (:class-name css/link)
:style $ {} (:margin-left 16)
:on-click $ fn (e d!) (d! cursor nil)
<> "\"Reset"
textarea $ {}
:value $ :text state
:placeholder "\"Some diary"
Expand Down Expand Up @@ -1339,6 +1348,7 @@
(:router/change op-data) (router/change db op-data sid op-id op-time)
(:diary/add-one op-data) (diary/add-one db op-data sid op-id op-time)
(:diary/change op-data) (diary/change db op-data sid op-id op-time)
(:diary/copy-yesterday op-data) (diary/copy-yesterday db op-data sid op-id op-time)
(:today op-data) (diary/set-today db op-data sid op-id op-time)
_ $ do (eprintln "|Unknown op:" op) db
:examples $ []
Expand Down Expand Up @@ -1377,13 +1387,43 @@
assoc (:field op-data) (:data op-data)
assoc :time op-time
:examples $ []
|copy-yesterday $ %{} :CodeEntry (:doc |)
:code $ quote
defn copy-yesterday (db op-data sid op-id op-time)
let
user-id $ get-in db ([] :sessions sid :user-id)
date-info $ :date-info op-data
today $ format-to-date date-info
yesterday-info $ let
year $ :year date-info
month $ :month date-info
day $ :day date-info
if (> day 1)
assoc date-info :day $ dec day
if (> month 1)
let
prev-month $ dec month
days $ app.util/get-days-by year prev-month
assoc date-info :month prev-month :day days
{}
:year $ dec year
:month 12
:day 31
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded 31 days for December of the previous year will fail for leap year February transitions. When going from January 1st to December 31st of the previous year, if that year's February was a leap year, the logic should calculate days using get-days-by. Consider using app.util/get-days-by (dec year) 12 instead of hardcoding 31.

Suggested change
:day 31
:day $ app.util/get-days-by year 12

Copilot uses AI. Check for mistakes.
yesterday $ format-to-date yesterday-info
yesterday-diary $ get-in db ([] :users user-id :diaries yesterday)
if (some? yesterday-diary)
assoc-in db ([] :users user-id :diaries today)
merge yesterday-diary $ {} (:date today) (:time op-time)
db
:examples $ []
|set-today $ %{} :CodeEntry (:doc |)
:code $ quote
defn set-today (db op-data sid op-id op-time) (assoc db :today op-data)
:examples $ []
:ns $ %{} :CodeEntry (:doc |)
:code $ quote
ns app.updater.diary $ :require (app.schema :as schema)
app.util :refer $ format-to-date
:examples $ []
|app.updater.router $ %{} :FileEntry
:defs $ {}
Expand Down
10 changes: 5 additions & 5 deletions deps.cirru
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

{} (:calcit-version |0.10.4)
{} (:calcit-version |0.10.9)
:dependencies $ {} (|Cumulo/cumulo-reel.calcit |main)
|Cumulo/cumulo-util.calcit |main
|Respo/alerts.calcit |main
|Respo/alerts.calcit |0.10.4
|Respo/respo-feather.calcit |main
|Respo/respo-message.calcit |main
|Respo/respo-message.calcit |0.0.9
|Respo/respo-ui.calcit |0.6.3
|Respo/respo.calcit |0.16.22
|Respo/respo.calcit |0.16.24
|calcit-lang/calcit-wss |0.2.6
|calcit-lang/calcit.std |main
|calcit-lang/calcit.std |0.2.6
|calcit-lang/lilac |main
|calcit-lang/memof |0.0.17
|calcit-lang/recollect |0.0.17
Expand Down
Loading