Skip to content

refactor(core): replace MaterialTheme with KptMaterialTheme#2615

Merged
biplab1 merged 9 commits intoopenMF:developmentfrom
amanna13:refactor/incorporate-kpt-theme
Feb 24, 2026
Merged

refactor(core): replace MaterialTheme with KptMaterialTheme#2615
biplab1 merged 9 commits intoopenMF:developmentfrom
amanna13:refactor/incorporate-kpt-theme

Conversation

@amanna13
Copy link
Copy Markdown
Member

@amanna13 amanna13 commented Feb 20, 2026

Fixes - Jira-#MIFOSAC-602

Didn't create a Jira ticket, click here to create new.

Screen_recording_20260220_145211.mp4

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the static analysis check ./gradlew check or ci-prepush.sh to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them.

Summary by CodeRabbit

  • New Features

    • Added extensive adaptive Material3 and window support for improved responsive layouts.
  • Style

    • Large migration to a unified design token system: new strokes, sizes, paddings, shapes, and spacing tokens used across UI.
    • Many components updated to use tokenized sizes, colors and typography for consistent styling.
  • Refactor

    • Multiple component defaults and theme integration migrated to the new design theme; one dialog gained an optional click handler.
  • Chores

    • Dependency updates: minor annotation patch and numerous Compose/JetBrains adaptive/runtime artifacts added.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

Migrates many UI components from MaterialTheme and hard-coded dp to KptTheme and DesignToken tokens, expands DesignToken (sizes, spacing, strokes, shapes, elevations), exposes coreBase.designsystem via an API dependency, adjusts a few public defaults/signatures, and adds numerous Compose Material3 adaptive and JetBrains Compose dependencies to Android runtime classpaths.

Changes

