Allow enable encryption when first-clone

This commit is contained in:
Kan-Ru Chen
2021-01-14 23:53:11 +09:00
parent e132f65f93
commit 6f337dcfe5
4 changed files with 66 additions and 35 deletions

View File

@@ -1,7 +1,7 @@
(ns frontend.components.encryption
(:require [rum.core :as rum]
[frontend.encrypt :as e]
[frontend.util :as util :refer-macros [profile]]
[frontend.context.i18n :as i18n]
[frontend.db.utils :as db-utils]
[clojure.string :as string]
@@ -39,4 +39,32 @@
(defn encryptioin-dialog
[repo-url]
(fn [close-fn]
(encryption-dialog-inner repo-url close-fn)))
(encryption-dialog-inner repo-url close-fn)))
(rum/defcs encryption-setup-dialog-inner
[state repo-url close-fn]
(rum/with-context [[t] i18n/*tongue-context*]
[:div
[:div.sm:flex.sm:items-start
[:div.mt-3.text-center.sm:mt-0.sm:text-left
[:h3#modal-headline.text-lg.leading-6.font-medium.text-gray-900
"Create encrypted graph?"]]]
[:div.mt-5.sm:mt-4.sm:flex.sm:flex-row-reverse
[:span.flex.w-full.rounded-md.shadow-sm.sm:ml-3.sm:w-auto
[:button.inline-flex.justify-center.w-full.rounded-md.border.border-transparent.px-4.py-2.bg-indigo-600.text-base.leading-6.font-medium.text-white.shadow-sm.hover:bg-indigo-500.focus:outline-none.focus:border-indigo-700.focus:shadow-outline-indigo.transition.ease-in-out.duration-150.sm:text-sm.sm:leading-5
{:type "button"
:on-click (fn []
(e/generate-mnemonic-and-save repo-url)
(close-fn))}
(t :yes)]]
[:span.mt-3.flex.w-full.rounded-md.shadow-sm.sm:mt-0.sm:w-auto
[:button.inline-flex.justify-center.w-full.rounded-md.border.border-gray-300.px-4.py-2.bg-white.text-base.leading-6.font-medium.text-gray-700.shadow-sm.hover:text-gray-500.focus:outline-none.focus:border-blue-300.focus:shadow-outline-blue.transition.ease-in-out.duration-150.sm:text-sm.sm:leading-5
{:type "button"
:on-click close-fn}
(t :no)]]]]))
(defn encryption-setup-dialog
[repo-url]
(fn [close-fn]
(encryption-setup-dialog-inner repo-url close-fn)))