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
This commit is contained in:
systemBlue 2026-06-09 12:18:44 +02:00 committed by secana
parent ab393d0237
commit 78c91cd2a9
3 changed files with 17 additions and 15 deletions

View file

@ -144,13 +144,15 @@ struct SearchableOverviewView<Row: View, Detail: View, CreateView: View>: 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")
}
}
}

View file

@ -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

View file

@ -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