enhance: page history support reverting back

This commit is contained in:
Tienson Qin
2021-09-06 11:49:58 +08:00
parent 7273112a00
commit eec677873b
3 changed files with 20 additions and 5 deletions

View File

@@ -3,7 +3,9 @@
[frontend.ui :as ui]
[frontend.util :as util]
[clojure.string :as string]
[frontend.handler.shell :as shell]))
[frontend.handler.shell :as shell]
[frontend.handler.file :as file]
[frontend.state :as state]))
(rum/defcs set-git-username-and-email <
(rum/local "" ::username)
@@ -43,3 +45,16 @@
(not (string/blank? email)))
(shell/set-git-username-and-email username email))))}
"Submit"]]]]))
(rum/defc file-specific-version
[path hash content]
[:div.w-full.sm:max-w-lg {:style {:width 700}}
[:div.font-bold.mb-4 (str path (util/format " (%s)" hash)) ]
[:pre content]
(ui/button "Revert"
:on-click (fn []
(file/alter-file (state/get-current-repo)
path
content
{:re-render-root? true
:skip-compare? true})))])