Cohort / File(s) Summary
Dependency updates
cmp-android/dependencies/.../demoDebugRuntimeClasspath.txt, .../demoReleaseRuntimeClasspath.txt, .../prodDebugRuntimeClasspath.txt, .../prodReleaseRuntimeClasspath.txt
Bumped androidx.annotation:annotation-experimental to 1.5.1 and added many androidx.compose.material3.adaptive, org.jetbrains.compose.* material3/adaptive artifacts and org.jetbrains.androidx.window:window-core (various 1.1.x–1.9.x / 1.2.0–1.4.0 versions).
Build visibility
core/designsystem/build.gradle.kts
Added api(projects.coreBase.designsystem) to expose the coreBase.designsystem module to consumers.
Design tokens & theme core
core/designsystem/src/.../theme/DesignToken.kt, .../Theme.kt, .../MifosBackground.kt
Introduced AppStrokes and LocalStrokes; large expansions to AppSpacing, AppPadding, AppShapes, AppElevation, AppSizes; integrated KptTheme/KptMaterialTheme and aligned tonalElevation/defaults to KptTheme.
Global component theming migration
core/designsystem/src/.../component/*, core/ui/src/.../components/*
Replaced MaterialTheme colors/typography and literal dp values with KptTheme and DesignToken tokens across dialogs, buttons, cards, tabs, text fields, top bars, navigation, previews, utilities, and previews; many default parameter values updated to token/theme equivalents.
Public API / default changes
core/designsystem/src/.../component/MifosSweetError.kt, .../scrollbar/Scrollbar.kt, core/ui/src/.../components/MifosItemCard.kt
Added onclick: () -> Unit = {} to MifosSweetError; changed Scrollbar default minThumbSize to DesignToken.sizes.minThumbSizeDp40; updated MifosItemCard default elevation and shape to KptTheme.elevation.level1 and DesignToken.shapes.small.
Sizes & strokes centralization
multiple files under core/designsystem/... and core/ui/...
Replaced many hardcoded sizes/strokes (e.g., 48/100/256/500 dp, 1/2/4 dp) with DesignToken.sizes, DesignToken.padding, and DesignToken.strokes tokens.
Previews & tooling updates
various preview files (.../Previews.kt, AllUiComponentsPreview.kt, DesignSystemAllPreviews.kt)
Switched preview wrappers from MaterialTheme to KptTheme and adjusted preview sizes/usages to use DesignToken values.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • biplab1
  • therajanmaurya

Poem

🐰
I hopped through tokens, swapped dp for tune,
KptTheme stitched colors under a silver moon.
Padding and strokes march in neat array,
Components wake brighter for the new day,
Hop, code, hooray — the UI blooms soon!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.91% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main refactoring: replacing MaterialTheme with KptMaterialTheme across the core module. This is the primary change reflected throughout the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt (1)

488-504: ⚠️ Potential issue | 🟠 Major

LocalStrokes is never provided in DesignTokenTheme, breaking the pattern for all other token families.

DesignTokenTheme provides LocalSpacing, LocalPadding, LocalShapes, LocalElevation, and LocalSizes via CompositionLocalProvider — but omits LocalStrokes despite it being defined as a staticCompositionLocalOf at line 449. This means DesignToken.strokes always returns the default AppStrokes() and cannot be customized through the theme, unlike all other token families.

Add strokes: AppStrokes = AppStrokes() as a function parameter and include LocalStrokes provides strokes in the CompositionLocalProvider block to match the existing pattern.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`
around lines 488 - 504, DesignTokenTheme currently omits providing LocalStrokes
so DesignToken.strokes always falls back to the default; add a parameter
strokes: AppStrokes = AppStrokes() to DesignTokenTheme and include LocalStrokes
provides strokes in the CompositionLocalProvider alongside LocalSpacing,
LocalPadding, LocalShapes, LocalElevation, and LocalSizes so the strokes token
family can be customized via the theme (refer to DesignTokenTheme, LocalStrokes,
AppStrokes, and DesignToken.strokes to locate the relevant code).
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosBottomSheet.kt (1)

200-208: ⚠️ Potential issue | 🟡 Minor

Modifier.height(...) expression is discarded — preview renders an empty Box.

The Modifier.height(DesignToken.sizes.imageDp100) call inside the Box composable lambda evaluates to a Modifier value that is immediately thrown away. The Box has no size constraint applied, so the preview shows nothing. This is a pre-existing bug that this PR is touching; since the line is already being changed, it's a good opportunity to fix it.

🐛 Proposed fix
-            Box {
-                Modifier.height(DesignToken.sizes.imageDp100)
-            }
+            Box(modifier = Modifier.height(DesignToken.sizes.imageDp100)) {}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosBottomSheet.kt`
around lines 200 - 208, The Box in MifosBottomSheetPreview is discarding the
Modifier (Modifier.height(...)) because it's placed as a standalone expression
inside the content lambda; change the Box to accept the modifier (e.g.,
Box(modifier = Modifier.height(DesignToken.sizes.imageDp100)) or use a Spacer
with that modifier) so the height is applied and the preview renders correctly —
update the MifosBottomSheetPreview function (and the Box call) accordingly.
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosOtpTextField.kt (1)

53-106: ⚠️ Potential issue | 🟡 Minor

New KptTheme/DesignToken changes are clean — pre-existing println logs OTP data.

Line 77 (pre-existing, not part of this diff):

println("OTP: $otpText and $isError")

otpText is a live authentication code. println on Android writes to logcat, where it is readable by apps holding READ_LOGS and captured in bugreports. This debug log should be removed.

🛡️ Proposed fix
-                    println("OTP: $otpText and $isError")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosOtpTextField.kt`
around lines 53 - 106, Remove the debug println that exposes the OTP in
MifosOtpTextField: locate the println("OTP: $otpText and $isError") inside the
KeyboardActions.onDone block in the BasicTextField (within MifosOtpTextField)
and delete it so the OTP value is not written to logcat; if you need tracing
keep only non-sensitive state (e.g., a boolean flag) or use secure telemetry
(not printing the OTP itself) and ensure onOtpTextCorrectlyEntered is still
invoked as before.
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosSearchBar.kt (1)

106-117: ⚠️ Potential issue | 🟡 Minor

Preview will crash at render time — missing MifosTheme wrapper.

Before this PR, MaterialTheme.colorScheme.* was used and Compose Tooling provides implicit MaterialTheme defaults for previews. After the migration to KptTheme.colorScheme.*, the LocalKptColors CompositionLocal must be explicitly provided. The current preview calls MifosSearchBar bare, without a MifosTheme {} (or KptTheme {}) wrapper, so the local will not be present and the preview will throw at render time.

🛠️ Proposed fix
 `@Preview`
 `@Composable`
 private fun MifosSearchBarPreview() {
     var text by remember { mutableStateOf("") }
 
+    MifosTheme {
         MifosSearchBar(
             query = text,
             onQueryChange = { text = it },
             onBackClick = { },
             onSearchClick = { println("Searching for $it") },
         )
+    }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosSearchBar.kt`
around lines 106 - 117, The preview MifosSearchBarPreview is crashing because it
renders MifosSearchBar without the required theme CompositionLocal
(LocalKptColors) after migrating to KptTheme; wrap the preview content in the
appropriate theme provider (e.g., MifosTheme or KptTheme) so the LocalKptColors/
colorScheme is present before calling MifosSearchBar in MifosSearchBarPreview,
ensuring onPreview rendering uses the same theme wrapper as runtime.
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosListingComponent.kt (1)

661-672: ⚠️ Potential issue | 🟡 Minor

MifosDefaultListingComponentPreview still wraps with MifosTheme instead of KptTheme

Every other preview in the file (lines 677–799) uses the KptTheme composable wrapper after the migration, but this one remains on MifosTheme. This inconsistency means the preview renders with different theming than the rest and will look out of place once the duplicate-import issue above is resolved.

🔧 Proposed fix
-    MifosTheme {
+    KptThemeWrapper {   // or KptTheme once the alias is applied
         MifosDefaultListingComponent(data = sampleData)
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosListingComponent.kt`
around lines 661 - 672, The preview function MifosDefaultListingComponentPreview
is still wrapped with MifosTheme instead of the migrated KptTheme; update the
composable wrapper in MifosDefaultListingComponentPreview to use KptTheme (while
keeping the sampleData and the MifosDefaultListingComponent call unchanged) so
the preview matches the other previews' theming.
🧹 Nitpick comments (12)
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/PrintTextUtil.kt (1)

24-25: Color migration looks correct; consider completing the typography migration in a follow-up.

The KptTheme.colorScheme.onSurface replacement is a clean, correct swap. The style fallback at Line 25 still references MifosTypography.bodySmall. While mixed usage is intentional per the project's incremental migration strategy, migrating this to KptTheme.typography.bodySmall would fully complete this component's migration and allow removing the MifosTypography import.

♻️ Optional: Fully migrate to KptTheme
-import com.mifos.core.designsystem.theme.MifosTypography
 import template.core.base.designsystem.theme.KptTheme

 `@Composable`
 fun PrintTextUtil(
     item: TextUtil,
 ) {
     Text(
         text = item.text,
         color = item.color ?: KptTheme.colorScheme.onSurface,
-        style = item.style ?: MifosTypography.bodySmall,
+        style = item.style ?: KptTheme.typography.bodySmall,
     )
 }

Based on learnings, the typography hierarchy simplification when migrating to KptTheme (e.g., bodySmallKptTheme.typography.bodySmall) is an intentional design decision in this project's migration approach.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/PrintTextUtil.kt`
around lines 24 - 25, The typography fallback still uses
MifosTypography.bodySmall; update the PrintTextUtil component to use
KptTheme.typography.bodySmall as the default for item.style (replace the
MifosTypography.bodySmall reference with KptTheme.typography.bodySmall) and
remove the now-unused MifosTypography import so the component fully migrates to
KptTheme.typography.
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosSweetError.kt (2)

72-72: Redundant lambda wrappers — simplify to onClick = onclick.

{ onclick() } is an unnecessary indirection around a function reference already of the right type.

♻️ Proposed simplification (both sites)
-            onClick = { onclick() },
+            onClick = onclick,

Apply the same change at Line 107 in MifosPaginationSweetError.

Also applies to: 107-107

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosSweetError.kt`
at line 72, The onClick assignment in MifosSweetError (and similarly in
MifosPaginationSweetError) wraps the existing function reference in an
unnecessary lambda (`onClick = { onclick() }`); replace these with a direct
function reference (`onClick = onclick`) to remove the redundant wrapper and
keep the handler type intact.

76-76: Both occurrences are in the same file; correct the namespace inconsistency for uniform Modifier.padding semantics.

Line 76 uses DesignToken.spacing.largeIncreased while line 112 uses DesignToken.padding.largeIncreased for identical horizontal padding on button text. Both resolve to 20.dp, but the namespace inconsistency creates unclear intent within the same component.

Use DesignToken.padding.largeIncreased consistently on both lines for semantic accuracy with Modifier.padding().

♻️ Proposed fix for Line 76
-                    modifier = Modifier.padding(start = DesignToken.spacing.largeIncreased, end = DesignToken.spacing.largeIncreased),
+                    modifier = Modifier.padding(start = DesignToken.padding.largeIncreased, end = DesignToken.padding.largeIncreased),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosSweetError.kt`
at line 76, The Modifier.padding call in MifosSweetError.kt uses
DesignToken.spacing.largeIncreased at one occurrence and
DesignToken.padding.largeIncreased at another, creating a namespace
inconsistency; update the occurrence that uses
DesignToken.spacing.largeIncreased to use DesignToken.padding.largeIncreased so
both Modifier.padding(...) calls reference DesignToken.padding.largeIncreased
consistently (look for the Modifier.padding usage around the button text and
change the symbol from DesignToken.spacing.largeIncreased to
DesignToken.padding.largeIncreased).
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosOutlinedTextField.kt (1)

84-84: Incomplete migration: three MifosTypography references left behind

The migration converts all other typography references to KptTheme.typography.*, but these three usages in the first and fourth overloads were missed, producing inconsistent styling across the overloads of the same component.

♻️ Proposed fix
-// Line 84 (first overload label)
-                style = MifosTypography.bodySmall,
+                style = KptTheme.typography.bodySmall,

-// Line 426 (fourth overload default textStyle parameter)
-    textStyle: TextStyle = MifosTypography.bodyLarge,
+    textStyle: TextStyle = KptTheme.typography.bodyLarge,

-// Line 480 (fourth overload supportingText)
-                    style = MifosTypography.bodySmall,
+                    style = KptTheme.typography.bodySmall,

Also applies to: 426-426, 480-480

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosOutlinedTextField.kt`
at line 84, In MifosOutlinedTextField replace the remaining MifosTypography
references with the KptTheme.typography equivalents (e.g., change
MifosTypography.bodySmall -> KptTheme.typography.bodySmall) so all overloads use
the same themed typography; update each occurrence in the first and fourth
overloads where the style parameter uses MifosTypography to use
KptTheme.typography instead, ensuring consistent styling across the component.
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosEmptyUi.kt (1)

57-57: Consider consolidating the 72dp size token under a semantically neutral name.

DesignToken.sizes.profile (72dp) is used for multiple unrelated UI elements: empty-state icons, status dialog icons, document preview icons, and button heights—not just profile avatars. This creates unintended semantic coupling. The codebase already follows a convention of using raw dp-named tokens (imageDp60, imageDp96, etc.) for generic reuse, but no dp72 equivalent currently exists. Either introduce a new neutral token (e.g., iconDp72 or sizeDp72) and migrate usages, or accept the current pattern as intentional cross-concern reuse.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosEmptyUi.kt`
at line 57, Refactor the hardcoded semantic token by adding a neutral 72dp token
(e.g., DesignToken.sizes.iconDp72 or DesignToken.sizes.sizeDp72) and replace
usages that are not profile-specific — locate references such as
DesignToken.sizes.profile in MifosEmptyUi (and other components using 72dp for
empty-state icons, status dialog icons, document previews, and button heights)
and switch them to the new neutral token; keep any true avatar/profile usages on
DesignToken.sizes.profile only. Ensure the new token follows existing token
naming conventions and update any imports or documentation/comments accordingly.
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosViewPdf.kt (2)

43-43: onPrimary is semantically incorrect for a background — consider surface instead.

onPrimary is a foreground color intended for content rendered on top of a primary-colored surface (e.g. white text on a colored button). On-colors are primarily applied to text, iconography, and strokes — onPrimary appears on top of the primary color, not as a background itself. Using it as a Box background works accidentally in light themes (where onPrimary is typically white), but Material's ColorScheme distinguishes surface and background as the designated tokens for container/page backgrounds — in dark themes, onPrimary is typically black or near-black, rendering PDF page content invisible.

This issue pre-dates this PR, but the migration is a good opportunity to fix the semantic.

♻️ Suggested token swap
-                    .background(KptTheme.colorScheme.onPrimary),
+                    .background(KptTheme.colorScheme.surface),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosViewPdf.kt`
at line 43, The Box background is using the foreground token
KptTheme.colorScheme.onPrimary which is semantically wrong for a container;
update the background call in MifosViewPdf (the composable where
.background(KptTheme.colorScheme.onPrimary) is used) to use the appropriate
surface/background token (e.g., KptTheme.colorScheme.surface or
KptTheme.colorScheme.background) via KptTheme.colorScheme so page content
remains visible in dark mode and follows Material semantics.

43-43: Use a semantically appropriate background token.

onPrimary is a foreground color intended for content placed on top of primary-colored surfaces (e.g., text on a button). Using it as a Box background is semantically incorrect per Material Design principles—background surfaces should use surface or related tokens, while onPrimary is reserved for contrasting content.

♻️ Suggested token swap
-                    .background(KptTheme.colorScheme.onPrimary),
+                    .background(KptTheme.colorScheme.surface),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosViewPdf.kt`
at line 43, The Box in MifosViewPdf is using a foreground token
(KptTheme.colorScheme.onPrimary) as a background; change that to a semantically
correct surface/background token (e.g., replace KptTheme.colorScheme.onPrimary
with KptTheme.colorScheme.surface or another appropriate surface variant like
surfaceVariant/background) in the modifier.background call so the component uses
a background color token instead of a foreground/onPrimary token.
core/designsystem/build.gradle.kts (1)

48-48: Consider implementation instead of api for coreBase.designsystem.

KptTheme's concrete types (Color, TextStyle) do not appear in the module's public API signatures — they come from Compose, not coreBase.designsystem. Using api leaks this dependency transitively to every module that depends on core.designsystem. implementation is sufficient unless downstream modules need to directly reference KptTheme APIs by type.

If the intention is specifically to allow all feature modules to import KptTheme without explicit declarations (as a migration convenience), api is a deliberate trade-off worth calling out in a comment.

♻️ Suggested change if transitive exposure is not intended
-            api(projects.coreBase.designsystem)
+            implementation(projects.coreBase.designsystem)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/designsystem/build.gradle.kts` at line 48, The dependency on
projects.coreBase.designsystem is currently declared as api which unnecessarily
exposes its types transitively; update the dependency in core.designsystem's
build.gradle.kts to implementation(projects.coreBase.designsystem) unless you
intentionally want to expose KptTheme to downstream modules; if the transitive
exposure is deliberate (to let features import KptTheme without declaring the
dependency), keep api but add a clear inline comment explaining that the api is
a conscious migration convenience and references KptTheme, Color, and TextStyle.
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt (2)

102-110: Duplicate dp values between semantic and custom spacing tokens.

dp6 (6.dp) duplicates mediumSmall (line 91), and dp24 (24.dp) duplicates largeMediumIncreased (line 96). While the raw dp-naming convention is understood and accepted, having two fields with identical default values in the same data class can cause confusion about which to use. Consider adding inline comments cross-referencing the semantic equivalent, or consolidating where possible.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`
around lines 102 - 110, DesignToken defines duplicate raw and semantic spacing
values (dp6 == mediumSmall and dp24 == largeMediumIncreased); update the
DesignToken data class to eliminate confusion by either consolidating duplicates
(remove dp6 and dp24 and use mediumSmall and largeMediumIncreased everywhere) or
by adding inline comments on the dp6 and dp24 fields that reference their
semantic equivalents (mediumSmall, largeMediumIncreased) so callers know which
semantic token to prefer; modify usages accordingly to reference the semantic
names if consolidating.

350-392: boxDp107 uses a fractional dp value (107.33333.dp) — verify this is intentional.

Line 380: val boxDp107: Dp = 107.33333.dp — fractional dp values suggest this was derived from a pixel calculation (e.g., dividing a screen width by 3). If so, consider using Modifier.weight() or fraction-based layout instead of a hardcoded fractional dp, which won't adapt to different screen densities/sizes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`
around lines 350 - 392, boxDp107 is defined with a fractional dp literal (val
boxDp107: Dp = 107.33333.dp) which likely came from a pixel division and won't
scale well across densities; change this by either replacing the hardcoded
fractional dp with an integer dp constant or by removing this token and
computing the size at layout time using fraction-based APIs (e.g.,
Modifier.weight/FillMaxWidth with fractions) or converting a pixel-derived value
to dp at runtime using LocalDensity/with(LocalDensity.current) in the consuming
composable. Update references to boxDp107 to use the new approach (the token
name boxDp107 or a small helper function that computes the dp) so layouts adapt
correctly rather than relying on the fixed 107.33333.dp literal.
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/scrollbar/AppScrollbars.kt (1)

220-224: Minor inconsistency in Color.copy() argument style.

Line 222 passes the alpha value positionally (copy(0.5f)), while line 223 uses a named argument (copy(alpha = 0.2f)). Both are correct, but aligning them improves readability.

✨ Proposed consistency fix
-            Active -> KptTheme.colorScheme.onSurface.copy(0.5f)
+            Active -> KptTheme.colorScheme.onSurface.copy(alpha = 0.5f)
             Inactive -> KptTheme.colorScheme.onSurface.copy(alpha = 0.2f)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/scrollbar/AppScrollbars.kt`
around lines 220 - 224, The animateColorAsState targetValue uses inconsistent
Color.copy() argument styles; change the positional call in the Active branch to
a named argument to match Inactive. Update the Active branch inside the
animateColorAsState expression (state branches Active, Inactive, Dormant) to
call KptTheme.colorScheme.onSurface.copy(alpha = 0.5f) so both branches use
named "alpha" for readability and consistency.
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosProgressIndicator.kt (1)

115-116: Use Modifier.size() instead of redundant .width() + .height() for equal dimensions.

♻️ Proposed refactor
-                .width(DesignToken.sizes.imageDp40)
-                .height(DesignToken.sizes.imageDp40)
+                .size(DesignToken.sizes.imageDp40)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosProgressIndicator.kt`
around lines 115 - 116, Replace the redundant
.width(DesignToken.sizes.imageDp40).height(DesignToken.sizes.imageDp40) call
chain with a single .size(DesignToken.sizes.imageDp40) in the
MifosProgressIndicator composable so the Modifier uses Modifier.size(...) for
equal width/height; locate the modifier chain in MifosProgressIndicator.kt and
update the Modifier invocation accordingly (remove the two calls and use .size
with the same DesignToken.sizes.imageDp40 value).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmp-android/dependencies/demoReleaseRuntimeClasspath.txt`:
- Around line 407-409: The version catalog value material3adaptive in
gradle/libs.versions.toml is pinned to 1.1.2 and must be updated to 1.2.0 to
match CMP 1.9.3 and the Jetpack Material3 Adaptive artifacts; open
gradle/libs.versions.toml, find the material3adaptive entry and change its value
from "1.1.2" to "1.2.0", then re-sync/build to ensure the resolved dependencies
(org.jetbrains.compose.material3.adaptive:adaptive*,
androidx.compose.material3.adaptive:adaptive*) are aligned.

In `@cmp-android/dependencies/prodReleaseRuntimeClasspath.txt`:
- Around line 407-409: The Compose adaptive artifacts
(org.jetbrains.compose.material3.adaptive:adaptive*, currently pinned as
material3adaptive = 1.1.2 in the version catalog) are out of sync with CMP 1.9.3
and Android adaptive (1.2.0); update the version catalog entry for the
material3adaptive key to 1.2.0 if the earlier "1.2.0-rc01" bug no longer
applies, or if you must keep 1.1.2, add a clear TODO comment in the
libs.versions.toml next to the material3adaptive entry explaining the exact
incompatibility (including the bug ID/version tested) and open an issue to track
upgrading to 1.2.0 so the cross-platform skew is resolved or documented.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosOutlinedTextField.kt`:
- Around line 217-223: The helper/info branch in MifosOutlinedTextField (the
else if (message != null) branch that renders Text with errorTextTag and
KptTheme.typography.labelSmall) incorrectly uses KptTheme.colorScheme.error;
change the color to the appropriate non-error token (e.g.,
KptTheme.colorScheme.onSurfaceVariant or the designated helper/tertiary text
color in your theme) so that `message` is rendered as informational helper text
rather than an error; update only the color parameter for that Text call.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosSweetError.kt`:
- Line 78: Two similar error composables use inconsistent typography:
MifosSweetError sets its button text style to KptTheme.typography.labelLarge
while MifosPaginationSweetError uses KptTheme.typography.bodyLarge; update
MifosPaginationSweetError to use labelLarge for its button text to match
Material conventions and the sibling composable (search for
MifosPaginationSweetError and change the text style reference from bodyLarge to
labelLarge so both components are visually consistent).

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosTopBar.kt`:
- Line 52: The top bar uses an explicitly transparent background (containerColor
= KptTheme.colorScheme.surface.copy(alpha = 0f)) which hides the bar; update the
MifosTopBar implementation to use the opaque surface color instead by removing
the .copy(alpha = 0f) so containerColor references KptTheme.colorScheme.surface
(matching MifosTopAppBar) to restore a visible background.

In `@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/EmptyDataView.kt`:
- Around line 55-61: The two EmptyDataView overloads (the icon-based and the
image-based variants in the EmptyDataView composable) use different typography
(one uses KptTheme.typography.labelSmall, the other
KptTheme.typography.labelMedium); make them consistent by choosing one style and
applying it to both Text calls (update the Text in the icon-based overload that
currently uses labelSmall to use the chosen KptTheme.typography value, or update
the image-based overload if you prefer labelSmall) so both overloads render with
the same typography.

In
`@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosAllUiComponentsPreview.kt`:
- Around line 37-38: The file imports two different symbols named KptTheme (the
composable function and the theme-accessor object), causing an ambiguous import;
fix this by aliasing one import (e.g., alias the composable function import to
KptThemeWrapper) and then update every composable usage KptTheme { … } to
KptThemeWrapper { … } while leaving references like
KptTheme.typography.bodyMedium intact so the theme-accessor object name remains
KptTheme.

In
`@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosFilePickerBottomSheet.kt`:
- Around line 26-27: Duplicate imports for KptTheme cause an ambiguous
reference; keep the object import
(template.core.base.designsystem.theme.KptTheme) for usages like
KptTheme.colorScheme.onPrimary and alias the composable function import
(template.core.base.designsystem.KptTheme) to a distinct name (e.g.,
KptThemeComposable) so you can call the composable at the usage site (the block
that currently calls KptTheme { ... }) without colliding with the theme object;
update the composable call to use the alias.

In
`@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosGeneralCard.kt`:
- Around line 30-31: Two different symbols named KptTheme are imported causing a
name clash: the composable function template.core.base.designsystem.KptTheme and
the theme object template.core.base.designsystem.theme.KptTheme; alias one of
the imports (for example alias the object as KptThemeObj or the composable as
KptThemeComposable) and update usages accordingly (replace KptTheme.colorScheme
with KptThemeObj.colorScheme or replace the composable call KptTheme { ... }
with KptThemeComposable { ... } depending on which you aliased) so both the
object accessor and the composable function can coexist without compilation
errors.

In
`@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosListingComponent.kt`:
- Around line 76-77: The duplicate imports of KptTheme cause an ambiguous import
error; fix it by aliasing the composable wrapper import (e.g., import
template.core.base.designsystem.KptTheme as KptThemeComposable) and leave the
token object import (template.core.base.designsystem.theme.KptTheme) unchanged,
then update every preview body that currently calls KptTheme { … } to call the
aliased composable name (KptThemeComposable { … }) so token access via
KptTheme.colorScheme / KptTheme.spacing continues to refer to the theme object.

In
`@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosProgressIndicator.kt`:
- Around line 39-40: Remove the conflicting import of
template.core.base.designsystem.KptTheme (the composable wrapper) and stop
importing two different KptTheme symbols; then replace the preview wrapper call
that uses KptTheme { } with the existing MifosTheme { } wrapper used elsewhere
in this file so the theme object template.core.base.designsystem.theme.KptTheme
remains the only KptTheme import and the composable wrapper is consistently
MifosTheme in the preview.

---

Outside diff comments:
In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosBottomSheet.kt`:
- Around line 200-208: The Box in MifosBottomSheetPreview is discarding the
Modifier (Modifier.height(...)) because it's placed as a standalone expression
inside the content lambda; change the Box to accept the modifier (e.g.,
Box(modifier = Modifier.height(DesignToken.sizes.imageDp100)) or use a Spacer
with that modifier) so the height is applied and the preview renders correctly —
update the MifosBottomSheetPreview function (and the Box call) accordingly.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosOtpTextField.kt`:
- Around line 53-106: Remove the debug println that exposes the OTP in
MifosOtpTextField: locate the println("OTP: $otpText and $isError") inside the
KeyboardActions.onDone block in the BasicTextField (within MifosOtpTextField)
and delete it so the OTP value is not written to logcat; if you need tracing
keep only non-sensitive state (e.g., a boolean flag) or use secure telemetry
(not printing the OTP itself) and ensure onOtpTextCorrectlyEntered is still
invoked as before.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`:
- Around line 488-504: DesignTokenTheme currently omits providing LocalStrokes
so DesignToken.strokes always falls back to the default; add a parameter
strokes: AppStrokes = AppStrokes() to DesignTokenTheme and include LocalStrokes
provides strokes in the CompositionLocalProvider alongside LocalSpacing,
LocalPadding, LocalShapes, LocalElevation, and LocalSizes so the strokes token
family can be customized via the theme (refer to DesignTokenTheme, LocalStrokes,
AppStrokes, and DesignToken.strokes to locate the relevant code).

In
`@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosListingComponent.kt`:
- Around line 661-672: The preview function MifosDefaultListingComponentPreview
is still wrapped with MifosTheme instead of the migrated KptTheme; update the
composable wrapper in MifosDefaultListingComponentPreview to use KptTheme (while
keeping the sampleData and the MifosDefaultListingComponent call unchanged) so
the preview matches the other previews' theming.

In
`@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosSearchBar.kt`:
- Around line 106-117: The preview MifosSearchBarPreview is crashing because it
renders MifosSearchBar without the required theme CompositionLocal
(LocalKptColors) after migrating to KptTheme; wrap the preview content in the
appropriate theme provider (e.g., MifosTheme or KptTheme) so the LocalKptColors/
colorScheme is present before calling MifosSearchBar in MifosSearchBarPreview,
ensuring onPreview rendering uses the same theme wrapper as runtime.

---

Nitpick comments:
In `@core/designsystem/build.gradle.kts`:
- Line 48: The dependency on projects.coreBase.designsystem is currently
declared as api which unnecessarily exposes its types transitively; update the
dependency in core.designsystem's build.gradle.kts to
implementation(projects.coreBase.designsystem) unless you intentionally want to
expose KptTheme to downstream modules; if the transitive exposure is deliberate
(to let features import KptTheme without declaring the dependency), keep api but
add a clear inline comment explaining that the api is a conscious migration
convenience and references KptTheme, Color, and TextStyle.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosOutlinedTextField.kt`:
- Line 84: In MifosOutlinedTextField replace the remaining MifosTypography
references with the KptTheme.typography equivalents (e.g., change
MifosTypography.bodySmall -> KptTheme.typography.bodySmall) so all overloads use
the same themed typography; update each occurrence in the first and fourth
overloads where the style parameter uses MifosTypography to use
KptTheme.typography instead, ensuring consistent styling across the component.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosSweetError.kt`:
- Line 72: The onClick assignment in MifosSweetError (and similarly in
MifosPaginationSweetError) wraps the existing function reference in an
unnecessary lambda (`onClick = { onclick() }`); replace these with a direct
function reference (`onClick = onclick`) to remove the redundant wrapper and
keep the handler type intact.
- Line 76: The Modifier.padding call in MifosSweetError.kt uses
DesignToken.spacing.largeIncreased at one occurrence and
DesignToken.padding.largeIncreased at another, creating a namespace
inconsistency; update the occurrence that uses
DesignToken.spacing.largeIncreased to use DesignToken.padding.largeIncreased so
both Modifier.padding(...) calls reference DesignToken.padding.largeIncreased
consistently (look for the Modifier.padding usage around the button text and
change the symbol from DesignToken.spacing.largeIncreased to
DesignToken.padding.largeIncreased).

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/scrollbar/AppScrollbars.kt`:
- Around line 220-224: The animateColorAsState targetValue uses inconsistent
Color.copy() argument styles; change the positional call in the Active branch to
a named argument to match Inactive. Update the Active branch inside the
animateColorAsState expression (state branches Active, Inactive, Dormant) to
call KptTheme.colorScheme.onSurface.copy(alpha = 0.5f) so both branches use
named "alpha" for readability and consistency.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`:
- Around line 102-110: DesignToken defines duplicate raw and semantic spacing
values (dp6 == mediumSmall and dp24 == largeMediumIncreased); update the
DesignToken data class to eliminate confusion by either consolidating duplicates
(remove dp6 and dp24 and use mediumSmall and largeMediumIncreased everywhere) or
by adding inline comments on the dp6 and dp24 fields that reference their
semantic equivalents (mediumSmall, largeMediumIncreased) so callers know which
semantic token to prefer; modify usages accordingly to reference the semantic
names if consolidating.
- Around line 350-392: boxDp107 is defined with a fractional dp literal (val
boxDp107: Dp = 107.33333.dp) which likely came from a pixel division and won't
scale well across densities; change this by either replacing the hardcoded
fractional dp with an integer dp constant or by removing this token and
computing the size at layout time using fraction-based APIs (e.g.,
Modifier.weight/FillMaxWidth with fractions) or converting a pixel-derived value
to dp at runtime using LocalDensity/with(LocalDensity.current) in the consuming
composable. Update references to boxDp107 to use the new approach (the token
name boxDp107 or a small helper function that computes the dp) so layouts adapt
correctly rather than relying on the fixed 107.33333.dp literal.

In `@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosEmptyUi.kt`:
- Line 57: Refactor the hardcoded semantic token by adding a neutral 72dp token
(e.g., DesignToken.sizes.iconDp72 or DesignToken.sizes.sizeDp72) and replace
usages that are not profile-specific — locate references such as
DesignToken.sizes.profile in MifosEmptyUi (and other components using 72dp for
empty-state icons, status dialog icons, document previews, and button heights)
and switch them to the new neutral token; keep any true avatar/profile usages on
DesignToken.sizes.profile only. Ensure the new token follows existing token
naming conventions and update any imports or documentation/comments accordingly.

In
`@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosProgressIndicator.kt`:
- Around line 115-116: Replace the redundant
.width(DesignToken.sizes.imageDp40).height(DesignToken.sizes.imageDp40) call
chain with a single .size(DesignToken.sizes.imageDp40) in the
MifosProgressIndicator composable so the Modifier uses Modifier.size(...) for
equal width/height; locate the modifier chain in MifosProgressIndicator.kt and
update the Modifier invocation accordingly (remove the two calls and use .size
with the same DesignToken.sizes.imageDp40 value).

In `@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosViewPdf.kt`:
- Line 43: The Box background is using the foreground token
KptTheme.colorScheme.onPrimary which is semantically wrong for a container;
update the background call in MifosViewPdf (the composable where
.background(KptTheme.colorScheme.onPrimary) is used) to use the appropriate
surface/background token (e.g., KptTheme.colorScheme.surface or
KptTheme.colorScheme.background) via KptTheme.colorScheme so page content
remains visible in dark mode and follows Material semantics.
- Line 43: The Box in MifosViewPdf is using a foreground token
(KptTheme.colorScheme.onPrimary) as a background; change that to a semantically
correct surface/background token (e.g., replace KptTheme.colorScheme.onPrimary
with KptTheme.colorScheme.surface or another appropriate surface variant like
surfaceVariant/background) in the modifier.background call so the component uses
a background color token instead of a foreground/onPrimary token.

In `@core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/PrintTextUtil.kt`:
- Around line 24-25: The typography fallback still uses
MifosTypography.bodySmall; update the PrintTextUtil component to use
KptTheme.typography.bodySmall as the default for item.style (replace the
MifosTypography.bodySmall reference with KptTheme.typography.bodySmall) and
remove the now-unused MifosTypography import so the component fully migrates to
KptTheme.typography.

Comment thread cmp-android/dependencies/demoReleaseRuntimeClasspath.txt
Comment thread cmp-android/dependencies/prodReleaseRuntimeClasspath.txt
Comment thread core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosItemCard.kt Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosCard.kt (1)

35-36: Migration to DesignToken.strokes.none and KptTheme.elevation.level1 looks correct.

Both changes correctly adopt the design token / KptTheme system in place of raw 0.dp / 1.dp literals. The elevation migration directly applies the previously suggested KptTheme.elevation.level1.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosCard.kt`
around lines 35 - 36, The migration in MifosCard updating the borderStroke
parameter to BorderStroke(DesignToken.strokes.none, Color.Transparent) and
elevation to KptTheme.elevation.level1 is correct; no code changes required—keep
the updated parameter values in the MifosCard component (borderStroke and
elevation) as shown.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosCard.kt`:
- Around line 35-36: The migration in MifosCard updating the borderStroke
parameter to BorderStroke(DesignToken.strokes.none, Color.Transparent) and
elevation to KptTheme.elevation.level1 is correct; no code changes required—keep
the updated parameter values in the MifosCard component (borderStroke and
elevation) as shown.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ef0c91 and 2d2d01b.

📒 Files selected for processing (3)
  • core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosCard.kt
  • core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/component/MifosNavigation.kt
  • core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosItemCard.kt

@amanna13 amanna13 requested a review from kartikey004 February 23, 2026 15:17
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt (2)

394-405: tableCellWidth* properties are semantically misplaced in AppStrokes

tableCellWidthSmall/Medium/Large (65 dp, 100 dp, 150 dp) are layout dimensions, not stroke/border widths. Now that the class is expanded with genuine stroke tokens and publicly exposed via DesignToken.strokes, consumers will encounter DesignToken.strokes.tableCellWidthSmall which is misleading. These three properties belong in AppSizes.

♻️ Proposed refactor: relocate table cell width tokens to `AppSizes`

Remove from AppStrokes:

 data class AppStrokes(
     val none: Dp = 0.dp,
     val dpPoint5: Dp = 0.5.dp,
     val thin: Dp = 1.dp,
     val dp2: Dp = 2.dp,
     val dp4: Dp = 4.dp,
     val dp5: Dp = 5.dp,
-    val tableCellWidthSmall: Dp = 65.dp,
-    val tableCellWidthMedium: Dp = 100.dp,
-    val tableCellWidthLarge: Dp = 150.dp,
 )

Add to AppSizes (under the // custom sizes section):

+    val tableCellWidthSmall: Dp = 65.dp,
+    val tableCellWidthMedium: Dp = 100.dp,
+    val tableCellWidthLarge: Dp = 150.dp,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`
around lines 394 - 405, The tableCellWidthSmall/Medium/Large tokens are
misplaced in AppStrokes (they are layout sizes, not stroke widths); remove the
three properties from the AppStrokes data class and add them as properties with
the same default values to AppSizes (place them in the "// custom sizes"
section), keep the `@Immutable/data` class pattern and public access via
DesignToken.sizes, and update any usage of DesignToken.strokes.tableCellWidth*
to DesignToken.sizes.tableCellWidth* so callers continue to work.

228-234: bottomCornerDp12 is an exact duplicate of pre-existing bottomMedium; LocalStrokes is missing KDoc

Two nits in the changed surface:

  1. bottomCornerDp12 = RoundedCornerShape(bottomStart = 12.dp, bottomEnd = 12.dp) (line 231) is byte-for-byte identical to the existing bottomMedium at line 227. Callers should use bottomMedium instead and bottomCornerDp12 can be removed to avoid confusion.

  2. LocalStrokes at line 452 is the only Local* val without a KDoc block — all others (LocalSpacing, LocalPadding, LocalShapes, LocalElevation, LocalSizes) document their purpose.

✨ Add KDoc to `LocalStrokes`
+/**
+ * CompositionLocal provider for accessing [AppStrokes] values throughout
+ * the composition tree.
+ *
+ * This provides a default instance of [AppStrokes] that can be overridden
+ * by providing a different value through [DesignTokenTheme].
+ */
 val LocalStrokes = staticCompositionLocalOf { AppStrokes() }

