Prompt popup implementation
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
use crate::bridge::invoke;
|
||||
use crate::popup::Popup;
|
||||
use leptos::{prelude::*, reactive::spawn_local};
|
||||
use leptos_router::{
|
||||
components::{Route, Router, Routes},
|
||||
path,
|
||||
};
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
#[wasm_bindgen(js_namespace = ["window", "__TAURI__", "core"])]
|
||||
async fn invoke(cmd: &str, args: JsValue) -> JsValue;
|
||||
}
|
||||
|
||||
#[component]
|
||||
pub fn App() -> impl IntoView {
|
||||
@@ -33,7 +28,9 @@ fn Dashboard() -> impl IntoView {
|
||||
};
|
||||
let prompt = |_ev: leptos::ev::MouseEvent| {
|
||||
spawn_local(async {
|
||||
let prompt = serde_wasm_bindgen::to_value(&serde_json::json!({"prompt": "jee juu juu"})).unwrap();
|
||||
let prompt =
|
||||
serde_wasm_bindgen::to_value(&serde_json::json!({"prompt": "jee juu juu"}))
|
||||
.unwrap();
|
||||
invoke("prompt_llm", prompt).await;
|
||||
});
|
||||
};
|
||||
@@ -45,13 +42,3 @@ fn Dashboard() -> impl IntoView {
|
||||
</main>
|
||||
}
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn Popup() -> impl IntoView {
|
||||
view! {
|
||||
<main class="window-shell rounded-container">
|
||||
<h3>"AI quick action"</h3>
|
||||
<input type="text" placeholder="Ask Gordon AI" autofocus />
|
||||
</main>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user