commit
Plural: tidy the member page bar, metrics tiles and filter sheet
The back bar no longer adds a second status-bar gap, the stat tiles keep their labels whole and match heights, and the filters sheet scrolls when there are many identities. Documents the app in plural/README.md.
diff --git a/README.md b/README.md
index 432d6f5..22f4e3b 100644
--- a/README.md
+++ b/README.md
@@ -8,10 +8,10 @@ own repositories (the mail server is [doughmination/email](https://github.com/do
| Device Reporter | [`api-helper/`](api-helper/) | `:api-helper:app` | `uk.doughmination.devicereporter` | `device-reporter.yml` |
| Inbox | [`email/`](email/) | `:email:app` | `gay.doughmination.mail` | `inbox.yml` |
| Doughmination Manager | [`doughmination-manager/`](doughmination-manager/) | `:doughmination-manager:app` | `gay.doughmination.manager` | `manager.yml` |
-| Plural | [`plural/`](plural/) | `:plural:app` | `gay.doughmination.plural` | `plural.yml` |
+| System (Plural) | [`plural/`](plural/) | `:plural:app` | `gay.doughmination.plural` | `plural.yml` |
-Doughmination Manager and Plural are placeholders for now: they build and run,
-and nothing else.
+Doughmination Manager is a placeholder for now: it builds and runs, and
+nothing else. Plural is the System app; see [plural/README.md](plural/README.md).
## Layout
diff --git a/plural/README.md b/plural/README.md
new file mode 100644
index 0000000..ad6ac96
--- /dev/null
+++ b/plural/README.md
@@ -0,0 +1,86 @@
+# System (Plural)
+
+A native Android app (Kotlin, Jetpack Compose) for the Doughmination System,
+the plural system tracker at [doughmination.co.uk](https://doughmination.co.uk)
+([doughmination/system](https://github.com/doughmination/system)). It isn't a
+wrapper around the website: it talks to the same Doughmination API
+(`https://doughmination.uk/v2/plural/*`) and the same live socket (`/v2/ws`),
+and draws everything natively.
+
+## What it does
+
+Public, no sign-in needed (as on the website):
+
+- **Members**: everyone A–Z, searchable by name or tag, filterable by tag
+ (including "untagged") and pride identity. Member colours, pronouns, the
+ first two tags and statuses. Whoever is fronting is highlighted.
+- **Mental state** banner and **currently fronting / co-fronting**, with how
+ long the current front has lasted.
+- **Member pages**: about, tags and pride (tap one to filter the list by it),
+ partners and crushes (mutual ones marked), and a share link to the website.
+- **Relationship map**: the website's rotating 3D graph (`graph.ts` ported),
+ drag to turn, tap someone to open them, then everyone in pairs.
+- **Metrics**: switches and fronting time over 24h–30d, with the donut, bars
+ and top fronters.
+- **Live**: fronter and mental-state changes, and an admin's "refresh
+ everyone", arrive over the socket while the app is open.
+
+Signed in (admins; the website's `/admin` pages):
+
+- Switch manager, mental state, statuses, tags, force refresh.
+- Owner only: pride identities, relationships, user management.
+- Profile: view and edit display name, avatar and contact email.
+
+## Signing in
+
+Sign-in uses the API's native app flow, which lives on the
+[`plural-app-signin`](https://github.com/doughmination/api/pull/1) branch of
+doughmination/api and **isn't deployed yet**:
+
+1. The app opens `/v2/plural/auth/sso/login?app=<PKCE challenge>` in a Custom
+ Tab (a real browser, so passkeys work).
+2. After SSO the API redirects to `gay.doughmination.plural://auth?code=…`, a
+ single-use code that expires after 60 seconds. The JWT itself never appears
+ in a URL.
+3. The app swaps code and PKCE verifier at `POST /v2/plural/auth/app/token`
+ for the same token the website uses, kept encrypted with an Android
+ Keystore key (`data/TokenStore.kt`).
+
+Until that's deployed, the API ignores `?app` and the browser tab finishes on
+the website instead, so the app stays signed out.
+
+## Layout
+
+```
+app/src/main/java/gay/doughmination/plural/
+ SystemApp.kt the app-wide Api, Auth, Live and token store
+ MainActivity.kt catches the sign-in redirect
+ data/
+ Api.kt /v2/plural/* calls
+ Auth.kt sign-in (Custom Tab + PKCE)
+ Live.kt the /v2/ws socket
+ Models.kt mirrors react-api's src/types/plural.ts
+ Graph.kt the relationship map's 3D layout (system/src/lib/graph.ts)
+ Colour.kt readable member colours (system/src/lib/colour.ts)
+ Pride.kt the flag catalogue (system/src/lib/pride.ts)
+ Relations.kt partners, crushes, mutual crushes
+ ui/
+ SystemViewModel state, navigation and actions for every screen
+ HomeScreen, MemberScreen, RelationshipsScreen, MetricsScreen,
+ AccountScreen, AdminScreens
+```
+
+## Building
+
+From the repository root:
+
+```sh
+./gradlew :plural:app:assembleDebug
+./gradlew :plural:app:assembleRelease # debug key unless SIGNING_* is set
+```
+
+`-PapiUrl=https://…/v2` points a build at another API.
+
+CI: `plural.yml` builds and signs it (tags `plural-v*` release it), and
+`plural-smoke.yml` installs the signed APK on an emulator, walks the tabs and
+uploads screenshots.
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/Components.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/Components.kt
index 3bd0a84..617fdfb 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/Components.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/Components.kt
@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
@@ -247,6 +248,8 @@ fun BackBar(title: String, onBack: () -> Unit, actions: @Composable () -> Unit =
},
actions = { actions() },
colors = TopAppBarDefaults.topAppBarColors(containerColor = Color.Transparent),
+ // AppRoot already pads for the status bar.
+ windowInsets = WindowInsets(0),
)
}
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/HomeScreen.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/HomeScreen.kt
index a4ba904..6ff2b6e 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/HomeScreen.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/HomeScreen.kt
@@ -21,7 +21,9 @@ import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyGridItemSpanScope
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
+import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.foundation.verticalScroll
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Close
@@ -154,7 +156,10 @@ fun HomeScreen(vm: SystemViewModel) {
if (filtersOpen) {
ModalBottomSheet(onDismissRequest = { filtersOpen = false }) {
- Column(Modifier.padding(horizontal = 20.dp).padding(bottom = 32.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {
+ Column(
+ Modifier.verticalScroll(rememberScrollState()).padding(horizontal = 20.dp).padding(bottom = 32.dp),
+ verticalArrangement = Arrangement.spacedBy(12.dp),
+ ) {
Text("Filters", style = MaterialTheme.typography.titleLarge)
Text("Tag", color = Muted, style = MaterialTheme.typography.labelLarge)
FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
diff --git a/plural/app/src/main/java/gay/doughmination/plural/ui/MetricsScreen.kt b/plural/app/src/main/java/gay/doughmination/plural/ui/MetricsScreen.kt
index ad8311b..7890957 100644
--- a/plural/app/src/main/java/gay/doughmination/plural/ui/MetricsScreen.kt
+++ b/plural/app/src/main/java/gay/doughmination/plural/ui/MetricsScreen.kt
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
+import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
@@ -93,10 +94,10 @@ fun MetricsScreen(vm: SystemViewModel) {
}
switches?.let { s ->
- Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
- Stat("Total switches", "${s.totalSwitches}", "Last 30 days", Modifier.weight(1f))
- Stat("Avg per day", "%.1f".format(s.averagePerDay), "Switches per day", Modifier.weight(1f))
- Stat("Selected", "${s[timeframe]}", timeframe.label, Modifier.weight(1f))
+ Row(Modifier.height(IntrinsicSize.Min), horizontalArrangement = Arrangement.spacedBy(10.dp)) {
+ Stat("Switches", "${s.totalSwitches}", "Last 30 days", Modifier.weight(1f).fillMaxHeight())
+ Stat("Per day", "%.1f".format(s.averagePerDay), "On average", Modifier.weight(1f).fillMaxHeight())
+ Stat("Selected", "${s[timeframe]}", timeframe.label, Modifier.weight(1f).fillMaxHeight())
}
}