From 78c91cd2a9066460a3a3ed5233d9ad9059c12e77 Mon Sep 17 00:00:00 2001 From: systemBlue Date: Tue, 9 Jun 2026 12:18:44 +0200 Subject: [PATCH] feat: show the overview filter summary only when filters are active (#60) ## What The Issues and Pull Requests overviews pinned a centered filter-summary caption ("Open") below the title even in the default state, which just duplicated the filter icon. Now the summary appears only when a non-default state or involvement scope is active, so the default view carries no extra chrome and the strip becomes a clear signal that the list is filtered. Verified in the iPhone 17 Pro simulator: default state shows no strip and no gap, and the filter icon still reflects state. Builds clean on Xcode 26, SwiftLint passes. --- I grant Stefan Hausotte an irrevocable, worldwide, royalty-free license to use, sublicense, and distribute my contribution, including through Apple's App Store under the project's App Store exception. Reviewed-on: https://codeberg.org/secana/Forji/pulls/60 --- Forji/Forji/Views/SearchableOverviewView.swift | 16 +++++++++------- Forji/ForjiUITests/IssueUITests.swift | 8 ++++---- Forji/ForjiUITests/PullRequestUITests.swift | 8 ++++---- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Forji/Forji/Views/SearchableOverviewView.swift b/Forji/Forji/Views/SearchableOverviewView.swift index 7f23960..e912f30 100644 --- a/Forji/Forji/Views/SearchableOverviewView.swift +++ b/Forji/Forji/Views/SearchableOverviewView.swift @@ -144,13 +144,15 @@ struct SearchableOverviewView: View { } .listStyle(.insetGrouped) .safeAreaInset(edge: .top) { - Text(filterSummaryText) - .font(.caption) - .foregroundStyle(.secondary) - .frame(maxWidth: .infinity) - .padding(.horizontal) - .padding(.vertical, 6) - .accessibilityIdentifier("filter-summary") + if hasNonDefaultFilters { + Text(filterSummaryText) + .font(.caption) + .foregroundStyle(.secondary) + .frame(maxWidth: .infinity) + .padding(.horizontal) + .padding(.vertical, 6) + .accessibilityIdentifier("filter-summary") + } } } diff --git a/Forji/ForjiUITests/IssueUITests.swift b/Forji/ForjiUITests/IssueUITests.swift index 29ffd33..3beb4f5 100644 --- a/Forji/ForjiUITests/IssueUITests.swift +++ b/Forji/ForjiUITests/IssueUITests.swift @@ -37,17 +37,17 @@ final class IssueUITests: ForgejoReadOnlyUITestBase { // Wait for list to load XCTAssertTrue(app.cells.firstMatch.waitForExistence(timeout: 10), "Issues should load") - // Default filter summary should show "Open" (default scope is All involvement) + // In the default state (Open + All involvement) the summary is hidden. let filterSummary = app.staticTexts["filter-summary"] - XCTAssertTrue(filterSummary.waitForExistence(timeout: 5)) - XCTAssertEqual(filterSummary.label, "Open") + XCTAssertFalse(filterSummary.exists, "Filter summary should be hidden in the default state") let filterMenuButton = app.buttons["filter-menu-button"] - // Tap "Assigned to you" via filter menu + // Selecting a non-default scope reveals the summary. filterMenuButton.tap() app.buttons["Assigned to you"].tap() sleep(2) + XCTAssertTrue(filterSummary.waitForExistence(timeout: 5)) XCTAssertTrue(filterSummary.label.contains("Assigned to you")) // Tap "Mentioned" via filter menu diff --git a/Forji/ForjiUITests/PullRequestUITests.swift b/Forji/ForjiUITests/PullRequestUITests.swift index b9d727f..7e2b82f 100644 --- a/Forji/ForjiUITests/PullRequestUITests.swift +++ b/Forji/ForjiUITests/PullRequestUITests.swift @@ -111,17 +111,17 @@ final class PullRequestUITests: ForgejoReadOnlyUITestBase { // Reset filters to defaults (previous test may have changed them) resetOverviewFilters() - // Default filter summary should show "Open" (default scope is All involvement) + // In the default state (Open + All involvement) the summary is hidden. let filterSummary = app.staticTexts["filter-summary"] - XCTAssertTrue(filterSummary.waitForExistence(timeout: 5)) - XCTAssertEqual(filterSummary.label, "Open") + XCTAssertFalse(filterSummary.exists, "Filter summary should be hidden in the default state") let filterMenuButton = app.buttons["filter-menu-button"] - // Tap "Assigned to you" via filter menu + // Selecting a non-default scope reveals the summary. filterMenuButton.tap() app.buttons["Assigned to you"].tap() sleep(2) + XCTAssertTrue(filterSummary.waitForExistence(timeout: 5)) XCTAssertTrue(filterSummary.label.contains("Assigned to you")) // Tap "Mentioned" via filter menu