update
This commit is contained in:
@@ -262,7 +262,7 @@ impl RepoDetailView {
|
||||
.selectable(true)
|
||||
.scrollable(true)
|
||||
.p_4()
|
||||
.text_xs()
|
||||
.text_sm()
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ impl RepoDetailView {
|
||||
.bordered(false)
|
||||
.rounded_none()
|
||||
.h_full()
|
||||
.text_xs()
|
||||
.text_sm()
|
||||
.into_any_element()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ use gpui_component::{
|
||||
use signed_git::{CommitDiff, DiffHunk, DiffLine, DiffLineKind, DiffStatus, FileCommit, FileDiff};
|
||||
use utils::relative_time_secs;
|
||||
|
||||
use super::helpers::{build_tree_items, placeholder, track, tree_items, tree_row};
|
||||
use super::helpers::{build_tree_items, placeholder, tree_items, tree_row};
|
||||
|
||||
/// Width of the changed-files column.
|
||||
const TREE_WIDTH: f32 = 260.;
|
||||
@@ -181,7 +181,7 @@ impl CommitDiffView {
|
||||
Ok(())
|
||||
});
|
||||
|
||||
track(&mut self.tasks, task);
|
||||
self.tasks.push(task);
|
||||
}
|
||||
|
||||
/// Show the diff of the file at `path` (selected in the tree).
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
use std::collections::HashMap;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use anyhow::Error;
|
||||
use assets::CustomIconName;
|
||||
use gpui::prelude::*;
|
||||
use gpui::{AnyElement, App, Task, Window, div, px};
|
||||
use gpui::{AnyElement, App, Window, div, px};
|
||||
use gpui_component::list::ListItem;
|
||||
use gpui_component::tooltip::Tooltip;
|
||||
use gpui_component::tree::{TreeEntry, TreeItem};
|
||||
@@ -89,13 +88,6 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
/// Track `task` until it completes; finished tasks are pruned on every push
|
||||
/// so the vec stays bounded by the number of in-flight loads.
|
||||
pub(super) fn track(tasks: &mut Vec<Task<Result<(), Error>>>, task: Task<Result<(), Error>>) {
|
||||
tasks.retain(|task| !task.is_ready());
|
||||
tasks.push(task);
|
||||
}
|
||||
|
||||
/// Build nested tree items from a flat, sorted (dirs-first) entry list.
|
||||
///
|
||||
/// Returns [`TreeItemSeed`]s so the build can run off the main thread; a
|
||||
@@ -238,8 +230,8 @@ pub(super) fn status_badge(status: RepoStatus, cx: &App) -> AnyElement {
|
||||
CustomIconName::GitIssueOpen,
|
||||
"open",
|
||||
"Issue is open",
|
||||
cx.theme().secondary,
|
||||
cx.theme().secondary_foreground,
|
||||
cx.theme().primary,
|
||||
cx.theme().primary_foreground,
|
||||
),
|
||||
RepoStatus::Closed => (
|
||||
CustomIconName::GitIssueClosed,
|
||||
@@ -259,8 +251,8 @@ pub(super) fn status_badge(status: RepoStatus, cx: &App) -> AnyElement {
|
||||
CustomIconName::GitIssueOpen,
|
||||
"applied",
|
||||
"Issue is completed",
|
||||
cx.theme().primary,
|
||||
cx.theme().primary_foreground,
|
||||
cx.theme().secondary,
|
||||
cx.theme().secondary_foreground,
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
@@ -216,6 +216,7 @@ impl IssuesView {
|
||||
.gap_3()
|
||||
.border_b_1()
|
||||
.border_color(cx.theme().border)
|
||||
.bg(cx.theme().muted.opacity(0.5))
|
||||
.child(
|
||||
h_flex()
|
||||
.h_12()
|
||||
|
||||
@@ -42,7 +42,7 @@ use browser::{
|
||||
};
|
||||
use commits::COMMIT_ROW_HEIGHT;
|
||||
use diff::CommitDiffView;
|
||||
use helpers::{TreeItemSeed, build_tree_items, is_markdown_path, track, tree_items};
|
||||
use helpers::{TreeItemSeed, build_tree_items, is_markdown_path, tree_items};
|
||||
use issues::IssuesView;
|
||||
use pull_requests::PullRequestsView;
|
||||
|
||||
@@ -350,7 +350,7 @@ impl RepoDetailView {
|
||||
Ok(())
|
||||
});
|
||||
|
||||
track(&mut self.tasks, task);
|
||||
self.tasks.push(task);
|
||||
}
|
||||
|
||||
/// Apply the loaded repository data: explorer tree, README preview, ref
|
||||
@@ -522,7 +522,7 @@ impl RepoDetailView {
|
||||
Ok(())
|
||||
});
|
||||
|
||||
track(&mut self.tasks, task);
|
||||
self.tasks.push(task);
|
||||
}
|
||||
|
||||
/// Queue `path` for the per-file commit query; requests are batched into
|
||||
@@ -588,7 +588,7 @@ impl RepoDetailView {
|
||||
Ok(())
|
||||
});
|
||||
|
||||
track(&mut self.tasks, task);
|
||||
self.tasks.push(task);
|
||||
}
|
||||
|
||||
/// Walk all commits reachable from HEAD on a background task, for the
|
||||
@@ -630,7 +630,7 @@ impl RepoDetailView {
|
||||
Ok(())
|
||||
});
|
||||
|
||||
track(&mut self.tasks, task);
|
||||
self.tasks.push(task);
|
||||
}
|
||||
|
||||
/// Open a new panel showing the diff of `commit_id` (all files it
|
||||
@@ -683,8 +683,15 @@ impl RepoDetailView {
|
||||
return;
|
||||
};
|
||||
|
||||
let panel = cx
|
||||
.new(|cx| PullRequestsView::new(self.store.clone(), self.display_name(cx), window, cx));
|
||||
let panel = cx.new(|cx| {
|
||||
PullRequestsView::new(
|
||||
self.dock_area.clone(),
|
||||
self.store.clone(),
|
||||
self.display_name(cx),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
});
|
||||
|
||||
dock_area.update(cx, |dock_area, cx| {
|
||||
dock_area.add_panel(Arc::new(panel), DockPlacement::Center, window, cx);
|
||||
@@ -760,7 +767,7 @@ impl RepoDetailView {
|
||||
Ok(())
|
||||
});
|
||||
|
||||
track(&mut self.tasks, task);
|
||||
self.tasks.push(task);
|
||||
}
|
||||
|
||||
/// Restore a selector to `previous`, or clear it (after a failed switch).
|
||||
@@ -884,7 +891,7 @@ impl RepoDetailView {
|
||||
Ok(())
|
||||
});
|
||||
|
||||
track(&mut self.tasks, task);
|
||||
self.tasks.push(task);
|
||||
}
|
||||
|
||||
/// Drop the oldest previews beyond the cache caps, keeping the currently
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
//! Pull requests panel: a bottom panel listing every pull request of the
|
||||
//! repository with its title, event id, author, age and status, filterable
|
||||
//! by status via the header's All/Open/Closed/Draft/Merged filter.
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use assets::CustomIconName;
|
||||
use dock::{DockArea, Panel, PanelEvent};
|
||||
use gpui::prelude::*;
|
||||
use gpui::{
|
||||
AnyElement, App, Context, Entity, EventEmitter, FocusHandle, Focusable, Pixels, Render,
|
||||
SharedString, Size, Window, div, px, size,
|
||||
SharedString, Size, WeakEntity, Window, div, px, relative, size,
|
||||
};
|
||||
use gpui_base::Button as BaseButton;
|
||||
use gpui_component::avatar::Avatar;
|
||||
use gpui_component::button::{Button, ButtonVariants};
|
||||
use gpui_component::dialog::{DialogDescription, DialogFooter, DialogHeader, DialogTitle};
|
||||
use dock::{Panel, PanelEvent};
|
||||
use gpui_component::form::{field, v_form};
|
||||
use gpui_component::input::{Input, InputState, Textarea, TextareaState};
|
||||
use gpui_component::scroll::Scrollbar;
|
||||
use gpui_component::tooltip::Tooltip;
|
||||
use gpui_component::{
|
||||
ActiveTheme, Icon, IconName, Selectable, Sizable, StyledExt, VirtualListScrollHandle,
|
||||
WindowExt, h_flex, v_flex, v_virtual_list,
|
||||
ActiveTheme, Icon, Sizable, VirtualListScrollHandle, WindowExt, h_flex, v_flex, v_virtual_list,
|
||||
};
|
||||
use nostr::prelude::{Event, Kind};
|
||||
use nostr::prelude::{Event, EventId, Kind};
|
||||
use signed_core::{RepoStatus, activity_subject};
|
||||
use signed_state::{ProfileStore, RepoStore};
|
||||
use utils::relative_time;
|
||||
|
||||
use super::helpers::placeholder;
|
||||
use super::helpers::{placeholder, status_badge};
|
||||
|
||||
/// Height of one pull request row in the virtual list: same layout as an
|
||||
/// issue row (12px padding on top and bottom, a 14px title line and a 24px
|
||||
/// meta line), so the row totals ~71px.
|
||||
const PR_ROW_HEIGHT: f32 = 71.;
|
||||
/// issue row (8px vertical padding (`py_2`) on top and bottom, a 32px title
|
||||
/// line (`h_8`) and a 24px meta line (`h_6`), plus the 1px bottom border),
|
||||
/// so the row totals 73px. The status badge (`size_7`, 28px) is shorter
|
||||
/// than the content.
|
||||
const PR_ROW_HEIGHT: f32 = 73.;
|
||||
|
||||
/// Status filter of the pull request list, chosen via the header's filter
|
||||
/// buttons.
|
||||
@@ -66,6 +63,8 @@ impl PullRequestFilter {
|
||||
|
||||
pub struct PullRequestsView {
|
||||
focus_handle: FocusHandle,
|
||||
/// Dock area the detail panels are added to.
|
||||
dock_area: WeakEntity<DockArea>,
|
||||
/// Repo store holding the pull requests and their statuses.
|
||||
store: Entity<RepoStore>,
|
||||
/// Display name of the repository, for the panel title.
|
||||
@@ -88,6 +87,7 @@ pub struct PullRequestsView {
|
||||
|
||||
impl PullRequestsView {
|
||||
pub fn new(
|
||||
dock_area: WeakEntity<DockArea>,
|
||||
store: Entity<RepoStore>,
|
||||
repo_name: SharedString,
|
||||
window: &mut Window,
|
||||
@@ -99,6 +99,7 @@ impl PullRequestsView {
|
||||
|
||||
Self {
|
||||
focus_handle: cx.focus_handle(),
|
||||
dock_area,
|
||||
store,
|
||||
repo_name,
|
||||
filter: PullRequestFilter::Open,
|
||||
@@ -109,7 +110,23 @@ impl PullRequestsView {
|
||||
}
|
||||
}
|
||||
|
||||
fn render_row(&self, ix: usize, pr: &Event, cx: &App) -> AnyElement {
|
||||
/// Open the detail panel of `pr_id` at the bottom of the dock area.
|
||||
fn open_pull_request_detail(
|
||||
&mut self,
|
||||
pr_id: EventId,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let Some(dock_area) = self.dock_area.upgrade() else {
|
||||
return;
|
||||
};
|
||||
// TODO
|
||||
}
|
||||
|
||||
/// Render one row of the pull request list; `ix` is the row index and
|
||||
/// `pr_ix` the index of the pull request in the store's `pull_requests`.
|
||||
fn render_row(&self, ix: usize, pr_ix: usize, cx: &mut Context<Self>) -> AnyElement {
|
||||
let pr = &self.store.read(cx).pull_requests[pr_ix];
|
||||
let title = activity_subject(pr);
|
||||
let id_hex = pr.id.to_hex();
|
||||
let profile = ProfileStore::global(cx).read(cx).get(&pr.pubkey);
|
||||
@@ -117,22 +134,27 @@ impl PullRequestsView {
|
||||
let picture = profile.picture();
|
||||
let age = relative_time(pr.created_at);
|
||||
let status = self.store.read(cx).status_of(pr);
|
||||
let pr_id = pr.id;
|
||||
|
||||
h_flex()
|
||||
.id(ix)
|
||||
.h(px(PR_ROW_HEIGHT))
|
||||
.w_full()
|
||||
.gap_4()
|
||||
.p_3()
|
||||
.px_4()
|
||||
.py_2()
|
||||
.border_b_1()
|
||||
.border_color(cx.theme().border)
|
||||
.items_start()
|
||||
.child(Self::render_status(status, cx))
|
||||
.on_click(cx.listener(move |this, _event, window, cx| {
|
||||
this.open_pull_request_detail(pr_id, window, cx);
|
||||
}))
|
||||
.child(status_badge(status, cx))
|
||||
.child(
|
||||
v_flex()
|
||||
.flex_1()
|
||||
.child(
|
||||
div()
|
||||
.h_8()
|
||||
.min_w_0()
|
||||
.text_ellipsis()
|
||||
.whitespace_nowrap()
|
||||
@@ -142,6 +164,7 @@ impl PullRequestsView {
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.h_6()
|
||||
.gap_2()
|
||||
.text_xs()
|
||||
.child(
|
||||
@@ -151,7 +174,7 @@ impl PullRequestsView {
|
||||
Avatar::new()
|
||||
.name(author.clone())
|
||||
.when_some(picture, |this, url| this.src(url))
|
||||
.xsmall(),
|
||||
.small(),
|
||||
)
|
||||
.child(div().child(author)),
|
||||
)
|
||||
@@ -161,126 +184,211 @@ impl PullRequestsView {
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.child(SharedString::from(&id_hex[..8])),
|
||||
)
|
||||
.child(div().child(age)),
|
||||
.child(SharedString::from(age)),
|
||||
),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn render_status(status: RepoStatus, cx: &App) -> AnyElement {
|
||||
let (icon, label, tooltip, bg, fg) = match status {
|
||||
RepoStatus::Open => (
|
||||
CustomIconName::GitPullRequest,
|
||||
"open",
|
||||
"Pull request is open",
|
||||
cx.theme().secondary,
|
||||
cx.theme().secondary_foreground,
|
||||
),
|
||||
RepoStatus::Closed => (
|
||||
CustomIconName::GitPullRequestClosed,
|
||||
"closed",
|
||||
"Pull request is closed",
|
||||
cx.theme().warning,
|
||||
cx.theme().warning_foreground,
|
||||
),
|
||||
RepoStatus::Draft => (
|
||||
CustomIconName::GitPullRequestDraft,
|
||||
"draft",
|
||||
"Pull request is a draft",
|
||||
cx.theme().accent,
|
||||
cx.theme().accent_foreground,
|
||||
),
|
||||
RepoStatus::Applied => (
|
||||
CustomIconName::GitPullRequestMerged,
|
||||
"merged",
|
||||
"Pull request is merged",
|
||||
cx.theme().primary,
|
||||
cx.theme().primary_foreground,
|
||||
),
|
||||
};
|
||||
|
||||
v_flex()
|
||||
.id(label)
|
||||
.flex_shrink_0()
|
||||
.size_6()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.rounded(cx.theme().radius)
|
||||
.bg(bg)
|
||||
.child(Icon::new(icon).xsmall().text_color(fg))
|
||||
.tooltip(move |window, cx| Tooltip::new(tooltip).build(window, cx))
|
||||
.hover(|this| this.bg(cx.theme().list_hover))
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn render_header(&self, cx: &mut Context<Self>) -> AnyElement {
|
||||
let store = self.store.read(cx);
|
||||
let (total, open, closed, draft, merged) = store.pull_requests.iter().fold(
|
||||
(0usize, 0usize, 0usize, 0usize, 0usize),
|
||||
|(total, open, closed, draft, merged), pr| match store.status_of(pr) {
|
||||
RepoStatus::Open => (total + 1, open + 1, closed, draft, merged),
|
||||
RepoStatus::Closed => (total + 1, open, closed + 1, draft, merged),
|
||||
RepoStatus::Draft => (total + 1, open, closed, draft + 1, merged),
|
||||
RepoStatus::Applied => (total + 1, open, closed, draft, merged + 1),
|
||||
},
|
||||
);
|
||||
|
||||
h_flex()
|
||||
.px_4()
|
||||
.w_full()
|
||||
.items_center()
|
||||
.gap_3()
|
||||
.px_3()
|
||||
.pb_2()
|
||||
.border_b_1()
|
||||
.border_color(cx.theme().border)
|
||||
.child(
|
||||
div()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.font_semibold()
|
||||
.child("Pull Requests"),
|
||||
)
|
||||
.bg(cx.theme().muted.opacity(0.5))
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_1()
|
||||
.h_12()
|
||||
.gap_2()
|
||||
.child(
|
||||
Button::new("all")
|
||||
.icon(CustomIconName::GitPullRequest)
|
||||
.label("All")
|
||||
.ghost()
|
||||
BaseButton::new("all")
|
||||
.flex()
|
||||
.items_center()
|
||||
.h_7()
|
||||
.px_2()
|
||||
.gap_1()
|
||||
.child(Icon::new(CustomIconName::GitPullRequest))
|
||||
.child(div().text_sm().child("All"))
|
||||
.child(
|
||||
h_flex()
|
||||
.justify_center()
|
||||
.ml_2()
|
||||
.px_1()
|
||||
.py_0p5()
|
||||
.min_w_4()
|
||||
.text_size(px(8.))
|
||||
.bg(cx.theme().muted)
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.rounded(cx.theme().radius)
|
||||
.line_height(relative(1.))
|
||||
.child(SharedString::from(total.to_string())),
|
||||
)
|
||||
.text_color(cx.theme().button_foreground)
|
||||
.rounded(cx.theme().radius)
|
||||
.hover(|this| this.bg(cx.theme().button_hover))
|
||||
.active(|this| this.bg(cx.theme().button_active))
|
||||
.selected(self.filter == PullRequestFilter::All)
|
||||
.when(self.filter == PullRequestFilter::All, |this| {
|
||||
this.bg(cx.theme().button_active)
|
||||
})
|
||||
.on_click(cx.listener(|this, _event, _window, cx| {
|
||||
this.filter = PullRequestFilter::All;
|
||||
cx.notify();
|
||||
})),
|
||||
)
|
||||
.child(
|
||||
Button::new("open")
|
||||
.icon(CustomIconName::GitPullRequest)
|
||||
.label("Open")
|
||||
.ghost()
|
||||
BaseButton::new("open")
|
||||
.flex()
|
||||
.items_center()
|
||||
.h_7()
|
||||
.px_2()
|
||||
.gap_1()
|
||||
.child(Icon::new(CustomIconName::GitPullRequest))
|
||||
.child(div().text_sm().child("Open"))
|
||||
.child(
|
||||
h_flex()
|
||||
.justify_center()
|
||||
.ml_2()
|
||||
.px_1()
|
||||
.py_0p5()
|
||||
.min_w_4()
|
||||
.text_size(px(8.))
|
||||
.bg(cx.theme().muted)
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.rounded(cx.theme().radius)
|
||||
.line_height(relative(1.))
|
||||
.child(SharedString::from(open.to_string())),
|
||||
)
|
||||
.text_color(cx.theme().button_foreground)
|
||||
.rounded(cx.theme().radius)
|
||||
.hover(|this| this.bg(cx.theme().button_hover))
|
||||
.active(|this| this.bg(cx.theme().button_active))
|
||||
.selected(self.filter == PullRequestFilter::Open)
|
||||
.when(self.filter == PullRequestFilter::Open, |this| {
|
||||
this.bg(cx.theme().button_active)
|
||||
})
|
||||
.on_click(cx.listener(|this, _event, _window, cx| {
|
||||
this.filter = PullRequestFilter::Open;
|
||||
cx.notify();
|
||||
})),
|
||||
)
|
||||
.child(
|
||||
Button::new("closed")
|
||||
.icon(CustomIconName::GitPullRequestClosed)
|
||||
.label("Closed")
|
||||
.ghost()
|
||||
BaseButton::new("closed")
|
||||
.flex()
|
||||
.items_center()
|
||||
.h_7()
|
||||
.px_2()
|
||||
.gap_1()
|
||||
.child(Icon::new(CustomIconName::GitPullRequestClosed))
|
||||
.child(div().text_sm().child("Closed"))
|
||||
.child(
|
||||
h_flex()
|
||||
.justify_center()
|
||||
.ml_2()
|
||||
.px_1()
|
||||
.py_0p5()
|
||||
.min_w_4()
|
||||
.text_size(px(8.))
|
||||
.bg(cx.theme().muted)
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.rounded(cx.theme().radius)
|
||||
.line_height(relative(1.))
|
||||
.child(SharedString::from(closed.to_string())),
|
||||
)
|
||||
.text_color(cx.theme().button_foreground)
|
||||
.rounded(cx.theme().radius)
|
||||
.hover(|this| this.bg(cx.theme().button_hover))
|
||||
.active(|this| this.bg(cx.theme().button_active))
|
||||
.selected(self.filter == PullRequestFilter::Closed)
|
||||
.when(self.filter == PullRequestFilter::Closed, |this| {
|
||||
this.bg(cx.theme().button_active)
|
||||
})
|
||||
.on_click(cx.listener(|this, _event, _window, cx| {
|
||||
this.filter = PullRequestFilter::Closed;
|
||||
cx.notify();
|
||||
})),
|
||||
)
|
||||
.child(
|
||||
Button::new("draft")
|
||||
.icon(CustomIconName::GitPullRequestDraft)
|
||||
.label("Draft")
|
||||
.ghost()
|
||||
BaseButton::new("draft")
|
||||
.flex()
|
||||
.items_center()
|
||||
.h_7()
|
||||
.px_2()
|
||||
.gap_1()
|
||||
.child(Icon::new(CustomIconName::GitPullRequestDraft))
|
||||
.child(div().text_sm().child("Draft"))
|
||||
.child(
|
||||
h_flex()
|
||||
.justify_center()
|
||||
.ml_2()
|
||||
.px_1()
|
||||
.py_0p5()
|
||||
.min_w_4()
|
||||
.text_size(px(8.))
|
||||
.bg(cx.theme().muted)
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.rounded(cx.theme().radius)
|
||||
.line_height(relative(1.))
|
||||
.child(SharedString::from(draft.to_string())),
|
||||
)
|
||||
.text_color(cx.theme().button_foreground)
|
||||
.rounded(cx.theme().radius)
|
||||
.hover(|this| this.bg(cx.theme().button_hover))
|
||||
.active(|this| this.bg(cx.theme().button_active))
|
||||
.selected(self.filter == PullRequestFilter::Draft)
|
||||
.when(self.filter == PullRequestFilter::Draft, |this| {
|
||||
this.bg(cx.theme().button_active)
|
||||
})
|
||||
.on_click(cx.listener(|this, _event, _window, cx| {
|
||||
this.filter = PullRequestFilter::Draft;
|
||||
cx.notify();
|
||||
})),
|
||||
)
|
||||
.child(
|
||||
Button::new("merged")
|
||||
.icon(CustomIconName::GitPullRequestMerged)
|
||||
.label("Merged")
|
||||
.ghost()
|
||||
BaseButton::new("merged")
|
||||
.flex()
|
||||
.items_center()
|
||||
.h_7()
|
||||
.px_2()
|
||||
.gap_1()
|
||||
.child(Icon::new(CustomIconName::GitPullRequestMerged))
|
||||
.child(div().text_sm().child("Merged"))
|
||||
.child(
|
||||
h_flex()
|
||||
.justify_center()
|
||||
.ml_2()
|
||||
.px_1()
|
||||
.py_0p5()
|
||||
.min_w_4()
|
||||
.text_size(px(8.))
|
||||
.bg(cx.theme().muted)
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.rounded(cx.theme().radius)
|
||||
.line_height(relative(1.))
|
||||
.child(SharedString::from(merged.to_string())),
|
||||
)
|
||||
.text_color(cx.theme().button_foreground)
|
||||
.rounded(cx.theme().radius)
|
||||
.hover(|this| this.bg(cx.theme().button_hover))
|
||||
.active(|this| this.bg(cx.theme().button_active))
|
||||
.selected(self.filter == PullRequestFilter::Merged)
|
||||
.when(self.filter == PullRequestFilter::Merged, |this| {
|
||||
this.bg(cx.theme().button_active)
|
||||
})
|
||||
.on_click(cx.listener(|this, _event, _window, cx| {
|
||||
this.filter = PullRequestFilter::Merged;
|
||||
cx.notify();
|
||||
@@ -290,10 +398,19 @@ impl PullRequestsView {
|
||||
// Spacer: pushes the button to the right edge.
|
||||
.child(div().flex_1())
|
||||
.child(
|
||||
Button::new("new-pr")
|
||||
.icon(IconName::Plus)
|
||||
.label("New pull request")
|
||||
.primary()
|
||||
BaseButton::new("new-pr")
|
||||
.flex()
|
||||
.items_center()
|
||||
.h_7()
|
||||
.px_2()
|
||||
.gap_1()
|
||||
.child(Icon::new(CustomIconName::CirclePlus))
|
||||
.child(div().text_sm().child("New pull request"))
|
||||
.text_color(cx.theme().button_primary_foreground)
|
||||
.rounded(cx.theme().radius)
|
||||
.bg(cx.theme().button_primary)
|
||||
.hover(|this| this.bg(cx.theme().button_primary_hover))
|
||||
.active(|this| this.bg(cx.theme().button_primary_active))
|
||||
.on_click(cx.listener(|this, _event, window, cx| {
|
||||
open_new_pull_request_dialog(this.store.clone(), window, cx);
|
||||
})),
|
||||
@@ -433,11 +550,10 @@ impl Render for PullRequestsView {
|
||||
.when(count > 0, |this| {
|
||||
this.child(
|
||||
v_virtual_list(view, "prl", sizes, move |this, range, _window, cx| {
|
||||
let prs = &this.store.read(cx).pull_requests;
|
||||
range
|
||||
.map(|ix| {
|
||||
let pr_ix = this.visible_prs[ix];
|
||||
this.render_row(pr_ix, &prs[pr_ix], cx)
|
||||
this.render_row(ix, pr_ix, cx)
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user