Drop the modules/threads tabs; show both as collapsible sidebar groups mirroring the hooks UX: a handful of top picks plus a browse popover for the rest. Default threads to collapsed. Revert the eager re-analysis of persisted modules on attach; keep disassembly analysis lazy and add a per-module Analyze action and status indicator instead. Share one sidebar-row and one browser-popover component across hooks, modules, and threads in both the SwiftUI and GTK frontends.
20 lines
566 B
Swift
20 lines
566 B
Swift
public enum SidebarHighlights {
|
|
public static let defaultLimit = 5
|
|
}
|
|
|
|
extension Array where Element: Identifiable {
|
|
func withSelected(_ selectedID: Element.ID?, from all: [Element], limit: Int) -> [Element] {
|
|
guard let selectedID,
|
|
!contains(where: { $0.id == selectedID }),
|
|
let selected = all.first(where: { $0.id == selectedID })
|
|
else { return self }
|
|
|
|
var result = self
|
|
if result.count >= limit {
|
|
result.removeLast()
|
|
}
|
|
result.append(selected)
|
|
return result
|
|
}
|
|
}
|