Add project and branch chat controls
This commit is contained in:
@@ -267,6 +267,41 @@ impl App {
|
||||
.color(muted_text()),
|
||||
);
|
||||
}
|
||||
let project_control: Element<'_, Message> = if self.selected_session.is_none() {
|
||||
let choices = self
|
||||
.projects
|
||||
.iter()
|
||||
.map(|item| ProjectChoice {
|
||||
id: item.project.id,
|
||||
name: item.project.name.clone(),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let selected = choices
|
||||
.iter()
|
||||
.find(|choice| choice.id == project.id)
|
||||
.cloned();
|
||||
pick_list(choices, selected, |choice| {
|
||||
Message::DraftProjectChanged(choice.id)
|
||||
})
|
||||
.text_size(12)
|
||||
.padding([2, 6])
|
||||
.into()
|
||||
} else {
|
||||
row![icon(ICON_FOLDER, 14), text(&project.name).size(12)]
|
||||
.spacing(4)
|
||||
.align_y(Alignment::Center)
|
||||
.into()
|
||||
};
|
||||
let branch_control = self.git_states.get(&project.id).map(|state| {
|
||||
pick_list(
|
||||
state.branches.clone(),
|
||||
state.current.clone(),
|
||||
Message::SwitchGitBranch,
|
||||
)
|
||||
.placeholder(&state.label)
|
||||
.text_size(12)
|
||||
.padding([2, 6])
|
||||
});
|
||||
composer_content =
|
||||
composer_content.push(
|
||||
row![
|
||||
@@ -294,6 +329,8 @@ impl App {
|
||||
.size(11)
|
||||
.color(muted_text()),
|
||||
Space::new().width(Length::Fill),
|
||||
project_control,
|
||||
branch_control,
|
||||
icon(ICON_MODEL, 16),
|
||||
text(self.config.model.to_string()).size(12),
|
||||
action,
|
||||
|
||||
Reference in New Issue
Block a user