Skip to content

Commit

Permalink
private page [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
MokkeMeguru committed Jul 6, 2020
1 parent 48e368c commit ce677ed
Show file tree
Hide file tree
Showing 14 changed files with 6,733 additions and 186 deletions.
6,326 changes: 6,165 additions & 161 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
"name": "practical-customizable-alerm",
"dependencies": {
"@creativebulma/bulma-collapsible": "^1.0.4",
"@material-ui/core": "^4.11.0",
"aws-sdk": "^2.709.0",
"highlight": "^0.2.4",
"highlight.js": "9.18.1",
"minimist": "^1.2.5",
"react": "16.13.0",
"react-datepicker": "^3.0.0",
"react-day-picker": "^7.4.8",
"react-dom": "16.13.0",
"react-highlight.js": "1.0.7"
"react-highlight.js": "1.0.7",
"react-native": "^0.62.2",
"react-native-datepicker": "^1.7.2",
"react-plotly": "^1.0.0",
"react-tooltip": "^4.2.7",
"react-vis": "^1.11.7"
},
"devDependencies": {
"karma": "4.4.1",
Expand Down
8 changes: 7 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[thheller/shadow-cljs "2.9.3"]
[reagent "0.10.0"]
[re-frame "0.12.0"]
[day8.re-frame/http-fx "v0.2.0"]
[day8.re-frame/tracing "0.5.5"]
[garden "1.3.10"]
[ns-tracker "0.4.0"]
Expand All @@ -20,6 +21,8 @@
[lein-garden "0.3.0"]
[lein-shell "0.5.0"]]

:npm [highlight.js "9.18.1"]

:min-lein-version "2.9.0"

:jvm-opts ["-Xmx1G"]
Expand Down Expand Up @@ -51,7 +54,10 @@
:modules {:app {:init-fn practical-customizable-alerm.core/init
:preloads [devtools.preload
day8.re-frame-10x.preload]}}
:dev {:compiler-options {:closure-defines {re-frame.trace.trace-enabled? true
:dev {:compiler-options {
:rewrite-polyfills true
:ouput-feature-set :es3
:closure-defines {re-frame.trace.trace-enabled? true
day8.re-frame.tracing.trace-enabled? true}}}
:release {:build-options
{:ns-aliases
Expand Down
16 changes: 10 additions & 6 deletions src/clj/practical_customizable_alerm/css.clj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{:font-size "calc(150% + 0.5vw)"}]
[:.sec-title
{:line-height 1.5
:border-bottom "solid 0.5rem gray"
:border-bottom "solid 0.5rem #78b771"
:padding-right "5rem"}]

[:.footer
Expand Down Expand Up @@ -70,24 +70,25 @@
:margin-left "auto"}]
[:.navbar-item
{:display "flex"
:fill "gray"
:align-items "center"}]

[:.start {:justify-content "flex-start"}]
[:.center {:justify-content "flex-center"}]
[:.end
{:justify-content "flex-end"
:margin-left "auto"}]
{:justify-content "flex-end"}]

[:.link-button:hover
{:background-color "#9b9b9b"
:box-shadow "0px 8px 8px rgba(0, 0, 0, 0.05)"}]
{:background-color "#4f4c81"
:box-shadow "0px 8px 8px rgba(0, 0, 0, 0.05)"
:transform "scale(0.95)"}]
[:.link-button ".link-button:hover::before" ".link-button:hover::after"
{:transition "all 0.3s"}]
[:.link-button
;; Rectangle 2
{:position "flex"
;; :width "279px"
:background "#575757"
:background "#7b5e90"
;; :border "1px solid #000000"
:boxsizing "border-box"
:box-shadow "0px 8px 8px rgba(0, 0, 0, 0.25)"
Expand Down Expand Up @@ -118,6 +119,9 @@
:overflow "hidden"
:padding 0}]

[:.tabs
[:a {:border "0"}]]

(at-media {:screen true
:max-width "800px"}
[:.subillust
Expand Down
20 changes: 17 additions & 3 deletions src/cljs/practical_customizable_alerm/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[practical-customizable-alerm.views :as views]
[practical-customizable-alerm.config :as config]
[practical-customizable-alerm.routes :as routes]
[practical-customizable-alerm.idb :as idb]
))


Expand All @@ -21,7 +22,20 @@
(rdom/unmount-component-at-node root-el)
(rdom/render [views/main-panel] root-el)))



(defn init []
(re-frame/dispatch-sync [::events/initialize-db])
(dev-setup)
(mount-root))
(let [request (-> js/window
.-indexedDB
(.open idb/dbname 3))]
(re-frame/dispatch-sync [::events/initialize-db])
(dev-setup)
(mount-root)
(set! (.-onerror request) idb/idb-request-error)
(set! (.-onsuccess request) idb/idb-request-success)
(set! (.-onupgradeneeded request)
#(let [db (.. % -target -result)]
(println "test" db)
(re-frame/dispatch-sync [::events/init-indexed-db db])
(idb/create-object-store db idb/sound-table)
(idb/create-object-store db idb/alarm-table)))))
5 changes: 4 additions & 1 deletion src/cljs/practical_customizable_alerm/db.cljs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
(ns practical-customizable-alerm.db)
(ns practical-customizable-alerm.db
(:require [reagent.core :as r]))

(def default-db
{:name "re-frame"
:accordion {}
:shop-modals {}
:viewing-shop "model"
:viewing-setting "alarm"
:raspihost ""
:sounds []
:indexed-db (r/atom {})
})
50 changes: 48 additions & 2 deletions src/cljs/practical_customizable_alerm/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
[practical-customizable-alerm.db :as db]
[reitit.frontend.controllers :as refc]
[reitit.frontend.easy :as resy]
[day8.re-frame.tracing :refer-macros [fn-traced]]))
[day8.re-frame.tracing :refer-macros [fn-traced]]
[ajax.core :as ajax]
[day8.re-frame.http-fx]
))

(re-frame/reg-event-db
::initialize-db
Expand All @@ -16,8 +19,37 @@
(fn [_cofx [_ & route]]
{:navigate! route}))


(re-frame/reg-event-fx
::get-sounds
(fn [{:keys [db]} [_ val]]
(println val)
{:db (assoc db :show-twirly true)
:http-xhrio {:method :get
:uri (str val "/sound") ;;val + "/sounds"
:timeout 8000
:response-format (ajax/json-response-format {:keywords? true})
:on-success [::regist-sounds]
:on-failure [::bad-http-result]
}}))

(re-frame/reg-event-db
::bad-http-result
(fn [db [_ result]]
(.log js/console result)
db))

(re-frame/reg-event-db
::regist-sounds
(fn [db [_ result]]
(println result)
(assoc db :sounds (:sounds result))))

;; (re-frame/dispatch [::regist-sounds {:sounds []}])
;; (re-frame/dispatch-sync [::get-sounds "http://localhost:8080"])

(re-frame/reg-fx
:navigate!
:navigate!bp
(fn [route]
(apply resy/push-state route)))

Expand Down Expand Up @@ -60,3 +92,17 @@
(println "ship" shop-id)
(assoc db :viewing-shop shop-id)))



(re-frame/reg-event-db
::viewing-setting
(fn [db [_ setting]]
(println "setting" setting)
(assoc db :viewing-setting setting)))

(re-frame/reg-event-db
::init-indexed-db
(fn [db [_ idb]]
(assoc db :indexed-db idb)))


Loading

0 comments on commit ce677ed

Please sign in to comment.