Also applies to: 452-452

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`
around lines 228 - 234, Remove the redundant shape bottomCornerDp12 (it
duplicates bottomMedium) and update any callers to use bottomMedium; delete the
bottomCornerDp12 declaration from DesignToken to avoid confusion. Also add a
KDoc comment for LocalStrokes similar to other Local* vals (e.g., describe that
LocalStrokes provides stroke/outline tokens for components) placed immediately
above the LocalStrokes declaration so it matches the project's documentation
style.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`:
- Line 452: DesignTokenTheme currently doesn't expose or provide LocalStrokes,
so strokes can't be overridden; add a strokes: AppStrokes parameter (with
default AppStrokes()) to the DesignTokenTheme constructor/function, include
LocalStrokes in the CompositionLocalProvider alongside
spacing/padding/shapes/elevation/sizes, and make DesignToken.strokes read from
LocalStrokes.current so callers can pass a custom strokes instance; update any
theme creation sites to use the new parameter default where needed (see symbols:
LocalStrokes, DesignTokenTheme, strokes, CompositionLocalProvider,
DesignToken.strokes, AppStrokes).
- Line 380: The token name boxDp107 is misleading because its value is
107.33333.dp; either rename the symbol to reflect the fractional value (e.g.,
boxDp107_33333 or boxDp107Point333) or change the value to a rounded integer
(107.dp) and update the constant accordingly; after deciding, update all
usages/references of boxDp107 across the codebase to the new name or to the
rounded value to keep names and values consistent (target the DesignToken.kt
constant named boxDp107 and any callers referencing it).

