can hide.

This commit is contained in:
Bryce Covert
2019-02-17 09:25:10 -08:00
parent 23d1fb9369
commit 9e94ad2e2c
2 changed files with 187 additions and 173 deletions

View File

@@ -86,8 +86,8 @@
(fn [{:keys [visible?]} & children] (fn [{:keys [visible?]} & children]
[css-transition-group {:in visible? :class-names {:exitDone "bounce animated" :exit "fadeOutRight animated" :enter "fadeInRight animated"} :timeout 300 :onEnter (fn [] (reset! final-state true )) :onExited (fn [] (reset! final-state false))} [css-transition-group {:in visible? :class-names {:exitDone "bounce animated" :exit "fadeOutRight animated" :enter "fadeInRight animated"} :timeout 300 :onEnter (fn [] (reset! final-state true )) :onExited (fn [] (reset! final-state false))}
(if (or @final-state visible?) (if (or @final-state visible?)
[:aside {:class "column is-3 aside menu hero is-fullheight" :style {:height "100vh" :overflow "auto"}} [:aside {:class "column is-3 aside menu" :style {:height "calc(100vh - 46px)" :overflow "auto"}}
[:div.sub-main {:style {:padding-bottom "80px"}}children ]] [:div.sub-main {} children ]]
[:div])]))) [:div])])))
(defn side-bar-layout [{:keys [side-bar main ap bottom right-side-bar right-side-bar-visible?]}] (defn side-bar-layout [{:keys [side-bar main ap bottom right-side-bar right-side-bar-visible?]}]
@@ -95,12 +95,12 @@
client @(re-frame/subscribe [::subs/client])] client @(re-frame/subscribe [::subs/client])]
[:div [:div
[navbar ap] [navbar ap]
[:div {:class "columns has-shadow", :style {:margin-bottom "0px" :height "100vh"} :id "mail-app" } [:div {:class "columns has-shadow", :style {:margin-bottom "0px" :height "calc(100vh - 46px)" } :id "mail-app" }
[:aside {:class "column aside menu is-2 " } [:aside {:class "column aside menu is-2 " }
[:div.main.left-nav [:div.main.left-nav
[:div side-bar [:div side-bar
]]] ]]]
[:div {:class "column messages hero is-fullheight " :style { :overflow "auto" }, :id "message-feed"} [:div {:class "column messages hero " :style { :overflow "auto" }, :id "message-feed"}
^{:key (str "active-page-" (:name client))} ^{:key (str "active-page-" (:name client))}
[:div.inbox-messages main]] [:div.inbox-messages main]]
[appearing-side-bar {:visible? right-side-bar-visible?} right-side-bar]] [appearing-side-bar {:visible? right-side-bar-visible?} right-side-bar]]

View File

@@ -37,6 +37,14 @@
(defn stop-form [db form] (defn stop-form [db form]
(update db ::forms dissoc form)) (update db ::forms dissoc form))
(re-frame/reg-event-db
::form-closing
(fn [db [_ f]]
(-> db
(assoc-in [:admin :adding-client?] false)
(stop-form f))))
(re-frame/reg-event-db (re-frame/reg-event-db
::new ::new
(fn [db [_ client-id]] (fn [db [_ client-id]]
@@ -99,6 +107,7 @@
:on-error [::save-error]}} :on-error [::save-error]}}
{:db new-client-form})))) {:db new-client-form}))))
(re-frame/reg-event-db (re-frame/reg-event-db
::save-complete ::save-complete
(fn [db [_ client]] (fn [db [_ client]]
@@ -185,8 +194,13 @@
[clients-table]])]) [clients-table]])])
(defn side-bar-form [_ children]
[:div [:a.delete.is-pulled-right {:on-click (dispatch-event [::form-closing ::new-client])}] [:div children]])
(defn new-client-form [] (defn new-client-form []
(let [{error :error new-client :data } @(re-frame/subscribe [::form ::new-client])] (let [{error :error new-client :data } @(re-frame/subscribe [::form ::new-client])]
[side-bar-form {}
[:form [:form
[:h1.title.is-2 "Add client"] [:h1.title.is-2 "Add client"]
[:div.field [:div.field
@@ -234,14 +248,14 @@
(for [location (:locations new-client)] (for [location (:locations new-client)]
^{:key location} [:li location ])]]] ^{:key location} [:li location ])]]]
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em"}} [:div {:style {:padding-bottom "0.75em" :padding-top "0.75em"}}
[:h2.subtitle "Address"] [:h2.subtitle "Address"]
[address-field {:field [:address] [address-field {:field [:address]
:event ::change-new :event ::change-new
:subscription new-client}]] :subscription new-client}]]
[:section.section {:style {:padding-bottom "0.75em" :padding-top "0.75em" :background "hsl(0, 0%, 96%)"}}
[:h2.subtitle "Add bank account"] [:h2.subtitle "Add bank account"]
[:div {:style {:padding-bottom "0.75em" :padding-top "0.75em" :background "hsl(0, 0%, 96%)"}}
[:label.label "General"] [:label.label "General"]
[horizontal-field [horizontal-field
nil nil
@@ -361,7 +375,7 @@
"" ""
"disabled") "disabled")
:on-click (dispatch-event [::save-new-client]) :on-click (dispatch-event [::save-new-client])
:class (str @(re-frame/subscribe [::loading-class ::new-client]) (when error " animated shake"))} "Save"]])) :class (str @(re-frame/subscribe [::loading-class ::new-client]) (when error " animated shake"))} "Save"]]]))
(defn admin-clients-page [] (defn admin-clients-page []
(let [{:keys [adding-client?]} @(re-frame/subscribe [::subs/admin])] (let [{:keys [adding-client?]} @(re-frame/subscribe [::subs/admin])]