Skip to content

Commit e8d51de

Browse files
committed
Updates empty state for branch sections
1 parent 306ce04 commit e8d51de

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/webviews/apps/plus/home/components/branch-section.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,10 @@ export class GlBranchSection extends LitElement {
5858
@property({ type: Boolean }) isFetching = false;
5959

6060
private renderSectionLabel() {
61-
if (this.isFetching) {
61+
if (this.isFetching || this.branches.length === 0) {
6262
return this.label;
6363
}
64-
if (!this.branches.length) {
65-
return `No ${this.label} branches`;
66-
}
64+
6765
return `${this.label} (${this.branches.length})`;
6866
}
6967

@@ -75,6 +73,14 @@ export class GlBranchSection extends LitElement {
7573
${this.branches.map(
7674
branch => html`<gl-branch-card .repo=${this.repo} .branch=${branch}></gl-branch-card>`,
7775
)}
76+
${when(
77+
this.branches.length > 0,
78+
() =>
79+
this.branches.map(
80+
branch => html`<gl-branch-card .repo=${this.repo} .branch=${branch}></gl-branch-card>`,
81+
),
82+
() => html`<p>No ${this.label} branches</p>`,
83+
)}
7884
</gl-section>
7985
`;
8086
}

src/webviews/apps/plus/home/components/overview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class GlOverview extends SignalWatcher(LitElement) {
9696
const { repository } = overview;
9797
return html`
9898
<gl-branch-section
99-
label="Recent"
99+
label="recent"
100100
.isFetching=${isFetching}
101101
.repo=${repository.path}
102102
.branches=${repository.branches.recent}
@@ -120,7 +120,7 @@ export class GlOverview extends SignalWatcher(LitElement) {
120120
this._overviewState.filter.stale?.show === true,
121121
() => html`
122122
<gl-branch-section
123-
label="Stale"
123+
label="stale"
124124
.repo=${repository.path}
125125
.branches=${repository.branches.stale}
126126
></gl-branch-section>

0 commit comments

Comments
 (0)