This commit is contained in:
2026-09-13 11:54:37 +07:00
parent d68c098818
commit a4dcbbc560
7 changed files with 719 additions and 267 deletions
+13 -4
View File
@@ -1,8 +1,8 @@
use dock::{BasePanel, Panel, PanelEvent};
use gpui::prelude::*;
use gpui::{
App, Context, Entity, EventEmitter, FocusHandle, Focusable, Render, SharedString, Window, div,
relative,
App, Context, Entity, EventEmitter, FocusHandle, Focusable, Render, SharedString, Subscription,
Window, div, relative,
};
use gpui_component::input::TextareaState;
use gpui_component::scroll::ScrollableElement;
@@ -17,12 +17,13 @@ use crate::views::repo::helpers::{comment_form, comments_section, issue_roots, s
/// Detail panel of a single issue.
pub struct IssueDetailView {
focus_handle: FocusHandle,
/// Repo store holding the issues and their statuses.
store: Entity<RepoStore>,
issue_id: EventId,
/// Input state of the comment textarea.
comment_input: Entity<TextareaState>,
focus_handle: FocusHandle,
_subscription: Subscription,
}
impl IssueDetailView {
@@ -35,11 +36,14 @@ impl IssueDetailView {
let comment_input =
cx.new(|cx| TextareaState::new(window, cx).placeholder("Leave a comment..."));
let subscription = cx.observe(&store, |_this, _store, cx| cx.notify());
Self {
focus_handle: cx.focus_handle(),
store,
issue_id,
comment_input,
_subscription: subscription,
}
}
}
@@ -81,7 +85,12 @@ impl Render for IssueDetailView {
let store = self.store.read(cx);
let Some(issue) = store.issues.iter().find(|issue| issue.id == self.issue_id) else {
return placeholder("Issue not found", cx);
// The store has not applied its first pass yet, the issue may still arrive.
return if store.loaded {
placeholder("Issue not found", cx)
} else {
placeholder("Loading issue...", cx)
};
};
let (title, author, picture, status, age, issue_id, content) = {