---

Nitpick comments:
In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`:
- Around line 394-405: The tableCellWidthSmall/Medium/Large tokens are misplaced
in AppStrokes (they are layout sizes, not stroke widths); remove the three
properties from the AppStrokes data class and add them as properties with the
same default values to AppSizes (place them in the "// custom sizes" section),
keep the `@Immutable/data` class pattern and public access via DesignToken.sizes,
and update any usage of DesignToken.strokes.tableCellWidth* to
DesignToken.sizes.tableCellWidth* so callers continue to work.
- Around line 228-234: Remove the redundant shape bottomCornerDp12 (it
duplicates bottomMedium) and update any callers to use bottomMedium; delete the
bottomCornerDp12 declaration from DesignToken to avoid confusion. Also add a
KDoc comment for LocalStrokes similar to other Local* vals (e.g., describe that
LocalStrokes provides stroke/outline tokens for components) placed immediately
above the LocalStrokes declaration so it matches the project's documentation
style.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2d2d01b and 8aa83eb.

📒 Files selected for processing (1)
  • core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt (2)

455-455: ⚠️ Potential issue | 🟠 Major

LocalStrokes is still not wired into DesignTokenThemeDesignToken.strokes is non-overridable

LocalStrokes is declared at line 455 but DesignTokenTheme (lines 494–511) does not accept a strokes parameter and does not include LocalStrokes in its CompositionLocalProvider. As a result, DesignToken.strokes always returns the hardcoded default and callers have no way to inject a custom AppStrokes instance through the theme, unlike every other token group.

Also applies to: 494-511

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`
at line 455, DesignToken.strokes is fixed to the default because
DesignTokenTheme does not accept or provide a strokes value; add a strokes:
AppStrokes = AppStrokes() parameter to DesignTokenTheme and include
LocalStrokes.provides(strokes) in the CompositionLocalProvider alongside the
other locals, and ensure DesignToken.strokes reads LocalStrokes.current so
callers can inject a custom AppStrokes via the theme.

