1
0
Tienson Qin 4 жил өмнө
parent
commit
cd8b8188e2

+ 7 - 3
src/main/frontend/components/block.cljs

@@ -2068,9 +2068,13 @@
    :should-update (fn [old-state new-state]
                     (let [compare-keys [:block/uuid :block/properties
                                         :block/parent :block/left
-                                        :block/children :block/content]]
-                      (not= (select-keys (second (:rum/args old-state)) compare-keys)
-                            (select-keys (second (:rum/args new-state)) compare-keys))))}
+                                        :block/children :block/content]
+                          config-compare-keys [:show-cloze?]]
+                      (or
+                       (not= (select-keys (second (:rum/args old-state)) compare-keys)
+                             (select-keys (second (:rum/args new-state)) compare-keys))
+                       (not= (select-keys (first (:rum/args old-state)) config-compare-keys)
+                             (select-keys (first (:rum/args new-state)) config-compare-keys)))))}
   [state config {:block/keys [uuid title body meta content page format repo children pre-block? top? properties refs path-refs heading-level level type idx] :as block}]
   (let [blocks-container-id (:blocks-container-id config)
         config (update config :block merge block)

+ 23 - 22
src/main/frontend/extensions/srs.cljs

@@ -414,7 +414,7 @@
             root-block-id (:block/uuid root-block)]
         [:div.ls-card
          {:class (when (or preview? modal?)
-                   (util/hiccup->class ".flex.flex-col.resize.overflow-y-auto.px-4"))}
+                   (util/hiccup->class ".flex.flex-col.resize.overflow-y-auto"))}
          (let [repo (state/get-current-repo)]
            [:div.my-2.opacity-70.hover:opacity-100
             (component-block/block-parents {} repo root-block-id
@@ -435,38 +435,39 @@
                             3 [:span "Show clozes " (ui/keyboard-shortcut [:s])])
                           :id "card-answers"
                           :class "mr-2"
-                          :large? true
-                          :on-click #(reset! phase next-phase)))
+                 :on-click #(reset! phase next-phase)))
 
              (when (and (> (count cards) 1) preview?)
                (ui/button [:span "Next " (ui/keyboard-shortcut [:n])]
                           :id "card-next"
                           :class "mr-2"
-                          :large? true
-                          :on-click #(skip-card card card-index cards phase review-records cb)))
+                 :on-click #(skip-card card card-index cards phase review-records cb)))
 
              (when (and (not preview?) (= 1 next-phase))
                (let [interval-days-score-3 (get (get-next-interval card 3) card-last-interval-property)
                      interval-days-score-4 (get (get-next-interval card 5) card-last-interval-property)
                      interval-days-score-5 (get (get-next-interval card 5) card-last-interval-property)]
                  [:div.flex.flex-row.justify-between
-                  (ui/button [:span "Forgotten " (ui/keyboard-shortcut [:f])]
-                             :id "card-forgotten"
-                             :large? true
-                             :on-click (fn []
-                                         (score-and-next-card 1 card card-index cards phase review-records cb)
-                                         (let [tomorrow (tc/to-string (t/plus (t/today) (t/days 1)))]
-                                           (editor-handler/set-block-property! root-block-id card-next-schedule-property tomorrow))))
-
-                  (ui/button [:span "Remembered " (ui/keyboard-shortcut [:r])]
-                             :id "card-remembered"
-                             :large? true
-                             :on-click #(score-and-next-card 5 card card-index cards phase review-records cb))
-
-                  (ui/button [:span "Took a while to recall " (ui/keyboard-shortcut [:t])]
-                             :id "card-recall"
-                             :large? true
-                             :on-click #(score-and-next-card 3 card card-index cards phase review-records cb))]))]
+                  (ui/button (if (util/mobile?)
+                               "Forgotten"
+                               [:span "Forgotten " (ui/keyboard-shortcut [:f])])
+                    :id "card-forgotten"
+                    :on-click (fn []
+                                (score-and-next-card 1 card card-index cards phase review-records cb)
+                                (let [tomorrow (tc/to-string (t/plus (t/today) (t/days 1)))]
+                                  (editor-handler/set-block-property! root-block-id card-next-schedule-property tomorrow))))
+
+                  (ui/button (if (util/mobile?)
+                                 "Remembered"
+                                 [:span "Remembered " (ui/keyboard-shortcut [:r])])
+                    :id "card-remembered"
+                    :on-click #(score-and-next-card 5 card card-index cards phase review-records cb))
+
+                  (ui/button (if (util/mobile?)
+                               "Hard"
+                               [:span "Took a while to recall " (ui/keyboard-shortcut [:t])])
+                    :id "card-recall"
+                    :on-click #(score-and-next-card 3 card card-index cards phase review-records cb))]))]
 
             (when preview?
               (ui/tippy {:html [:div.text-sm

+ 2 - 2
src/main/frontend/ui.cljs

@@ -351,12 +351,12 @@
   "Render an infinite list."
   [state list-element-id body {:keys [on-load has-more on-top-reached]}]
   (rum/with-context [[t] i18n/*tongue-context*]
-    (rum/fragment
+    [:div
      body
      (when has-more
        [:a.fade-link.text-link.font-bold.text-4xl
         {:on-click on-load}
-        (t :page/earlier)]))))
+        (t :page/earlier)])]))
 
 (rum/defcs auto-complete <
   (rum/local 0 ::current-idx)