-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
206 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ edition = "2021" | |
[dependencies] | ||
eframe = "0.25.0" | ||
catppuccin-egui = "4.0" | ||
devmode-shared = { path = "../shared" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,53 @@ | ||
use eframe::egui::{Response, Ui}; | ||
use eframe::egui::{Layout, Response, ScrollArea, Ui}; | ||
|
||
#[derive(Debug, Default)] | ||
pub struct OpenPanel; | ||
use crate::Repository; | ||
|
||
#[derive(Debug)] | ||
pub struct OpenPanel { | ||
repositories: Vec<Repository>, | ||
selected: Repository, | ||
} | ||
|
||
impl Default for OpenPanel { | ||
fn default() -> Self { | ||
let repositories: Vec<Repository> = (0..20) | ||
.map(|i| Repository { | ||
name: "Test".to_string(), | ||
url: i.to_string(), | ||
}) | ||
.collect(); | ||
Self { | ||
repositories: repositories.clone(), | ||
selected: repositories.first().unwrap().to_owned(), | ||
} | ||
} | ||
} | ||
|
||
impl OpenPanel { | ||
pub(crate) fn ui(&self, ui: &mut Ui) -> Response { | ||
ui.label("Open") | ||
pub(crate) fn ui(&mut self, ui: &mut Ui) -> Response { | ||
ScrollArea::vertical().show(ui, |ui| { | ||
ui.heading("Local repositories"); | ||
ui.separator(); | ||
ui.vertical(|ui| { | ||
ScrollArea::vertical().show(ui, |ui| { | ||
// Use the `Layout` API to justify the content vertically | ||
ui.with_layout( | ||
Layout::top_down(eframe::emath::Align::Min).with_cross_justify(true), | ||
|ui| { | ||
for repo in &self.repositories { | ||
let name = repo.name.clone(); | ||
ui.selectable_value(&mut self.selected, repo.clone(), &name); | ||
} | ||
}, | ||
); | ||
}) | ||
}); | ||
}); | ||
ui.separator() | ||
} | ||
|
||
pub(crate) fn footer(&mut self, ui: &mut Ui) -> Response { | ||
ui.label("Footer") | ||
ui.button("Open"); | ||
ui.button("Add to workspace") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,76 @@ | ||
use eframe::egui::{Response, Ui}; | ||
use devmode_shared::{application::Application, editor::Editor, host::Host, settings::Settings}; | ||
use eframe::{ | ||
egui::{ComboBox, Response, TextEdit, Ui}, | ||
epaint::vec2, | ||
}; | ||
|
||
#[derive(Debug, Default)] | ||
pub struct PreferencesPanel; | ||
#[derive(Debug)] | ||
pub struct PreferencesPanel { | ||
settings: Settings, | ||
} | ||
|
||
impl Default for PreferencesPanel { | ||
fn default() -> Self { | ||
let settings = Settings::current().unwrap_or_default(); | ||
Self { settings } | ||
} | ||
} | ||
|
||
impl PreferencesPanel { | ||
pub(crate) fn ui(&self, ui: &mut Ui) -> Response { | ||
ui.label("Preferences") | ||
pub(crate) fn ui(&mut self, ui: &mut Ui) -> Response { | ||
ui.heading("Preferences"); | ||
ui.separator(); | ||
ui.style_mut().spacing.item_spacing = vec2(10.0, 10.0); | ||
ui.strong("Git Service"); | ||
ui.horizontal(|ui| { | ||
ComboBox::from_label("Select your prefered git service provider.") | ||
.selected_text(self.settings.host.clone()) | ||
.show_ui(ui, |ui| { | ||
ui.selectable_value( | ||
&mut self.settings.host, | ||
Host::GitHub.to_string(), | ||
"GitHub", | ||
); | ||
ui.selectable_value( | ||
&mut self.settings.host, | ||
Host::GitLab.to_string(), | ||
"GitLab", | ||
); | ||
}); | ||
}); | ||
ui.strong("Git username"); | ||
ui.horizontal(|ui| { | ||
ui.add_sized( | ||
ui.available_size(), | ||
TextEdit::singleline(&mut self.settings.owner).margin(vec2(10.0, 10.0)), | ||
) | ||
}); | ||
ui.strong("Editor"); | ||
ui.horizontal(|ui| { | ||
ComboBox::from_label("Select your favorite editor.") | ||
.selected_text(self.settings.editor.app.clone().to_string()) | ||
.show_ui(ui, |ui| { | ||
ui.selectable_value( | ||
&mut self.settings.editor, | ||
Editor::new(Application::VSCode), | ||
Application::VSCode.to_string(), | ||
); | ||
ui.selectable_value( | ||
&mut self.settings.editor, | ||
Editor::new(Application::Vim), | ||
Application::Vim.to_string(), | ||
); | ||
ui.selectable_value( | ||
&mut self.settings.editor, | ||
Editor::new(Application::Custom), | ||
Application::Custom.to_string(), | ||
); | ||
}); | ||
}); | ||
ui.separator() | ||
} | ||
|
||
pub(crate) fn footer(&mut self, ui: &mut Ui) -> Response { | ||
ui.label("Footer") | ||
ui.button("Save") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,56 @@ | ||
use eframe::egui::{Response, Ui}; | ||
use eframe::egui::{Layout, Response, ScrollArea, Ui}; | ||
|
||
#[derive(Debug, Default)] | ||
pub struct WorkspacesPanel; | ||
#[derive(Debug)] | ||
pub struct WorkspacesPanel { | ||
workspaces: Vec<Workspace>, | ||
selected: Workspace, | ||
} | ||
|
||
impl Default for WorkspacesPanel { | ||
fn default() -> Self { | ||
let workspaces: Vec<Workspace> = (0..20) | ||
.map(|i| Workspace { | ||
name: i.to_string(), | ||
}) | ||
.collect(); | ||
Self { | ||
workspaces: workspaces.clone(), | ||
selected: workspaces.first().unwrap().to_owned(), | ||
} | ||
} | ||
} | ||
|
||
#[derive(Debug, Default, PartialEq, Clone)] | ||
pub struct Workspace { | ||
name: String, | ||
} | ||
|
||
impl WorkspacesPanel { | ||
pub(crate) fn ui(&self, ui: &mut Ui) -> Response { | ||
ui.label("Workspaces") | ||
pub(crate) fn ui(&mut self, ui: &mut Ui) -> Response { | ||
ScrollArea::vertical().show(ui, |ui| { | ||
ui.heading("Workspaces"); | ||
ui.separator(); | ||
ui.vertical(|ui| { | ||
ScrollArea::vertical().show(ui, |ui| { | ||
// Use the `Layout` API to justify the content vertically | ||
ui.with_layout( | ||
Layout::top_down(eframe::emath::Align::Min).with_cross_justify(true), | ||
|ui| { | ||
for ws in &self.workspaces { | ||
let name = ws.name.clone(); | ||
ui.selectable_value(&mut self.selected, ws.clone(), &name); | ||
} | ||
}, | ||
); | ||
}) | ||
}); | ||
}); | ||
ui.separator() | ||
} | ||
|
||
pub(crate) fn footer(&mut self, ui: &mut Ui) -> Response { | ||
ui.label("Footer") | ||
ui.button("Add"); | ||
ui.button("Edit"); | ||
ui.button("Remove") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters