fix: dynamic new tag for import button#3941
Conversation
WalkthroughRefactors PrimaryButton and PrimaryButtonView to accept generic view builders instead of icon strings, enabling flexible composition. Updates consumers to use the new API. Adds iOS font helper and dynamic sizing logic in CreateVaultView to address language-change layout issues. Changes
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
VultisigApp/VultisigApp/DesignSystem/Fonts/FontStyle.swift (1)
21-25: Consider explicit UIKit import and weight-preserving fallback.Two minor observations:
UIFontis used without an explicitUIKitimport. While this compiles because SwiftUI transitively exposes UIKit types on iOS, an explicit import would be clearer and more future-proof.The fallback
.systemFont(ofSize: size)uses the default (regular) weight. If font loading ever fails forbrockmanBoldorbrockmanSemibold, the fallback won't preserve the intended weight.💡 Suggested improvement
import SwiftUI +#if os(iOS) +import UIKit +#endif enum FontStyle: String, CaseIterable { // ... `#if` os(iOS) - func uiFont(_ size: CGFloat) -> UIFont { - UIFont(name: fontName, size: size) ?? .systemFont(ofSize: size) + func uiFont(_ size: CGFloat) -> UIFont { + UIFont(name: fontName, size: size) ?? .systemFont(ofSize: size, weight: uiFontWeight) + } + + private var uiFontWeight: UIFont.Weight { + switch self { + case .brockmanBold: return .bold + case .brockmanSemibold: return .semibold + case .brockmanMedium, .satoshiMedium: return .medium + case .brockmanRegular: return .regular + } } `#endif`🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@VultisigApp/VultisigApp/DesignSystem/Fonts/FontStyle.swift` around lines 21 - 25, Add an explicit UIKit import and update the iOS fallback in uiFont(_ size: CGFloat) to preserve weight: import UIKit at the top, then in uiFont use UIFont(name: fontName, size: size) ?? UIFont.systemFont(ofSize: size, weight: <determine weight from fontName>), where you map known fontName values like "brockmanBold" -> .bold and "brockmanSemibold" -> .semibold (default to .regular for others); keep the function name uiFont and the fontName identifier so the change is easy to locate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@VultisigApp/VultisigApp/Views/New` Wallet/CreateVaultView.swift:
- Around line 134-152: canFitFullNewTag currently uses
UIScreen.main.bounds.width which breaks adaptive layouts (Split View/Stage
Manager); change it to compute buttonWidth from the actual container width
passed in via layout (use GeometryReader or a PreferenceKey to capture the
parent container width) and then recompute buttonWidth = (containerWidth - 48 -
8) / 2; keep the same contentWidth calculation but reference the computed
container-derived buttonWidth in canFitFullNewTag; update any callers of
canFitFullNewTag or the view body to supply the measured container width (e.g.,
store containerWidth in state via PreferenceKey or capture it inside a
GeometryReader) so the measurement reflects the app’s usable width on iPad.
---
Nitpick comments:
In `@VultisigApp/VultisigApp/DesignSystem/Fonts/FontStyle.swift`:
- Around line 21-25: Add an explicit UIKit import and update the iOS fallback in
uiFont(_ size: CGFloat) to preserve weight: import UIKit at the top, then in
uiFont use UIFont(name: fontName, size: size) ?? UIFont.systemFont(ofSize: size,
weight: <determine weight from fontName>), where you map known fontName values
like "brockmanBold" -> .bold and "brockmanSemibold" -> .semibold (default to
.regular for others); keep the function name uiFont and the fontName identifier
so the change is easy to locate.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
VultisigApp/VultisigApp/DesignSystem/Fonts/FontStyle.swiftVultisigApp/VultisigApp/Views/Components/ActionBanner/ActionBannerView.swiftVultisigApp/VultisigApp/Views/Components/Buttons/PrimaryButton/PrimaryButton.swiftVultisigApp/VultisigApp/Views/Components/Buttons/PrimaryButton/PrimaryButtonView.swiftVultisigApp/VultisigApp/Views/New Wallet/CreateVaultView.swift
Description
Please include a summary of the change and which issue is fixed.
Fixes #3921
Which feature is affected?
Checklist
Screenshots (if applicable):
Additional context
Summary by CodeRabbit
Release Notes
New Features
Improvements