refactor: replace shell with root view wrapping app content
This commit is contained in:
@@ -119,14 +119,11 @@ impl RepoFilesView {
|
||||
|
||||
fn rebuild_rows(&mut self) {
|
||||
self.rows = TreeItemSeed::flatten_all(&self.seeds, &self.expanded);
|
||||
self.selected_index = self
|
||||
.selected_file
|
||||
.as_ref()
|
||||
.and_then(|path| {
|
||||
self.rows
|
||||
.iter()
|
||||
.position(|row| row.key().to_string() == path.as_ref())
|
||||
});
|
||||
self.selected_index = self.selected_file.as_ref().and_then(|path| {
|
||||
self.rows
|
||||
.iter()
|
||||
.position(|row| row.key().to_string() == path.as_ref())
|
||||
});
|
||||
}
|
||||
|
||||
fn toggle_folder(&mut self, id: &str) {
|
||||
@@ -281,10 +278,7 @@ impl RepoFilesView {
|
||||
let view = disclosure_view;
|
||||
move |index, _, cx| {
|
||||
if let Err(error) = view.update(cx, |this, cx| {
|
||||
let id = this
|
||||
.rows
|
||||
.get(index)
|
||||
.map(|row| row.key().to_string());
|
||||
let id = this.rows.get(index).map(|row| row.key().to_string());
|
||||
if let Some(id) = id {
|
||||
this.toggle_folder(&id);
|
||||
cx.emit(RepoFilesEvent::Activated);
|
||||
@@ -310,9 +304,9 @@ impl RepoFilesView {
|
||||
self.code_element(path.as_ref())
|
||||
}
|
||||
}
|
||||
Some(FileContent::Binary) => EmptyState::centered(
|
||||
"Binary file - preview not supported",
|
||||
),
|
||||
Some(FileContent::Binary) => {
|
||||
EmptyState::centered("Binary file - preview not supported")
|
||||
}
|
||||
Some(FileContent::TooLarge) => EmptyState::centered("File is too large to preview"),
|
||||
Some(FileContent::Failed(message)) => EmptyState::centered(message),
|
||||
None => Spinner::centered("repo-preview-spinner"),
|
||||
|
||||
Reference in New Issue
Block a user