diff --git a/pmme-mobile/.gitignore b/pmme-mobile/.gitignore index 482b729..43ba893 100644 --- a/pmme-mobile/.gitignore +++ b/pmme-mobile/.gitignore @@ -23,3 +23,4 @@ dist-ssr *.sln *.sw? *.jks +src/ diff --git a/pmme-mobile/src-tauri/tauri.conf.json b/pmme-mobile/src-tauri/tauri.conf.json index fba44a2..80ed475 100644 --- a/pmme-mobile/src-tauri/tauri.conf.json +++ b/pmme-mobile/src-tauri/tauri.conf.json @@ -4,7 +4,7 @@ "version": "0.1.0", "identifier": "com.pmme.app", "build": { - "frontendDist": "../src" + "devUrl": "http://localhost:3000" }, "app": { "withGlobalTauri": true, diff --git a/pmme-mobile/src/index.html b/pmme-mobile/src/index.html deleted file mode 100644 index 659ea3a..0000000 --- a/pmme-mobile/src/index.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - Tauri App - - - - -
-

Welcome to Tauri

- -
- - - - - - -
-

Click on the Tauri logo to learn more about the framework

- -
- - -
-

-
- - diff --git a/pmme-mobile/src/main.js b/pmme-mobile/src/main.js deleted file mode 100644 index 55d5f93..0000000 --- a/pmme-mobile/src/main.js +++ /dev/null @@ -1,18 +0,0 @@ -const { invoke } = window.__TAURI__.core; - -let greetInputEl; -let greetMsgEl; - -async function greet() { - // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ - greetMsgEl.textContent = await invoke("greet", { name: greetInputEl.value }); -} - -window.addEventListener("DOMContentLoaded", () => { - greetInputEl = document.querySelector("#greet-input"); - greetMsgEl = document.querySelector("#greet-msg"); - document.querySelector("#greet-form").addEventListener("submit", (e) => { - e.preventDefault(); - greet(); - }); -}); diff --git a/pmme-mobile/src/assets/javascript.svg b/pmme-ui/public/assets/javascript.svg similarity index 100% rename from pmme-mobile/src/assets/javascript.svg rename to pmme-ui/public/assets/javascript.svg diff --git a/pmme-mobile/src/assets/tauri.svg b/pmme-ui/public/assets/tauri.svg similarity index 100% rename from pmme-mobile/src/assets/tauri.svg rename to pmme-ui/public/assets/tauri.svg diff --git a/pmme-ui/public/index.html b/pmme-ui/public/index.html index 46b852d..90e4f86 100644 --- a/pmme-ui/public/index.html +++ b/pmme-ui/public/index.html @@ -1,12 +1,32 @@ - - + + - - - PMME UI + + + + Tauri App + -
- +
+

Welcome to Tauri

+ +
+ + + + + + +
+

Click on the Tauri logo to learn more about the framework.

+ +
+ + +
+

+
+ - \ No newline at end of file + diff --git a/pmme-mobile/src/styles.css b/pmme-ui/public/styles.css similarity index 100% rename from pmme-mobile/src/styles.css rename to pmme-ui/public/styles.css diff --git a/pmme-ui/shadow-cljs.edn b/pmme-ui/shadow-cljs.edn index f1a362d..0fd02b0 100644 --- a/pmme-ui/shadow-cljs.edn +++ b/pmme-ui/shadow-cljs.edn @@ -6,14 +6,21 @@ :dependencies [] + :dev-http {3000 "public"} + :builds {:app {:target :browser :output-dir "public/js" :asset-path "/js" - :modules {:main {:init-fn pmme-ui.core/init}}} + :modules {:main {:init-fn pmme-ui.core/init}} + :devtools {:devtools-url "http://192.168.110.133:9630"}} :release {:target :browser :output-dir "../pmme-mobile/src/js" :asset-path "/js" :modules {:main {:init-fn pmme-ui.core/init}} - :compiler-options {:optimizations :advanced}}}} + :compiler-options {:optimizations :advanced} + :build-hooks [(shadow.resource/copy-resources + {:from "public" + :to "../pmme-mobile/src" + :exclude ["**/*.js"]})]}}} diff --git a/pmme-ui/src/main/pmme_ui/core.cljs b/pmme-ui/src/main/pmme_ui/core.cljs index e6eade7..f7a9d24 100644 --- a/pmme-ui/src/main/pmme_ui/core.cljs +++ b/pmme-ui/src/main/pmme_ui/core.cljs @@ -10,13 +10,17 @@ (set! (.-innerHTML msg-element) "Please enter a name!") (do ;; You could call a Tauri command here instead + (js/console.log "Testing the chrome thingie") (set! (.-innerHTML msg-element) - (str "Hello, " name "! 👋 (from ClojureScript)")) + (str "Hello, " name "! 👋 (from ClojureScript)!")) (set! (.-value input) ""))))) +(defn greet-handler [event] + (handle-greet event)) + (defn setup-greet-form [] (when-let [form (.getElementById js/document "greet-form")] - (.addEventListener form "submit" handle-greet))) + (.addEventListener form "submit" greet-handler))) (defn add-dynamic-styling [] (let [style (.createElement js/document "style")]