Konata app integration
This commit is contained in:
parent
01a9501f86
commit
ac484fdea8
9 changed files with 443 additions and 51 deletions
|
@ -36,7 +36,8 @@ impl HeaderPanel {
|
|||
.s(Gap::both(15))
|
||||
.item(self.load_button())
|
||||
.item(self.layout_switcher())
|
||||
.item(self.mode_switcher()),
|
||||
.item(self.mode_switcher())
|
||||
.item(self.open_konata_file()),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -193,4 +194,22 @@ impl HeaderPanel {
|
|||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn open_konata_file(&self) -> impl Element {
|
||||
let (hovered, hovered_signal) = Mutable::new_and_signal(false);
|
||||
Button::new()
|
||||
.s(Padding::new().x(20).y(10))
|
||||
.s(Background::new().color_signal(
|
||||
hovered_signal.map_bool(|| COLOR_MEDIUM_SLATE_BLUE, || COLOR_SLATE_BLUE),
|
||||
))
|
||||
.s(Align::new().left())
|
||||
.s(RoundedCorners::all(15))
|
||||
.label(
|
||||
El::new()
|
||||
.s(Font::new().no_wrap())
|
||||
.child("Open Konata file.."),
|
||||
)
|
||||
.on_hovered_change(move |is_hovered| hovered.set_neq(is_hovered))
|
||||
.on_press(move || Task::start(platform::open_konata_file()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,3 +119,7 @@ pub async fn notify_diagram_connector_text_change(
|
|||
) {
|
||||
platform::notify_diagram_connector_text_change(diagram_connector, component_id, text).await;
|
||||
}
|
||||
|
||||
pub async fn open_konata_file() {
|
||||
platform::open_konata_file().await;
|
||||
}
|
||||
|
|
|
@ -166,3 +166,8 @@ pub async fn notify_diagram_connector_text_change(
|
|||
// @TODO error message for user
|
||||
eprintln!("Diagram connectors notifications are not supported in the browser.");
|
||||
}
|
||||
|
||||
pub async fn open_konata_file() {
|
||||
// @TODO error message for user
|
||||
eprintln!("Opening Konata files is not supported in the browser.");
|
||||
}
|
||||
|
|
|
@ -107,6 +107,10 @@ pub(super) async fn notify_diagram_connector_text_change(
|
|||
.unwrap_throw();
|
||||
}
|
||||
|
||||
pub(super) async fn open_konata_file() {
|
||||
tauri_glue::open_konata_file().await;
|
||||
}
|
||||
|
||||
mod tauri_glue {
|
||||
use zoon::*;
|
||||
|
||||
|
@ -162,5 +166,7 @@ mod tauri_glue {
|
|||
component_id: super::super::ComponentId,
|
||||
text: String,
|
||||
) -> Result<(), JsValue>;
|
||||
|
||||
pub async fn open_konata_file();
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -82,3 +82,7 @@ export async function listen_diagram_connectors_messages(on_message: (message: a
|
|||
export async function notify_diagram_connector_text_change(diagram_connector: DiagramConnectorName, component_id: ComponentId, text: string): Promise<void> {
|
||||
return await invoke("notify_diagram_connector_text_change", { diagram_connector, component_id, text });
|
||||
}
|
||||
|
||||
export async function open_konata_file() {
|
||||
return await invoke("open_konata_file");
|
||||
}
|
||||
|
|
Reference in a new issue