Files
mantra-kmp/composeApp
Kgothatso Ngako 0727a04bae feat(dialects): a dialect is a thing you can open
Artifacts, translations and projects each have a route, a state, a view model
and a screen. A dialect had a `ListItem` inside `ChatRoomDetailScreen`'s
`LazyColumn` with no `onClick`, which made it the one entity in a room a member
could look at and not open. This is that screen, and the card finally gets the
`onClick` it never had.

The two lists are the reason it exists. A dialect is a name, a language code and
a country; those three sit at the bottom under the details the way they do
everywhere else, and what a member opens a dialect to find out is what the group
has written in it. `MantraArtifact.dialectId` and
`MantraTranslationArtifactVersion.dialectId` are the only two columns in the app
that point at a dialect, and neither had a query.

Both new queries are scoped by the dialect alone, with no `chatRoomId` beside
it. `dialectId` is a foreign key into this room's own rows, so the key already
confines the read to one room and a second filter would be a second spelling of
a constraint that is already enforced. That is the one-room scope decision made
load-bearing rather than restated; when a dialect can be named across rooms --
Phase 9 of docs/project-feature.md -- these two queries are among the places
that have to learn about it, which is why the reasoning is on them rather than
here.

`Loaded` also carries `canAddSubgroup`, which Phase 3 needs and which is the
same two conditions `ChatRoomDetailUIState` already states: a Marmot room, and a
share of its key. It reads the room off the *dialect's* `chatRoomId` rather than
the route's, so the parent of a subgroup made here is the room the dialect
actually lives in even if a route is ever built by hand.

A missing dialect is `Error` and not an empty `Loaded`, because "this room has
written nothing in Sesotho" and "there is no such dialect here" would otherwise
look identical and only one of them is worth a retry button.

The test that earns its place is the two-dialects-in-one-room case: if either
query ever drifted to scoping by room, every single-dialect test would still
pass and that one would not.

Phase 2 of docs/subgroups-for-entities.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-03 01:19:22 +02:00
..