Modern Apps git

← Modern-Apps.git

madeveloper: screenshot captures for every route

Commit
171abb0b32efa6b737812c3a4a0b5495d2077e03
Author
Vayun Mathur <[email protected]>
When
2026-12-02 10:23 UTC (4 days ago)
Parents
0e7b58d
RouteScreenshotCoverage was the module's only failing
detector: nine of the ten Route destinations had no capture
(Home already had 1-home). Repo, Commits, Commit and File were
bound to MaDevViewModel, so their rendering is extracted to
stateless contents in their own files (RepoScreenContent,
CommitsScreenContent,
CommitScreenContent, FileScreenContent; the VM screens stay as
binders owning the loads, tree state and retry ticks, and pass
literal state plus callbacks in). MetadataPreviews now renders
one real capture per route from fixed sample fixtures:
2-repo (browser state with a commit, two tree entries),
3-commits, 4-commit (a fixed 2023-11-14 commit with a fixed
now for its relative-time label), 5-file (a literal text file),
6-issues, 7-prs, 8-tests (a TestsStatus with latest/history
runs), 9-catalog and 10-push, alongside the unchanged 1-home.
No route needed an exemption: every destination renders
statically from MaDevUiState or the extracted contents.

Verified: ./gradlew :madeveloper:lint
:madeveloper:lintVitalRelease (also rerun explicitly with
--rerun-tasks) :madeveloper:testDevUnitTest (57 tests, 0
failures) :madeveloper:compileReleaseKotlin all green. No lint
config, detector or baseline touched, and no exception markers
added.

Diff