383-383: ⚠️ Potential issue | 🟡 Minor

boxDp107 name still mismatches the fractional value 107.33333.dp

The token name implies an exact 107dp but the value is a repeating decimal. Either round the value or update the name to communicate the fractional precision.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`
at line 383, The token name boxDp107 in DesignToken.kt inaccurately implies
107dp while its value is 107.33333.dp; either round the value to 107.dp or
rename the token to reflect the fractional value (e.g., boxDp107_333 or
boxDp107_33) and update all references/usages accordingly so names and values
stay consistent; modify the declaration of boxDp107 (and any call sites) to use
the chosen name or rounded Dp value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`:
- Around line 102-110: Several newly added design tokens duplicate existing
semantic tokens; remove the duplicate declarations and replace all usages with
the established names. Specifically: delete AppSpacing.dp6 and use
AppSpacing.mediumSmall; delete AppSpacing.dp24 and use
AppSpacing.largeMediumIncreased; delete AppPadding.dp2 and use
AppPadding.extraExtraSmall; delete AppPadding.dp24 and use
AppPadding.largeIncreasedExtra; delete AppShapes.bottomCornerDp12 and use
AppShapes.bottomMedium; delete AppSizes.iconDp20 and use AppSizes.iconAverage;
update any call sites referencing the duplicate symbols to the corresponding
existing token names so the public API surface remains consistent.
- Around line 397-408: AppStrokes contains layout width tokens
(tableCellWidthSmall/Medium/Large) that belong in AppSizes; remove those three
properties from the AppStrokes data class and replace usages to reference
DesignToken.sizes.tableCellWidthSmall, DesignToken.sizes.tableCellWidthMedium
and DesignToken.sizes.tableCellWidthLarge instead (search for any callers
referencing AppStrokes.tableCellWidth* and update them to use
DesignToken.sizes.* to avoid breaking behavior).

