feat(tui): remove label from repo identity widget

This commit is contained in:
Paul Campbell 2024-08-31 19:55:33 +01:00
parent 9720fd01fc
commit be41842dae
2 changed files with 1 additions and 10 deletions

View file

@ -10,7 +10,6 @@ use ratatui::{
use crate::tui::actor::RepoMessage; use crate::tui::actor::RepoMessage;
pub struct Identity<'a> { pub struct Identity<'a> {
pub label: &'a str,
pub repo_alias: &'a RepoAlias, pub repo_alias: &'a RepoAlias,
pub alert: Option<&'a str>, pub alert: Option<&'a str>,
pub message: &'a RepoMessage, pub message: &'a RepoMessage,
@ -18,14 +17,12 @@ pub struct Identity<'a> {
} }
impl<'a> Identity<'a> { impl<'a> Identity<'a> {
pub const fn new( pub const fn new(
label: &'a str,
repo_alias: &'a RepoAlias, repo_alias: &'a RepoAlias,
alert: Option<&'a str>, alert: Option<&'a str>,
message: &'a RepoMessage, message: &'a RepoMessage,
repo_branches: Option<&'a RepoBranches>, repo_branches: Option<&'a RepoBranches>,
) -> Self { ) -> Self {
Self { Self {
label,
repo_alias, repo_alias,
alert, alert,
message, message,
@ -35,7 +32,6 @@ impl<'a> Identity<'a> {
} }
impl<'a> Identity<'a> { impl<'a> Identity<'a> {
fn spans(self) -> Vec<Span<'a>> { fn spans(self) -> Vec<Span<'a>> {
let label = self.label;
let repo_alias = Span::from(self.repo_alias.to_string()).style(if self.alert.is_some() { let repo_alias = Span::from(self.repo_alias.to_string()).style(if self.alert.is_some() {
Style::default().fg(Color::Black).bg(Color::Red) Style::default().fg(Color::Black).bg(Color::Red)
} else { } else {
@ -62,7 +58,7 @@ impl<'a> Identity<'a> {
vec![ vec![
" ".into(), " ".into(),
repo_alias, repo_alias,
format!(" ({label}) ").into(), " ".into(),
alert, alert,
format!("({main}/{next}/{dev}) [").into(), format!("({main}/{next}/{dev}) [").into(),
message.into(), message.into(),

View file

@ -39,7 +39,6 @@ impl<'a> RepoWidget<'a> {
message, message,
alert, alert,
} => InnerRepoWidget { } => InnerRepoWidget {
label: "identified",
repo_alias, repo_alias,
message, message,
alert: alert.as_ref().map(String::as_str), alert: alert.as_ref().map(String::as_str),
@ -54,7 +53,6 @@ impl<'a> RepoWidget<'a> {
branches, branches,
log, log,
} => InnerRepoWidget { } => InnerRepoWidget {
label: "configured",
repo_alias, repo_alias,
message, message,
alert: alert.as_ref().map(String::as_str), alert: alert.as_ref().map(String::as_str),
@ -74,7 +72,6 @@ impl<'a> RepoWidget<'a> {
// dev, // dev,
.. ..
} => InnerRepoWidget { } => InnerRepoWidget {
label: "ready",
repo_alias, repo_alias,
message, message,
alert: alert.as_ref().map(String::as_str), alert: alert.as_ref().map(String::as_str),
@ -98,7 +95,6 @@ impl<'a> Widget for RepoWidget<'a> {
} }
struct InnerRepoWidget<'a> { struct InnerRepoWidget<'a> {
pub label: &'a str,
pub repo_alias: &'a RepoAlias, pub repo_alias: &'a RepoAlias,
pub message: &'a RepoMessage, pub message: &'a RepoMessage,
pub alert: Option<&'a str>, pub alert: Option<&'a str>,
@ -123,7 +119,6 @@ impl<'a> Widget for InnerRepoWidget<'a> {
{ {
let block = Block::default() let block = Block::default()
.title(Identity::new( .title(Identity::new(
self.label,
self.repo_alias, self.repo_alias,
self.alert, self.alert,
self.message, self.message,