Migrate dialogs to Rust and add a New File dialog (#623)

* Migrate coming soon and about dialog to Rust

* Migrate confirm close and close all

* Migrate dialog error

* Improve keyboard navigation throughout UI

* Cleanup and fix panic dialog

* Reduce css spacing to better match old dialogs

* Add new document modal

* Fix crash when generating default name

* Populate rust about graphite data on startup

* Code review changes

* Move one more :focus CSS rule into App.vue

* Add a dialog message and move dialogs

* Split out keyboard input navigation from this branch

* Improvements including simplifying panic dialog code

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube 2022-05-07 09:59:52 +01:00 committed by Keavon Chambers
parent 1a8cc9654a
commit 4b7d8b7ab0
44 changed files with 1017 additions and 390 deletions

View file

@ -150,8 +150,8 @@ impl JsEditorHandle {
self.dispatch(message);
}
pub fn new_document(&self) {
let message = PortfolioMessage::NewDocument;
pub fn request_new_document_dialog(&self) {
let message = DialogMessage::RequestNewDocumentDialog;
self.dispatch(message);
}
@ -212,12 +212,23 @@ impl JsEditorHandle {
}
pub fn close_all_documents_with_confirmation(&self) {
let message = PortfolioMessage::CloseAllDocumentsWithConfirmation;
let message = DialogMessage::CloseAllDocumentsWithConfirmation;
self.dispatch(message);
}
pub fn populate_build_metadata(&self, release: String, timestamp: String, hash: String, branch: String) {
let new = editor::communication::BuildMetadata { release, timestamp, hash, branch };
let message = Message::PopulateBuildMetadata { new };
self.dispatch(message);
}
pub fn request_about_graphite_dialog(&self) {
let message = PortfolioMessage::RequestAboutGraphiteDialog;
let message = DialogMessage::RequestAboutGraphiteDialog;
self.dispatch(message);
}
pub fn request_coming_soon_dialog(&self, issue: Option<i32>) {
let message = DialogMessage::RequestComingSoonDialog { issue };
self.dispatch(message);
}
@ -543,18 +554,6 @@ impl JsEditorHandle {
self.dispatch(message);
}
/// Creates an artboard at a specified point with a width and height
pub fn create_artboard_and_fit_to_viewport(&self, pos_x: f64, pos_y: f64, width: f64, height: f64) {
let message = ArtboardMessage::AddArtboard {
id: None,
position: (pos_x, pos_y),
size: (width, height),
};
self.dispatch(message);
let message = DocumentMessage::ZoomCanvasToFitAll;
self.dispatch(message);
}
// TODO(mfish33): Replace with initialization system Issue:#524
pub fn init_document_bar(&self) {
let message = PortfolioMessage::UpdateDocumentBar;