-
Notifications
You must be signed in to change notification settings - Fork 0
upgrade deps; reuse day from last day #43
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 $ {} | ||||||
|
|
@@ -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") | ||||||
| :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) | ||||||
|
|
@@ -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" | ||||||
|
|
@@ -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 $ [] | ||||||
|
|
@@ -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 | ||||||
|
||||||
| :day 31 | |
| :day $ app.util/get-days-by year 12 |
There was a problem hiding this comment.
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.