madeveloper/AGENTS.md
diff --git a/madeveloper/AGENTS.md b/madeveloper/AGENTS.mdindex b8e2dc8e51..57293556f2 100644--- a/madeveloper/AGENTS.md+++ b/madeveloper/AGENTS.md@@ -44,9 +44,13 @@ _Install: ./install madeveloper (dev by default)._ ### ui/ — screens - com/vayunmathur/madeveloper/ui/HomeScreen.kt - com/vayunmathur/madeveloper/ui/RepoScreen.kt+- com/vayunmathur/madeveloper/ui/RepoScreenContent.kt - com/vayunmathur/madeveloper/ui/CommitsScreen.kt+- com/vayunmathur/madeveloper/ui/CommitsScreenContent.kt - com/vayunmathur/madeveloper/ui/CommitScreen.kt+- com/vayunmathur/madeveloper/ui/CommitScreenContent.kt - com/vayunmathur/madeveloper/ui/FileScreen.kt+- com/vayunmathur/madeveloper/ui/FileScreenContent.kt - com/vayunmathur/madeveloper/ui/TestsScreen.kt - com/vayunmathur/madeveloper/ui/CatalogScreen.kt - com/vayunmathur/madeveloper/ui/PushScreen.kt
madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitScreen.kt
diff --git a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitScreen.kt b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitScreen.ktindex a7f25b83b6..9cfd782d1e 100644--- a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitScreen.kt+++ b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitScreen.kt@@ -36,79 +36,9 @@ import com.vayunmathur.madeveloper.platform.MaDevViewModel  */ @Composable fun CommitScreen(repoName: String, sha: String, viewModel: MaDevViewModel, onBack: () -> Unit) {-    val context = LocalContext.current     LaunchedEffect(repoName) { viewModel.loadRepo(repoName) }     // The commit is identified by the route's sha alone; no VM selection state.     val commit = viewModel.browser(repoName)?.commits?.firstOrNull { it.sha == sha }     val now = remember { System.currentTimeMillis() }-    AppScaffold(-        title = commit?.shortSha?.ifBlank { sha.take(SHORT_SHA_LENGTH) } ?: sha.take(SHORT_SHA_LENGTH),-        subtitle = repoName,-        onNavigateBack = onBack,-    ) { padding ->-        Column(-            Modifier.padding(padding).verticalScroll(rememberScrollState()),-            verticalArrangement = Arrangement.spacedBy(Spacing.md),-        ) {-            if (commit == null) {-                EmptyState(-                    title = "Commit not loaded",-                    message = "Commit not in the loaded pages. Open the commits list and load more, or view it on the git host.",-                )-            } else {-                DashboardSection(-                    title = "Commit",-                    leadingIcon = { modifier, tint -> IconHistory(modifier, tint) },-                ) {-                    Column(-                        modifier = Modifier.padding(Spacing.lg),-                        verticalArrangement = Arrangement.spacedBy(Spacing.sm),-                    ) {-                        Text(-                            commit.subject.ifBlank { commit.shortSha },-                            style = MaterialTheme.typography.titleMedium,-                        )-                        Text(-                            commit.sha,-                            style = MaterialTheme.typography.bodySmall,-                            fontFamily = FontFamily.Monospace,-                            color = MaterialTheme.colorScheme.onSurfaceVariant,-                        )-                    }-                    DashboardSectionDivider()-                    ListItem(-                        headlineContent = { Text(commit.author.ifBlank { "Unknown author" }) },-                        supportingContent = { Text("Author") },-                        leadingContent = { IconPerson() },-                    )-                    DashboardSectionDivider()-                    ListItem(-                        headlineContent = {-                            val relative = DevPresentation.relativeTimeLabel(commit.time, now)-                            Text(relative.ifBlank { commit.time }.ifBlank { "Unknown time" })-                        },-                        supportingContent = { Text(commit.time) },-                        leadingContent = { IconSchedule() },-                    )-                    if (commit.body.isNotBlank()) {-                        DashboardSectionDivider()-                        Text(-                            commit.body,-                            modifier = Modifier.padding(Spacing.lg),-                            style = MaterialTheme.typography.bodyMedium,-                        )-                    }-                }-            }-            Button(-                onClick = { ExternalIntents.openUrl(context, "https://git.maproj.org/$repoName") },-                modifier = Modifier.fillMaxWidth().padding(horizontal = Spacing.lg),-            ) {-                IconGlobe()-                Text("View on git host", modifier = Modifier.padding(start = Spacing.sm))-            }-        }-    }+    CommitScreenContent(repoName = repoName, sha = sha, commit = commit, nowMillis = now, onBack = onBack) }--private const val SHORT_SHA_LENGTH = 8
madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitScreenContent.kt
diff --git a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitScreenContent.kt b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitScreenContent.ktnew file mode 100644index 0000000000..3860e22b6d--- /dev/null+++ b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitScreenContent.kt@@ -0,0 +1,113 @@+package com.vayunmathur.madeveloper.ui++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.verticalScroll+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.remember+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.text.font.FontFamily+import com.vayunmathur.library.ui.AppScaffold+import com.vayunmathur.library.ui.Button+import com.vayunmathur.library.ui.DashboardSection+import com.vayunmathur.library.ui.DashboardSectionDivider+import com.vayunmathur.library.ui.EmptyState+import com.vayunmathur.library.ui.ExternalIntents+import com.vayunmathur.library.ui.IconGlobe+import com.vayunmathur.library.ui.IconHistory+import com.vayunmathur.library.ui.IconPerson+import com.vayunmathur.library.ui.IconSchedule+import com.vayunmathur.library.ui.ListItem+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.Spacing+import com.vayunmathur.library.ui.Text+import com.vayunmathur.madeveloper.domain.DevPresentation+import com.vayunmathur.madeveloper.platform.MaDevViewModel++/** Stateless commit detail, rendered by previews from a literal [commit]. */+@Composable+fun CommitScreenContent(+    repoName: String,+    sha: String,+    commit: com.vayunmathur.madeveloper.domain.GitCommit?,+    nowMillis: Long,+    onBack: () -> Unit,+) {+    val context = LocalContext.current+    val now = nowMillis+    AppScaffold(+        title = commit?.shortSha?.ifBlank { sha.take(SHORT_SHA_LENGTH) } ?: sha.take(SHORT_SHA_LENGTH),+        subtitle = repoName,+        onNavigateBack = onBack,+    ) { padding ->+        Column(+            Modifier.padding(padding).verticalScroll(rememberScrollState()),+            verticalArrangement = Arrangement.spacedBy(Spacing.md),+        ) {+            if (commit == null) {+                EmptyState(+                    title = "Commit not loaded",+                    message = "Commit not in the loaded pages. Open the commits list and load more, or view it on the git host.",+                )+            } else {+                DashboardSection(+                    title = "Commit",+                    leadingIcon = { modifier, tint -> IconHistory(modifier, tint) },+                ) {+                    Column(+                        modifier = Modifier.padding(Spacing.lg),+                        verticalArrangement = Arrangement.spacedBy(Spacing.sm),+                    ) {+                        Text(+                            commit.subject.ifBlank { commit.shortSha },+                            style = MaterialTheme.typography.titleMedium,+                        )+                        Text(+                            commit.sha,+                            style = MaterialTheme.typography.bodySmall,+                            fontFamily = FontFamily.Monospace,+                            color = MaterialTheme.colorScheme.onSurfaceVariant,+                        )+                    }+                    DashboardSectionDivider()+                    ListItem(+                        headlineContent = { Text(commit.author.ifBlank { "Unknown author" }) },+                        supportingContent = { Text("Author") },+                        leadingContent = { IconPerson() },+                    )+                    DashboardSectionDivider()+                    ListItem(+                        headlineContent = {+                            val relative = DevPresentation.relativeTimeLabel(commit.time, now)+                            Text(relative.ifBlank { commit.time }.ifBlank { "Unknown time" })+                        },+                        supportingContent = { Text(commit.time) },+                        leadingContent = { IconSchedule() },+                    )+                    if (commit.body.isNotBlank()) {+                        DashboardSectionDivider()+                        Text(+                            commit.body,+                            modifier = Modifier.padding(Spacing.lg),+                            style = MaterialTheme.typography.bodyMedium,+                        )+                    }+                }+            }+            Button(+                onClick = { ExternalIntents.openUrl(context, "https://git.maproj.org/$repoName") },+                modifier = Modifier.fillMaxWidth().padding(horizontal = Spacing.lg),+            ) {+                IconGlobe()+                Text("View on git host", modifier = Modifier.padding(start = Spacing.sm))+            }+        }+    }+}++private const val SHORT_SHA_LENGTH = 8
madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitsScreen.kt
diff --git a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitsScreen.kt b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitsScreen.ktindex 5e9d054fd9..15953ef05a 100644--- a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitsScreen.kt+++ b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitsScreen.kt@@ -34,59 +34,12 @@ fun CommitsScreen(         viewModel.loadRepo(repoName)         if (browser != null && browser.commits.isEmpty()) viewModel.loadCommits(repoName, loadMore = false)     }-    AppScaffold(-        title = "Commits",-        subtitle = "$repoName · $branch",-        onNavigateBack = onBack,-        isRefreshing = browser == null,+    CommitsScreenContent(+        repoName = repoName, branch = branch, browser = browser,+        repoError = viewModel.state.repoError,+        onBack = onBack,         onRefresh = { viewModel.loadCommits(repoName, loadMore = false) },-    ) { padding ->-        androidx.compose.foundation.layout.Box(-            modifier = Modifier.fillMaxSize(),-        ) {-            LazyColumn(-                Modifier.fillMaxSize().padding(padding),-                verticalArrangement = Arrangement.spacedBy(Spacing.md),-            ) {-                viewModel.state.repoError?.let { error ->-                    item {-                        ErrorState(-                            title = "Could not load commits",-                            message = error,-                            retryLabel = "Retry",-                            onRetry = { viewModel.loadCommits(repoName, loadMore = false) },-                        )-                    }-                }-                if (browser == null) {-                    if (viewModel.state.repoError == null) {-                        item { Text("Loading commits…", modifier = Modifier.fillMaxWidth().height(160.dp)) }-                    }-                } else {-                    item {-                        DashboardSection(title = "Commits on $branch") {-                            if (browser.commits.isEmpty()) {-                                Text(-                                    "No commits",-                                    modifier = Modifier.padding(Spacing.lg),-                                    color = MaterialTheme.colorScheme.onSurfaceVariant,-                                )-                            }-                        }-                    }-                    items(browser.commits) { commit ->-                        CommitRow(commit = commit, onClick = { onOpenCommit(commit.sha) })-                    }-                    if (!browser.commitsExhausted && browser.commits.isNotEmpty()) {-                        item {-                            Button(-                                onClick = { viewModel.loadCommits(repoName, loadMore = true) },-                                modifier = Modifier.fillMaxWidth().padding(horizontal = Spacing.lg),-                            ) { Text("Load more") }-                        }-                    }-                }-            }-        }-    }+        onOpenCommit = onOpenCommit,+        onLoadMore = { viewModel.loadCommits(repoName, loadMore = true) },+    ) }
madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitsScreenContent.kt
diff --git a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitsScreenContent.kt b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitsScreenContent.ktnew file mode 100644index 0000000000..c99d72aea9--- /dev/null+++ b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/CommitsScreenContent.kt@@ -0,0 +1,90 @@+package com.vayunmathur.madeveloper.ui++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.items+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp+import com.vayunmathur.library.ui.AppScaffold+import com.vayunmathur.library.ui.Button+import com.vayunmathur.library.ui.DashboardSection+import com.vayunmathur.library.ui.ErrorState+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.Spacing+import com.vayunmathur.library.ui.Text+import com.vayunmathur.madeveloper.platform.MaDevViewModel++/** Stateless commits list, rendered by previews from a literal [browser]. */+@Composable+fun CommitsScreenContent(+    repoName: String,+    branch: String,+    browser: com.vayunmathur.madeveloper.domain.RepoBrowserState?,+    repoError: String?,+    onBack: () -> Unit,+    onRefresh: () -> Unit,+    onOpenCommit: (String) -> Unit,+    onLoadMore: () -> Unit,+) {+    AppScaffold(+        title = "Commits",+        subtitle = "$repoName · $branch",+        onNavigateBack = onBack,+        isRefreshing = browser == null,+        onRefresh = onRefresh,+    ) { padding ->+        androidx.compose.foundation.layout.Box(+            modifier = Modifier.fillMaxSize(),+        ) {+            LazyColumn(+                Modifier.fillMaxSize().padding(padding),+                verticalArrangement = Arrangement.spacedBy(Spacing.md),+            ) {+                repoError?.let { error ->+                    item {+                        ErrorState(+                            title = "Could not load commits",+                            message = error,+                            retryLabel = "Retry",+                            onRetry = onRefresh,+                        )+                    }+                }+                if (browser == null) {+                    if (repoError == null) {+                        item { Text("Loading commits…", modifier = Modifier.fillMaxWidth().height(160.dp)) }+                    }+                } else {+                    item {+                        DashboardSection(title = "Commits on $branch") {+                            if (browser.commits.isEmpty()) {+                                Text(+                                    "No commits",+                                    modifier = Modifier.padding(Spacing.lg),+                                    color = MaterialTheme.colorScheme.onSurfaceVariant,+                                )+                            }+                        }+                    }+                    items(browser.commits) { commit ->+                        CommitRow(commit = commit, onClick = { onOpenCommit(commit.sha) })+                    }+                    if (!browser.commitsExhausted && browser.commits.isNotEmpty()) {+                        item {+                            Button(+                                onClick = onLoadMore,+                                modifier = Modifier.fillMaxWidth().padding(horizontal = Spacing.lg),+                            ) { Text("Load more") }+                        }+                    }+                }+            }+        }+    }+}
madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/FileScreen.kt
diff --git a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/FileScreen.kt b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/FileScreen.ktindex af63a6474f..6578c36f02 100644--- a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/FileScreen.kt+++ b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/FileScreen.kt@@ -43,79 +43,8 @@ fun FileScreen(repoName: String, path: String, branch: String, viewModel: MaDevV         file = runCatching { viewModel.file(repoName, branch, path) }             .getOrElse { error = it.message; null }     }-    val fileName = path.substringAfterLast('/')-    AppScaffold(-        isRefreshing = file == null && error == null,-        title = fileName,-        subtitle = "$repoName · $branch",-        onNavigateBack = onBack,-    ) { padding ->-        Column(-            Modifier.padding(padding).verticalScroll(rememberScrollState()),-            verticalArrangement = Arrangement.spacedBy(Spacing.md),-        ) {-            Text(-                path,-                style = MaterialTheme.typography.bodySmall,-                fontFamily = FontFamily.Monospace,-                color = MaterialTheme.colorScheme.onSurfaceVariant,-                modifier = Modifier.padding(horizontal = Spacing.lg, vertical = Spacing.sm),-            )-            error?.let {-                ErrorState(-                    title = "Could not load this file",-                    message = friendlyErrorMessage(it),-                    retryLabel = "Retry",-                    onRetry = { reloadTick++ },-                )-            }-            val loaded = file-            when {-                loaded == null && error == null -> Text("Loading file…", modifier = Modifier.fillMaxWidth().height(160.dp))-                loaded == null -> Unit-                loaded.isBinary -> DashboardSection(-                    title = "Binary file",-                    leadingIcon = { modifier, tint -> IconDescription(modifier, tint) },-                ) {-                    Text(-                        "Binary file · ${loaded.size} B · ${DevPresentation.shortSha(loaded.sha)}",-                        modifier = Modifier.padding(Spacing.lg),-                    )-                }--                else -> {-                    if (loaded.truncated) {-                        Text(-                            "File truncated by the server · ${loaded.size} B",-                            color = MaterialTheme.colorScheme.error,-                            modifier = Modifier.padding(horizontal = Spacing.lg),-                        )-                    }-                    Surface(-                        modifier = Modifier.fillMaxWidth().padding(horizontal = Spacing.lg),-                        shape = MaterialTheme.shapes.medium,-                        color = MaterialTheme.colorScheme.surfaceContainerLow,-                    ) {-                        Row(Modifier.horizontalScroll(rememberScrollState())) {-                            Text(-                                (loaded.content ?: "").lines()-                                    .mapIndexed { index, line ->-                                        (index + 1).toString().padStart(LINE_NUMBER_WIDTH) + "  " + line-                                    }-                                    .joinToString("\n"),-                                style = MaterialTheme.typography.bodySmall,-                                fontFamily = FontFamily.Monospace,-                                modifier = Modifier.padding(Spacing.md),-                            )-                        }-                    }-                    if ((loaded.content ?: "").isBlank()) {-                        EmptyState(title = "Empty file", message = "This file has no text content.")-                    }-                }-            }-        }-    }+    FileScreenContent(+        repoName = repoName, path = path, branch = branch, file = file, error = error,+        onBack = onBack, onRetry = { reloadTick++ },+    ) }--private const val LINE_NUMBER_WIDTH = 4
madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/FileScreenContent.kt
diff --git a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/FileScreenContent.kt b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/FileScreenContent.ktnew file mode 100644index 0000000000..376670bf01--- /dev/null+++ b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/FileScreenContent.kt@@ -0,0 +1,121 @@+package com.vayunmathur.madeveloper.ui++import androidx.compose.foundation.horizontalScroll+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.verticalScroll+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp+import androidx.compose.ui.text.font.FontFamily+import com.vayunmathur.library.ui.AppScaffold+import com.vayunmathur.library.ui.friendlyErrorMessage+import com.vayunmathur.library.ui.DashboardSection+import com.vayunmathur.library.ui.EmptyState+import com.vayunmathur.library.ui.ErrorState+import com.vayunmathur.library.ui.IconDescription+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.Spacing+import com.vayunmathur.library.ui.Surface+import com.vayunmathur.library.ui.Text+import com.vayunmathur.madeveloper.domain.DevPresentation+import com.vayunmathur.madeveloper.domain.GitFile+import com.vayunmathur.madeveloper.platform.MaDevViewModel++/** Stateless file view, rendered by previews from a literal [file]. */+@Composable+fun FileScreenContent(+    repoName: String,+    path: String,+    branch: String,+    file: GitFile?,+    error: String?,+    onBack: () -> Unit,+    onRetry: () -> Unit,+) {+    val fileName = path.substringAfterLast('/')+    AppScaffold(+        isRefreshing = file == null && error == null,+        title = fileName,+        subtitle = "$repoName · $branch",+        onNavigateBack = onBack,+    ) { padding ->+        Column(+            Modifier.padding(padding).verticalScroll(rememberScrollState()),+            verticalArrangement = Arrangement.spacedBy(Spacing.md),+        ) {+            Text(+                path,+                style = MaterialTheme.typography.bodySmall,+                fontFamily = FontFamily.Monospace,+                color = MaterialTheme.colorScheme.onSurfaceVariant,+                modifier = Modifier.padding(horizontal = Spacing.lg, vertical = Spacing.sm),+            )+            error?.let {+                ErrorState(+                    title = "Could not load this file",+                    message = friendlyErrorMessage(it),+                    retryLabel = "Retry",+                    onRetry = onRetry,+                )+            }+            val loaded = file+            when {+                loaded == null && error == null -> Text("Loading file…", modifier = Modifier.fillMaxWidth().height(160.dp))+                loaded == null -> Unit+                loaded.isBinary -> DashboardSection(+                    title = "Binary file",+                    leadingIcon = { modifier, tint -> IconDescription(modifier, tint) },+                ) {+                    Text(+                        "Binary file · ${loaded.size} B · ${DevPresentation.shortSha(loaded.sha)}",+                        modifier = Modifier.padding(Spacing.lg),+                    )+                }++                else -> {+                    if (loaded.truncated) {+                        Text(+                            "File truncated by the server · ${loaded.size} B",+                            color = MaterialTheme.colorScheme.error,+                            modifier = Modifier.padding(horizontal = Spacing.lg),+                        )+                    }+                    Surface(+                        modifier = Modifier.fillMaxWidth().padding(horizontal = Spacing.lg),+                        shape = MaterialTheme.shapes.medium,+                        color = MaterialTheme.colorScheme.surfaceContainerLow,+                    ) {+                        Row(Modifier.horizontalScroll(rememberScrollState())) {+                            Text(+                                (loaded.content ?: "").lines()+                                    .mapIndexed { index, line ->+                                        (index + 1).toString().padStart(LINE_NUMBER_WIDTH) + "  " + line+                                    }+                                    .joinToString("\n"),+                                style = MaterialTheme.typography.bodySmall,+                                fontFamily = FontFamily.Monospace,+                                modifier = Modifier.padding(Spacing.md),+                            )+                        }+                    }+                    if ((loaded.content ?: "").isBlank()) {+                        EmptyState(title = "Empty file", message = "This file has no text content.")+                    }+                }+            }+        }+    }+}++private const val LINE_NUMBER_WIDTH = 4
madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/RepoScreen.kt
diff --git a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/RepoScreen.kt b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/RepoScreen.ktindex 0c0e4e6bc8..f73bdbede3 100644--- a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/RepoScreen.kt+++ b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/RepoScreen.kt@@ -48,6 +48,7 @@ import com.vayunmathur.library.ui.friendlyErrorMessage import com.vayunmathur.madeveloper.domain.DevPresentation import com.vayunmathur.madeveloper.domain.FileKind import com.vayunmathur.madeveloper.domain.TreeEntry+import com.vayunmathur.madeveloper.platform.MaDevUiState import com.vayunmathur.madeveloper.platform.MaDevViewModel  /** One repository: branch switching, recent commits and its file tree. */@@ -65,7 +66,6 @@ fun RepoScreen(     val repo = viewModel.repoByName(repoName)     val context = LocalContext.current     var entries by remember { mutableStateOf<List<TreeEntry>>(emptyList()) }-    var filter by remember { mutableStateOf("") }     var treeError by remember { mutableStateOf<String?>(null) }     var treeLoading by remember { mutableStateOf(false) }     var treeRetry by remember { mutableIntStateOf(0) }@@ -78,225 +78,21 @@ fun RepoScreen(             .getOrElse { treeError = context.friendlyError(it); emptyList() }         treeLoading = false     }-    AppScaffold(-        isRefreshing = browser == null || treeLoading,-        title = repoName,-        subtitle = repo?.defaultBranch?.takeIf { it.isNotBlank() }?.let { "Default branch $it" },-        onNavigateBack = onBack,-    ) { padding ->-        LazyColumn(-            Modifier.padding(padding),-            verticalArrangement = Arrangement.spacedBy(Spacing.md),-        ) {-            state.repoError?.let { error ->-                item {-                    ErrorState(-                        title = "Could not load this repository",-                        message = friendlyErrorMessage(error),-                        retryLabel = "Retry",-                        onRetry = { viewModel.loadRepo(repoName) },-                    )-                }-            }-            if (browser == null) {-                if (state.repoError == null) {-                    item { Text("Loading repository…", modifier = Modifier.fillMaxWidth().height(160.dp)) }-                }-            } else {-                item {-                    DashboardSection(-                        title = "Repository",-                        leadingIcon = { modifier, tint -> IconCode(modifier, tint) },-                    ) {-                        ListItem(-                            headlineContent = {-                                Text(-                                    repo?.cloneUrl ?: "https://git.maproj.org/$repoName.git",-                                    fontFamily = FontFamily.Monospace,-                                    style = MaterialTheme.typography.bodySmall,-                                )-                            },-                            supportingContent = { Text("Clone URL") },-                            leadingContent = { IconLink() },-                        )-                        DashboardSectionDivider()-                        Row(-                            modifier = Modifier.fillMaxWidth().padding(Spacing.lg),-                            verticalAlignment = Alignment.CenterVertically,-                            horizontalArrangement = Arrangement.spacedBy(Spacing.sm),-                        ) {-                            Text("Branch", style = MaterialTheme.typography.titleSmall)-                            SelectDropdown(-                                label = browser.branch.ifBlank { "—" },-                                options = browser.branches.map { it.name },-                                selected = browser.branch,-                                itemLabel = { it },-                                onSelect = { viewModel.selectBranch(repoName, it) },-                            )-                        }-                    }-                }-                item {-                    DashboardSection(-                        title = "Recent commits",-                        actionLabel = "All commits",-                        onAction = { onOpenCommits(browser.branch) },-                        leadingIcon = { modifier, tint -> IconHistory(modifier, tint) },-                    ) {-                        if (browser.commits.isEmpty()) {-                            Text(-                                "No commits",-                                modifier = Modifier.padding(Spacing.lg),-                                color = MaterialTheme.colorScheme.onSurfaceVariant,-                            )-                        }-                        browser.commits.take(RECENT_COMMITS).forEachIndexed { index, commit ->-                            if (index > 0) DashboardSectionDivider()-                            CommitRow(-                                commit = commit,-                                onClick = { onOpenCommit(browser.branch, commit.sha) },-                            )-                        }-                    }-                }-                item {-                    DashboardSection(-                        title = "Files",-                        leadingIcon = { modifier, tint -> IconFolder(modifier, tint) },-                    ) {-                        Column(-                            modifier = Modifier.padding(Spacing.lg),-                            verticalArrangement = Arrangement.spacedBy(Spacing.sm),-                        ) {-                            TextField(-                                value = filter, onValueChange = { filter = it },-                                label = { Text("Filter files") }, modifier = Modifier.fillMaxWidth(),-                            )-                            BreadcrumbRow(-                                path = browser.path,-                                breadcrumbs = browser.breadcrumbs,-                                onNavigate = { viewModel.navigateTree(repoName, it) },-                                onUp = {-                                    viewModel.navigateTree(-                                        repoName,-                                        browser.path.substringBeforeLast('/', ""),-                                    )-                                },-                            )-                            treeError?.let { error ->-                                ErrorState(-                                    title = "Could not load files",-                                    message = friendlyErrorMessage(error),-                                    retryLabel = "Retry",-                                    onRetry = { treeRetry++ },-                                )-                            }-                        }-                    }-                }-                if (treeLoading) {-                    item {-                        Text(-                            "Loading files…",-                            modifier = Modifier.fillMaxWidth().height(120.dp),-                        )-                    }-                } else {-                    val visible = entries.filter { it.name.contains(filter, ignoreCase = true) }-                    if (visible.isEmpty()) {-                        item {-                            Text(-                                if (filter.isBlank()) "No files" else "No files match \"$filter\".",-                                modifier = Modifier.padding(horizontal = Spacing.lg),-                                color = MaterialTheme.colorScheme.onSurfaceVariant,-                            )-                        }-                    }-                    items(visible) { entry ->-                        TreeEntryRow(-                            entry = entry,-                            onClick = {-                                if (entry.isDir) {-                                    viewModel.navigateTree(repoName, entry.path)-                                } else {-                                    onOpenFile(browser.branch, entry.path)-                                }-                            },-                        )-                    }-                }-                item {-                    Button(-                        onClick = {-                            ExternalIntents.openUrl(context, "https://git.maproj.org/$repoName")-                        },-                        modifier = Modifier.fillMaxWidth().padding(horizontal = Spacing.lg),-                    ) {-                        IconGlobe()-                        Text("View on git host", modifier = Modifier.padding(start = Spacing.sm))-                    }-                }-            }-        }-    }-}--private const val RECENT_COMMITS = 5--@Composable-private fun BreadcrumbRow(-    path: String,-    breadcrumbs: List<Pair<String, String>>,-    onNavigate: (String) -> Unit,-    onUp: () -> Unit,-) {-    if (path.isEmpty()) {-        Text(-            "Repository root",-            style = MaterialTheme.typography.bodySmall,-            color = MaterialTheme.colorScheme.onSurfaceVariant,-        )-        return-    }-    Row(-        horizontalArrangement = Arrangement.spacedBy(Spacing.xs),-        verticalAlignment = Alignment.CenterVertically,-        modifier = Modifier.fillMaxWidth(),-    ) {-        TextButton(onClick = { onNavigate("") }) { Text("Root") }-        for ((label, target) in breadcrumbs) {-            Text("/", color = MaterialTheme.colorScheme.onSurfaceVariant)-            TextButton(onClick = { onNavigate(target) }) { Text(label) }-        }-        TextButton(onClick = onUp) { Text("Up") }-    }-}--@Composable-private fun TreeEntryRow(entry: TreeEntry, onClick: () -> Unit) {-    val kind = DevPresentation.fileKindFor(entry.name, entry.isDir)-    ListItem(-        headlineContent = { Text(entry.name) },-        supportingContent = {-            Text(-                when {-                    entry.isDir -> "Folder"-                    entry.size != null -> "${entry.size} B"-                    else -> "File"-                },-            )-        },-        leadingContent = {-            when (kind) {-                FileKind.Folder -> IconFolder()-                FileKind.Code -> IconCode()-                FileKind.Markup, FileKind.Text -> IconDescription()-                FileKind.Image -> IconImage()-                FileKind.Archive, FileKind.Data -> IconFile()-                FileKind.Other -> IconFile()-            }-        },-        trailingContent = { IconChevronRight() },-        modifier = Modifier.clickable(onClick = onClick),+    RepoScreenContent(+        repoName = repoName,+        state = state,+        browser = browser,+        repo = repo,+        entries = entries,+        treeError = treeError,+        treeLoading = treeLoading,+        onBack = onBack,+        onSelectBranch = { viewModel.selectBranch(repoName, it) },+        onNavigateTree = { viewModel.navigateTree(repoName, it) },+        onOpenFile = onOpenFile,+        onOpenCommits = onOpenCommits,+        onOpenCommit = onOpenCommit,+        onRetryRepo = { viewModel.loadRepo(repoName) },+        onRetryTree = { treeRetry++ },     ) }
madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/RepoScreenContent.kt
diff --git a/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/RepoScreenContent.kt b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/RepoScreenContent.ktnew file mode 100644index 0000000000..78cf4ce041--- /dev/null+++ b/madeveloper/src/main/java/com/vayunmathur/madeveloper/ui/RepoScreenContent.kt@@ -0,0 +1,293 @@+package com.vayunmathur.madeveloper.ui++import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.items+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableIntStateOf+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.text.font.FontFamily+import com.vayunmathur.library.ui.AppScaffold+import com.vayunmathur.library.ui.Button+import com.vayunmathur.library.ui.DashboardSection+import com.vayunmathur.library.ui.DashboardSectionDivider+import com.vayunmathur.library.ui.ErrorState+import com.vayunmathur.library.ui.ExternalIntents+import com.vayunmathur.library.ui.IconChevronRight+import com.vayunmathur.library.ui.IconCode+import com.vayunmathur.library.ui.IconDescription+import com.vayunmathur.library.ui.IconFile+import com.vayunmathur.library.ui.IconFolder+import com.vayunmathur.library.ui.IconGlobe+import com.vayunmathur.library.ui.IconHistory+import com.vayunmathur.library.ui.IconImage+import com.vayunmathur.library.ui.IconLink+import com.vayunmathur.library.ui.ListItem+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.SelectDropdown+import com.vayunmathur.library.ui.Spacing+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.TextButton+import com.vayunmathur.library.ui.TextField+import com.vayunmathur.library.ui.friendlyError+import com.vayunmathur.library.ui.friendlyErrorMessage+import com.vayunmathur.madeveloper.domain.DevPresentation+import com.vayunmathur.madeveloper.domain.FileKind+import com.vayunmathur.madeveloper.domain.TreeEntry+import com.vayunmathur.madeveloper.platform.MaDevUiState+import com.vayunmathur.madeveloper.platform.MaDevViewModel++/** Stateless repository view, rendered by previews from literal state. */+@Composable+fun RepoScreenContent(+    repoName: String,+    state: MaDevUiState,+    browser: com.vayunmathur.madeveloper.domain.RepoBrowserState?,+    repo: com.vayunmathur.madeveloper.domain.GitRepo?,+    entries: List<TreeEntry>,+    treeError: String?,+    treeLoading: Boolean,+    onBack: () -> Unit,+    onSelectBranch: (String) -> Unit,+    onNavigateTree: (String) -> Unit,+    onOpenFile: (String, String) -> Unit,+    onOpenCommits: (String) -> Unit,+    onOpenCommit: (String, String) -> Unit,+    onRetryRepo: () -> Unit,+    onRetryTree: () -> Unit,+) {+    val context = LocalContext.current+    var filter by remember { mutableStateOf("") }+    AppScaffold(+        isRefreshing = browser == null || treeLoading,+        title = repoName,+        subtitle = repo?.defaultBranch?.takeIf { it.isNotBlank() }?.let { "Default branch $it" },+        onNavigateBack = onBack,+    ) { padding ->+        LazyColumn(+            Modifier.padding(padding),+            verticalArrangement = Arrangement.spacedBy(Spacing.md),+        ) {+            state.repoError?.let { error ->+                item {+                    ErrorState(+                        title = "Could not load this repository",+                        message = friendlyErrorMessage(error),+                        retryLabel = "Retry",+                        onRetry = onRetryRepo,+                    )+                }+            }+            if (browser == null) {+                if (state.repoError == null) {+                    item { Text("Loading repository…", modifier = Modifier.fillMaxWidth().height(160.dp)) }+                }+            } else {+                item {+                    DashboardSection(+                        title = "Repository",+                        leadingIcon = { modifier, tint -> IconCode(modifier, tint) },+                    ) {+                        ListItem(+                            headlineContent = {+                                Text(+                                    repo?.cloneUrl ?: "https://git.maproj.org/$repoName.git",+                                    fontFamily = FontFamily.Monospace,+                                    style = MaterialTheme.typography.bodySmall,+                                )+                            },+                            supportingContent = { Text("Clone URL") },+                            leadingContent = { IconLink() },+                        )+                        DashboardSectionDivider()+                        Row(+                            modifier = Modifier.fillMaxWidth().padding(Spacing.lg),+                            verticalAlignment = Alignment.CenterVertically,+                            horizontalArrangement = Arrangement.spacedBy(Spacing.sm),+                        ) {+                            Text("Branch", style = MaterialTheme.typography.titleSmall)+                            SelectDropdown(+                                label = browser.branch.ifBlank { "—" },+                                options = browser.branches.map { it.name },+                                selected = browser.branch,+                                itemLabel = { it },+                                onSelect = onSelectBranch,+                            )+                        }+                    }+                }+                item {+                    DashboardSection(+                        title = "Recent commits",+                        actionLabel = "All commits",+                        onAction = { onOpenCommits(browser.branch) },+                        leadingIcon = { modifier, tint -> IconHistory(modifier, tint) },+                    ) {+                        if (browser.commits.isEmpty()) {+                            Text(+                                "No commits",+                                modifier = Modifier.padding(Spacing.lg),+                                color = MaterialTheme.colorScheme.onSurfaceVariant,+                            )+                        }+                        browser.commits.take(RECENT_COMMITS).forEachIndexed { index, commit ->+                            if (index > 0) DashboardSectionDivider()+                            CommitRow(+                                commit = commit,+                                onClick = { onOpenCommit(browser.branch, commit.sha) },+                            )+                        }+                    }+                }+                item {+                    DashboardSection(+                        title = "Files",+                        leadingIcon = { modifier, tint -> IconFolder(modifier, tint) },+                    ) {+                        Column(+                            modifier = Modifier.padding(Spacing.lg),+                            verticalArrangement = Arrangement.spacedBy(Spacing.sm),+                        ) {+                            TextField(+                                value = filter, onValueChange = { filter = it },+                                label = { Text("Filter files") }, modifier = Modifier.fillMaxWidth(),+                            )+                            BreadcrumbRow(+                                path = browser.path,+                                breadcrumbs = browser.breadcrumbs,+                                onNavigate = onNavigateTree,+                                onUp = {+                                    onNavigateTree(browser.path.substringBeforeLast('/', ""))+                                },+                            )+                            treeError?.let { error ->+                                ErrorState(+                                    title = "Could not load files",+                                    message = friendlyErrorMessage(error),+                                    retryLabel = "Retry",+                                    onRetry = onRetryTree,+                                )+                            }+                        }+                    }+                }+                if (treeLoading) {+                    item {+                        Text(+                            "Loading files…",+                            modifier = Modifier.fillMaxWidth().height(120.dp),+                        )+                    }+                } else {+                    val visible = entries.filter { it.name.contains(filter, ignoreCase = true) }+                    if (visible.isEmpty()) {+                        item {+                            Text(+                                if (filter.isBlank()) "No files" else "No files match \"$filter\".",+                                modifier = Modifier.padding(horizontal = Spacing.lg),+                                color = MaterialTheme.colorScheme.onSurfaceVariant,+                            )+                        }+                    }+                    items(visible) { entry ->+                        TreeEntryRow(+                            entry = entry,+                            onClick = {+                                if (entry.isDir) {+                                    onNavigateTree(entry.path)+                                } else {+                                    onOpenFile(browser.branch, entry.path)+                                }+                            },+                        )+                    }+                }+                item {+                    Button(+                        onClick = {+                            ExternalIntents.openUrl(context, "https://git.maproj.org/$repoName")+                        },+                        modifier = Modifier.fillMaxWidth().padding(horizontal = Spacing.lg),+                    ) {+                        IconGlobe()+                        Text("View on git host", modifier = Modifier.padding(start = Spacing.sm))+                    }+                }+            }+        }+    }+}++private const val RECENT_COMMITS = 5++@Composable+private fun BreadcrumbRow(+    path: String,+    breadcrumbs: List<Pair<String, String>>,+    onNavigate: (String) -> Unit,+    onUp: () -> Unit,+) {+    if (path.isEmpty()) {+        Text(+            "Repository root",+            style = MaterialTheme.typography.bodySmall,+            color = MaterialTheme.colorScheme.onSurfaceVariant,+        )+        return+    }+    Row(+        horizontalArrangement = Arrangement.spacedBy(Spacing.xs),+        verticalAlignment = Alignment.CenterVertically,+        modifier = Modifier.fillMaxWidth(),+    ) {+        TextButton(onClick = { onNavigate("") }) { Text("Root") }+        for ((label, target) in breadcrumbs) {+            Text("/", color = MaterialTheme.colorScheme.onSurfaceVariant)+            TextButton(onClick = { onNavigate(target) }) { Text(label) }+        }+        TextButton(onClick = onUp) { Text("Up") }+    }+}++@Composable+private fun TreeEntryRow(entry: TreeEntry, onClick: () -> Unit) {+    val kind = DevPresentation.fileKindFor(entry.name, entry.isDir)+    ListItem(+        headlineContent = { Text(entry.name) },+        supportingContent = {+            Text(+                when {+                    entry.isDir -> "Folder"+                    entry.size != null -> "${entry.size} B"+                    else -> "File"+                },+            )+        },+        leadingContent = {+            when (kind) {+                FileKind.Folder -> IconFolder()+                FileKind.Code -> IconCode()+                FileKind.Markup, FileKind.Text -> IconDescription()+                FileKind.Image -> IconImage()+                FileKind.Archive, FileKind.Data -> IconFile()+                FileKind.Other -> IconFile()+            }+        },+        trailingContent = { IconChevronRight() },+        modifier = Modifier.clickable(onClick = onClick),+    )+}
madeveloper/src/screenshotTest/kotlin/com/vayunmathur/madeveloper/ui/MetadataPreviews.kt
diff --git a/madeveloper/src/screenshotTest/kotlin/com/vayunmathur/madeveloper/ui/MetadataPreviews.kt b/madeveloper/src/screenshotTest/kotlin/com/vayunmathur/madeveloper/ui/MetadataPreviews.ktindex 244da50f06..1205383e83 100644--- a/madeveloper/src/screenshotTest/kotlin/com/vayunmathur/madeveloper/ui/MetadataPreviews.kt+++ b/madeveloper/src/screenshotTest/kotlin/com/vayunmathur/madeveloper/ui/MetadataPreviews.kt@@ -4,13 +4,63 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview import com.android.tools.screenshot.PreviewTest import com.vayunmathur.library.ui.DynamicTheme+import com.vayunmathur.madeveloper.domain.CatalogApp+import com.vayunmathur.madeveloper.domain.GitBranch+import com.vayunmathur.madeveloper.domain.GitCommit+import com.vayunmathur.madeveloper.domain.GitFile+import com.vayunmathur.madeveloper.domain.GitIssue+import com.vayunmathur.madeveloper.domain.GitPr import com.vayunmathur.madeveloper.domain.GitRepo+import com.vayunmathur.madeveloper.domain.RepoBrowserState+import com.vayunmathur.madeveloper.domain.TestRun+import com.vayunmathur.madeveloper.domain.TestsStatus+import com.vayunmathur.madeveloper.domain.TreeEntry import com.vayunmathur.madeveloper.platform.MaDevUiState  /** Store-listing previews for MA Developer. */ private const val PHONE = "spec:width=411dp,height=891dp,dpi=420" -/** Renders the listing screenshots from static state. */+/** Fixed instant for relative-time labels, so captures are byte-identical. */+private const val NOW = 1_700_000_000_000L++private val SampleCommit = GitCommit(+    sha = "abc12345def67890abc12345def67890abc12345",+    author = "Vayun Mathur",+    time = "2023-11-14T22:13:20Z",+    subject = "Demo commit",+    body = "A sample commit body for the listing capture.",+)++private val SampleRepo = GitRepo("Modern-Apps", "main", "abc12345", "Demo commit", "2023-11-14T22:13:20Z")++private val SampleBrowser = RepoBrowserState(+    repoName = "Modern-Apps",+    branch = "main",+    branches = listOf(GitBranch("main", "abc12345")),+    path = "",+    commits = listOf(SampleCommit),+    commitsExhausted = false,+)++private val SampleState = MaDevUiState(+    repos = listOf(SampleRepo),+    pairingCode = "ABC234",+    issues = listOf(+        GitIssue("vayun-mathur/Modern-Apps", 42, "Sample issue title", "sample-author", 3, listOf("bug"), "2023-11-14T22:13:20Z"),+    ),+    prs = listOf(GitPr("vayun-mathur/Modern-Apps", 7, "Sample pull request", "sample-author")),+    tests = TestsStatus(+        latest = TestRun("run-2", "abc12345", "Demo commit", "passed", 0, 128, 240),+        running = null,+        history = listOf(TestRun("run-1", "12345abc", "Earlier commit", "passed", 0, 126, 231)),+        coveragePct = 71.5,+    ),+    catalog = listOf(+        CatalogApp("com.example.demo", "Demo App", "Sample catalog entry", "1.2.3", 123, 4_200_000, "demo.apk"),+    ),+)++/** Renders the listing screenshots from static state: one capture per `Route`. */ class MetadataPreviews {     @PreviewTest     @Preview(name = "1-home", device = PHONE, group = "phone", showSystemUi = true)@@ -18,10 +68,138 @@ class MetadataPreviews {     fun PreviewHome() {         DynamicTheme(darkTheme = true) {             HomeScreen(-                state = MaDevUiState(repos = listOf(GitRepo("Modern-Apps", "main", "abc12345", "Demo commit", "2026-11-16T00:00:00Z")), pairingCode = "ABC234"),+                state = SampleState,                 onRefresh = {}, onOpenRepo = {}, onOpenTests = {}, onOpenCatalog = {}, onOpenPush = {},                 onOpenIssues = {}, onOpenPrs = {},             )         }     }++    @PreviewTest+    @Preview(name = "2-repo", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun PreviewRepo() {+        DynamicTheme(darkTheme = true) {+            RepoScreenContent(+                repoName = "Modern-Apps",+                state = SampleState,+                browser = SampleBrowser,+                repo = SampleRepo,+                entries = listOf(+                    TreeEntry("notes", "notes", isDir = true, size = null),+                    TreeEntry("README.md", "README.md", isDir = false, size = 2048),+                ),+                treeError = null,+                treeLoading = false,+                onBack = {},+                onSelectBranch = {},+                onNavigateTree = {},+                onOpenFile = { _, _ -> },+                onOpenCommits = {},+                onOpenCommit = { _, _ -> },+                onRetryRepo = {},+                onRetryTree = {},+            )+        }+    }++    @PreviewTest+    @Preview(name = "3-commits", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun PreviewCommits() {+        DynamicTheme(darkTheme = true) {+            CommitsScreenContent(+                repoName = "Modern-Apps",+                branch = "main",+                browser = SampleBrowser,+                repoError = null,+                onBack = {},+                onRefresh = {},+                onOpenCommit = {},+                onLoadMore = {},+            )+        }+    }++    @PreviewTest+    @Preview(name = "4-commit", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun PreviewCommit() {+        DynamicTheme(darkTheme = true) {+            CommitScreenContent(+                repoName = "Modern-Apps",+                sha = SampleCommit.sha,+                commit = SampleCommit,+                nowMillis = NOW,+                onBack = {},+            )+        }+    }++    @PreviewTest+    @Preview(name = "5-file", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun PreviewFile() {+        DynamicTheme(darkTheme = true) {+            FileScreenContent(+                repoName = "Modern-Apps",+                path = "notes/README.md",+                branch = "main",+                file = GitFile(+                    path = "notes/README.md",+                    size = 42,+                    content = "# Demo\n\nSample file content for the capture.\n",+                    sha = "abc12345",+                ),+                error = null,+                onBack = {},+                onRetry = {},+            )+        }+    }++    @PreviewTest+    @Preview(name = "6-issues", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun PreviewIssues() {+        DynamicTheme(darkTheme = true) {+            IssuesScreen(state = SampleState, onOpenIssue = {}, onBack = {})+        }+    }++    @PreviewTest+    @Preview(name = "7-prs", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun PreviewPrs() {+        DynamicTheme(darkTheme = true) {+            PullRequestsScreen(state = SampleState, onOpenPr = {}, onBack = {})+        }+    }++    @PreviewTest+    @Preview(name = "8-tests", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun PreviewTests() {+        DynamicTheme(darkTheme = true) {+            TestsScreen(state = SampleState, onBack = {})+        }+    }++    @PreviewTest+    @Preview(name = "9-catalog", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun PreviewCatalog() {+        DynamicTheme(darkTheme = true) {+            CatalogScreen(state = SampleState, onBack = {})+        }+    }++    @PreviewTest+    @Preview(name = "10-push", device = PHONE, group = "phone", showSystemUi = true)+    @Composable+    fun PreviewPush() {+        DynamicTheme(darkTheme = true) {+            PushScreen(state = SampleState, onInstall = {}, onBack = {})+        }+    } }