浏览代码

enhance(editor): add a warning to notice users to not remove page's title

Tienson Qin 4 年之前
父节点
当前提交
bca7ca49ed
共有 2 个文件被更改,包括 21 次插入10 次删除
  1. 8 1
      src/main/frontend/components/file.cljs
  2. 13 9
      src/main/frontend/components/svg.cljs

+ 8 - 1
src/main/frontend/components/file.cljs

@@ -15,8 +15,10 @@
             [frontend.date :as date]
             [cljs-time.coerce :as tc]
             [cljs-time.core :as t]
+            [frontend.ui :as ui]
             [frontend.context.i18n :as i18n]
-            [reitit.frontend.easy :as rfe]))
+            [reitit.frontend.easy :as rfe]
+            [frontend.components.svg :as svg]))
 
 (defn- get-path
   [state]
@@ -89,6 +91,11 @@
                                                    {:page page}))))}
            page]])
 
+       [:p.text-sm.ml-1.mb-4
+        (svg/warning {:style {:width "1em"
+                              :display "inline-block"}})
+        [:span.ml-1 "Please don't remove the page's title property (you can still modify it)."]]
+
        (when (and config? (state/logged?))
          [:a.mb-8.block {:on-click (fn [_e] (project/sync-project-settings!))}
           (tongue :project/sync-settings)])

+ 13 - 9
src/main/frontend/components/svg.cljs

@@ -228,15 +228,19 @@
     {:d
      "M216 23.86c0-23.8-30.65-32.77-44.15-13.04C48 191.85 224 200 224 288c0 35.63-29.11 64.46-64.85 63.99-35.17-.45-63.15-29.77-63.15-64.94v-85.51c0-21.7-26.47-32.23-41.43-16.5C27.8 213.16 0 261.33 0 320c0 105.87 86.13 192 192 192s192-86.13 192-192c0-170.29-168-193-168-296.14z"}]])
 
-(rum/defc warning
-  []
-  [:svg.h-8.w-8.svg-shadow.warning
-   {:view-box "0 0 576 512"
-    :fill "currentColor"
-    :color "#bf6900"}
-   [:path
-    {:d
-     "M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"}]])
+(defn warning
+  ([]
+   (warning nil))
+  ([opts]
+   [:svg.h-8.w-8.svg-shadow.warning
+    (merge
+     {:view-box "0 0 576 512"
+      :fill "currentColor"
+      :color "#bf6900"}
+     opts)
+    [:path
+     {:d
+      "M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"}]]))
 
 (rum/defc caret-down
   []