update issue detail panel
This commit is contained in:
@@ -21,16 +21,13 @@ use utils::relative_time;
|
|||||||
|
|
||||||
/// Detail panel of a single issue.
|
/// Detail panel of a single issue.
|
||||||
pub struct IssueDetailView {
|
pub struct IssueDetailView {
|
||||||
focus_handle: FocusHandle,
|
|
||||||
/// Repo store holding the issues and their statuses.
|
/// Repo store holding the issues and their statuses.
|
||||||
store: Entity<RepoStore>,
|
store: Entity<RepoStore>,
|
||||||
issue_id: EventId,
|
issue_id: EventId,
|
||||||
|
contents: HashMap<EventId, SharedString>,
|
||||||
/// Input state of the "leave a comment" textarea.
|
/// Input state of the "leave a comment" textarea.
|
||||||
comment_input: Entity<TextareaState>,
|
comment_input: Entity<TextareaState>,
|
||||||
/// Issue/comment bodies as shared strings, keyed by event ID, so
|
focus_handle: FocusHandle,
|
||||||
/// re-renders don't clone full contents again (events are immutable,
|
|
||||||
/// so the cache never needs invalidation).
|
|
||||||
contents: HashMap<EventId, SharedString>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IssueDetailView {
|
impl IssueDetailView {
|
||||||
@@ -283,7 +280,13 @@ impl Render for IssueDetailView {
|
|||||||
let content = self
|
let content = self
|
||||||
.contents
|
.contents
|
||||||
.entry(issue.id)
|
.entry(issue.id)
|
||||||
.or_insert_with(|| SharedString::from(issue.content.clone()))
|
.or_insert_with(|| {
|
||||||
|
if issue.content.is_empty() {
|
||||||
|
SharedString::from("No description provided.")
|
||||||
|
} else {
|
||||||
|
SharedString::from(&issue.content)
|
||||||
|
}
|
||||||
|
})
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
(
|
(
|
||||||
@@ -338,8 +341,7 @@ impl Render for IssueDetailView {
|
|||||||
h_flex()
|
h_flex()
|
||||||
.gap_1()
|
.gap_1()
|
||||||
.child(
|
.child(
|
||||||
UserAvatar::new(author.clone())
|
UserAvatar::new(&author).picture(picture),
|
||||||
.picture(picture),
|
|
||||||
)
|
)
|
||||||
.child(author),
|
.child(author),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user