---

Duplicate comments:
In
`@core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt`:
- Line 455: DesignToken.strokes is fixed to the default because DesignTokenTheme
does not accept or provide a strokes value; add a strokes: AppStrokes =
AppStrokes() parameter to DesignTokenTheme and include
LocalStrokes.provides(strokes) in the CompositionLocalProvider alongside the
other locals, and ensure DesignToken.strokes reads LocalStrokes.current so
callers can inject a custom AppStrokes via the theme.
- Line 383: The token name boxDp107 in DesignToken.kt inaccurately implies 107dp
while its value is 107.33333.dp; either round the value to 107.dp or rename the
token to reflect the fractional value (e.g., boxDp107_333 or boxDp107_33) and
update all references/usages accordingly so names and values stay consistent;
modify the declaration of boxDp107 (and any call sites) to use the chosen name
or rounded Dp value.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8aa83eb and 950bcec.

📒 Files selected for processing (1)
  • core/designsystem/src/commonMain/kotlin/com/mifos/core/designsystem/theme/DesignToken.kt

Copy link
Copy Markdown
Contributor

@biplab1 biplab1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. This can be merged.

@sonarqubecloud
Copy link
Copy Markdown

@biplab1 biplab1 enabled auto-merge (squash) February 24, 2026 12:26
@biplab1 biplab1 merged commit ae840ad into openMF:development Feb 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants