Add shared utilities and refactor iOS codebase for DRY compliance
Create centralized shared utilities in iosApp/Shared/: - Extensions: ViewExtensions, DateExtensions, StringExtensions, DoubleExtensions - Components: FormComponents, SharedEmptyStateView, ButtonStyles - Modifiers: CardModifiers - Utilities: ValidationHelpers, ErrorMessages Migrate existing views to use shared utilities: - LoginView: Use IconTextField, FieldLabel, FieldError, OrganicPrimaryButton - TaskFormView: Use .loadingOverlay() modifier - TaskCard/DynamicTaskCard: Use .toFormattedDate() extension - CompletionCardView: Use .toCurrency() (with KotlinDouble support) - ResidenceDetailView: Use OrganicEmptyState, StandardLoadingView - Profile views: Use .standardFormStyle(), .sectionBackground() - Form views: Use consistent form styling modifiers Benefits: - Eliminates ~180 lines of duplicate code - Consistent styling across all forms and components - KotlinDouble extensions for seamless KMM interop - Single source of truth for UI patterns 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,7 +76,7 @@ struct ContractorFormSheet: View {
|
||||
.font(.caption)
|
||||
.foregroundColor(Color.appError)
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
|
||||
// Residence (Optional)
|
||||
Section {
|
||||
@@ -104,7 +104,7 @@ struct ContractorFormSheet: View {
|
||||
: String(format: L10n.Contractors.residenceFooterShared, selectedResidenceName ?? ""))
|
||||
.font(.caption)
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
|
||||
// Contact Information
|
||||
Section {
|
||||
@@ -142,7 +142,7 @@ struct ContractorFormSheet: View {
|
||||
} header: {
|
||||
Text(L10n.Contractors.contactInfoSection)
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
|
||||
// Specialties (Multi-select)
|
||||
Section {
|
||||
@@ -171,7 +171,7 @@ struct ContractorFormSheet: View {
|
||||
} header: {
|
||||
Text(L10n.Contractors.specialtiesSection)
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
|
||||
// Address
|
||||
Section {
|
||||
@@ -212,7 +212,7 @@ struct ContractorFormSheet: View {
|
||||
} header: {
|
||||
Text(L10n.Contractors.addressSection)
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
|
||||
// Notes
|
||||
Section {
|
||||
@@ -233,7 +233,7 @@ struct ContractorFormSheet: View {
|
||||
Text(L10n.Contractors.notesFooter)
|
||||
.font(.caption)
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
|
||||
// Favorite
|
||||
Section {
|
||||
@@ -243,7 +243,7 @@ struct ContractorFormSheet: View {
|
||||
}
|
||||
.tint(Color.appAccent)
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
|
||||
// Error Message
|
||||
if let error = viewModel.errorMessage {
|
||||
@@ -256,7 +256,7 @@ struct ContractorFormSheet: View {
|
||||
.foregroundColor(Color.appError)
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
}
|
||||
}
|
||||
.listStyle(.plain)
|
||||
@@ -325,7 +325,7 @@ struct ContractorFormSheet: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
|
||||
// Residences
|
||||
if let residences = residenceViewModel.myResidences?.residences {
|
||||
@@ -345,7 +345,7 @@ struct ContractorFormSheet: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
}
|
||||
} else if residenceViewModel.isLoading {
|
||||
HStack {
|
||||
@@ -353,7 +353,7 @@ struct ContractorFormSheet: View {
|
||||
ProgressView()
|
||||
Spacer()
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
}
|
||||
}
|
||||
.listStyle(.plain)
|
||||
@@ -395,7 +395,7 @@ struct ContractorFormSheet: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.listRowBackground(Color.appBackgroundSecondary)
|
||||
.sectionBackground()
|
||||
}
|
||||
}
|
||||
.listStyle(.plain)
|
||||
|
||||
Reference in New Issue
Block a user