Radish alpha
r
rad:z39mP9rQAaGmERfUMPULfPUi473tY
Radicle terminal user interface
Radicle
Git
inbox: Adjust table header
Merged did:key:z6MkswQE...2C1V opened 2 years ago
2 files changed +12 -11 42d0ce70 bb104bd4
modified bin/commands/inbox/flux/select.rs
@@ -3,7 +3,9 @@ mod ui;

use anyhow::Result;

+
use radicle::identity::Project;
use radicle::node::notifications::NotificationId;
+
use radicle::storage::ReadRepository;

use radicle::storage::git::Repository;
use radicle::Profile;
@@ -39,12 +41,16 @@ pub struct InboxState {
    notifications: Vec<NotificationItem>,
    selected: Option<NotificationItem>,
    mode: common::Mode,
+
    project: Project,
}

impl TryFrom<&Context> for InboxState {
    type Error = anyhow::Error;

    fn try_from(context: &Context) -> Result<Self, Self::Error> {
+
        let doc = context.repository.identity_doc()?;
+
        let project = doc.project()?;
+

        let notifications = inbox::all(&context.repository, &context.profile)?;
        let mut items = vec![];

@@ -72,6 +78,7 @@ impl TryFrom<&Context> for InboxState {
            notifications: items,
            selected,
            mode: context.mode.clone(),
+
            project,
        })
    }
}
modified bin/commands/inbox/flux/select/ui.rs
@@ -1,6 +1,7 @@
use std::cmp;
use std::vec;

+
use radicle::identity::Project;
use tokio::sync::mpsc::UnboundedSender;

use termion::event::Key;
@@ -143,12 +144,14 @@ impl Render<()> for ListPage {

struct NotificationsProps {
    notifications: Vec<NotificationItem>,
+
    project: Project,
}

impl From<&InboxState> for NotificationsProps {
    fn from(state: &InboxState) -> Self {
        Self {
            notifications: state.notifications.clone(),
+
            project: state.project.clone(),
        }
    }
}
@@ -272,17 +275,8 @@ impl Render<()> for Notifications {
            frame,
            layout[0],
            HeaderProps {
-
                cells: [
-
                    String::from("").into(),
-
                    String::from(" ● ").into(),
-
                    String::from("ID / Name").into(),
-
                    String::from("Summary").into(),
-
                    String::from("Type").into(),
-
                    String::from("Status").into(),
-
                    String::from("Author").into(),
-
                    String::from("Updated").into(),
-
                ],
-
                widths,
+
                cells: [String::from("").into(), self.props.project.name().into()],
+
                widths: [Constraint::Length(0), Constraint::Fill(1)],
                focus,
                cutoff,
                cutoff_after,