feat(dashboard): role-specific tile filtering + server module order (E11.S03)#15
Open
abdout wants to merge 1 commit into
Open
feat(dashboard): role-specific tile filtering + server module order (E11.S03)#15abdout wants to merge 1 commit into
abdout wants to merge 1 commit into
Conversation
…E11.S03)
Every role used to see every home-grid tile. STUDENT saw the Students
admin roster + Assignments marking + AtomStudio dev tool; GUARDIAN saw
roster + dev tools; ADMIN saw the dev-only AtomStudio. AC requires
mirroring the hogwarts platform-sidebar matrix.
Introduces two small dashboard-local primitives:
- `HomeTileId`: stable enum identifier per tile + `serverName` that
mirrors the hogwarts module taxonomy
(src/components/template/platform-sidebar/config.ts).
- `HomeTileVisibility`: Map<UserRole, Set<HomeTileId>> honouring the AC
matrix:
STUDENT - own academics + comms + profile
TEACHER - same + Students roster + Assignments, - Fees
GUARDIAN - child-scoped views + payments + comms (no roster /
marking / dev tools)
ADMIN - all - AtomStudio
SUPER_ADMIN - all (= server DEVELOPER)
- `List<HomeTileSpec>.filterAndOrderForRole(role, enabledModules)`:
extension that (1) drops tiles the role can't see, then (2) reorders
visible tiles by the server `enabledModules` manifest (case-insensitive
against `HomeTileId.serverName`). Unknown / unlisted tiles keep their
default `buildHomeTiles` order. Empty manifest = role-default order
preserved, so the dashboard stays usable before E08.S06 server work
ships.
Wiring:
- `HomeTileSpec` gains `id: HomeTileId`; all 17 tile definitions carry
their identifier.
- `buildHomeTiles` ends with `.filterAndOrderForRole(state.userRole,
state.enabledModules)` so the filter applies at the single emission
point.
- `DashboardUiState` gains `enabledModules: List<String> = emptyList()`
as the server hand-off slot.
- 9 unit tests in `HomeTileVisibilityTest` lock in the matrix + ordering
rules so future tile additions explicitly choose a per-role default.
Forward-compatibility notes:
- The local `UserRole` enum has 5 values today; the server returns 8
(DEVELOPER, ADMIN, TEACHER, STUDENT, GUARDIAN, ACCOUNTANT, STAFF,
USER). The mapping is structured additively so E02.S01 (8-role
expansion) only adds entries; existing entries don't change.
- `enabledModules` flows from /api/mobile/dashboard (E08.S06). Until
that endpoint exists, the empty-default keeps things working.
Atomic / reusability: `HomeTileId` and `HomeTileVisibility` are
dashboard-specific contracts, intentionally kept in `feature/dashboard`
(not lifted to core/designsystem). The filter+order is a pure extension
on `List<HomeTileSpec>`, composable with any future grid using the same
spec shape.
Closes #14
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HomeTileId(stable per-tile identifier + server-name mapping) andHomeTileVisibility(role → visible-tile matrix) following the hogwarts platform-sidebar configList<HomeTileSpec>.filterAndOrderForRole(role, enabledModules)— filter by role, then reorder by the server's module manifest (case-insensitive; stable fallback)HomeTileSpeccarriesid: HomeTileId;DashboardUiStategainsenabledModules: List<String>for the server hand-off (E08.S06 dashboard endpoint)Story
E11.S03 (Phase 1 Pilot v1, Sprint P3, 5 pts).
Atomic / reusability notes
Per the architecture/structure doctrine on ed.databayt.org:
HomeTileId+HomeTileVisibilityare dashboard-local primitives (encoding a dashboard-specific contract) — not lifted tocore/designsystemList<HomeTileSpec>, composable with any future grid that uses the same spec shapeBadgedAppIcon/HomeTileSpecshape unchangedTest plan
./gradlew :feature:dashboard:testDebugUnitTest --tests \"*HomeTileVisibilityTest*\"green./gradlew :feature:dashboard:lintgreenUserRoletoggle):Forward-compat
UserRoleonly has 5 values today; server returns 8. Mapping is additive so E02.S01 (8-role expansion) extends without touching existing entries — addsACCOUNTANT,STAFF,USER, renamesSUPER_ADMIN → DEVELOPERenabledModulesis empty until E08.S06 ships — role defaults keep the dashboard fully usable in the meantimeCoexistence
Stacks cleanly on PR #13 (E11.S01 tile wiring). Disjoint line edits on
home-tile-spec.kt— if E11.S01 merges first, this PR rebases automatically; if this merges first, E11.S01 needsid = HomeTileId.Xadded to its 4 wired tiles.Figma verification gate
Per ios-design-doctrine, pixel-level UI work requires opening the Figma frame. This PR adds logic (filter + order) and contracts (enum + map) — no pixel changes. Existing iOS 26 grid visuals are unchanged.
Closes #14
Generated with Claude Code