feat(ui): group factory rigs by category in the rig sidebar

The rig-library sidebar now presents shipped starter rigs under their
FactoryRigCategory headers (Shoegaze Walls, Dreampop, Classic, Ambient,
Experimental) in fixed catalog order, with the user's own rigs under a
"My Rigs" header. Starter rows show a "Starter rig" subtitle and are not
reorderable; user rows keep drag-to-reorder and Move Up/Down (now scoped to
the user's own rigs). Grouping is presentational, so it stays correct
regardless of underlying library order.

Adds FactoryRigLibrary.category(for:) and rigs(in:) with tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-09 13:53:56 -07:00
parent 2c970aa344
commit fba32ff0aa
3 changed files with 139 additions and 36 deletions
@@ -85,6 +85,22 @@ public enum FactoryRigLibrary {
factoryIDs.contains(id)
}
/// The ``FactoryRigCategory`` of the shipped rig with this id, or `nil` for a user rig.
///
/// - Parameter id: A ``RigEntry/id`` from the rig library.
/// - Returns: The rig's category, or `nil` if `id` is not a factory rig.
public static func category(for id: UUID) -> FactoryRigCategory? {
all.first(where: { $0.id == id })?.category
}
/// The shipped rigs of a given category, in catalog order.
///
/// - Parameter category: The category to filter by.
/// - Returns: The `FactoryRig`s in `category`, in the order they appear in ``all``.
public static func rigs(in category: FactoryRigCategory) -> [FactoryRig] {
all.filter { $0.category == category }
}
/// Every built-in rig, in the order a picker should present them.
public static let all: [FactoryRig] = [
glideWall,