mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-10-31 17:00:50 +08:00
inbox: Adjust table header
This commit is contained in:
@@ -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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user