Remove Add Transaction feature and clean all related code
Deleted files: - AddTransactionView.swift - TransactionRepository.swift - Transaction+CoreDataClass.swift Cleaned files: - SourceDetailViewModel: removed transactions published property, showingAddTransaction flag, transactionRepository dependency, addTransaction() and deleteTransaction() methods - SourceDetailView: removed transactionsSection, TransactionRow struct, Add Transaction button from quickActions, sheet presentation - InvestmentSource+CoreDataClass: removed transactions NSManaged property, transactionsArray, totalInvested, totalDividends, totalFees computed properties, and all transaction Core Data accessors - SettingsViewModel: removed "Transaction" from resetAllData entity list - SampleDataService: removed transactionRepository and sample transaction Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -105,6 +105,28 @@ extension Color {
|
||||
return Color(hex: hex) ?? .blue
|
||||
}
|
||||
|
||||
// MARK: - Source Colors (distinct per-source palette, different order from categories)
|
||||
|
||||
static let sourceColors: [String] = [
|
||||
"#6366F1", // Indigo
|
||||
"#F97316", // Orange
|
||||
"#06B6D4", // Cyan
|
||||
"#EF4444", // Red
|
||||
"#84CC16", // Lime
|
||||
"#EC4899", // Pink
|
||||
"#14B8A6", // Teal
|
||||
"#F59E0B", // Amber
|
||||
"#8B5CF6", // Purple
|
||||
"#3B82F6", // Blue
|
||||
"#A855F7", // Violet
|
||||
"#10B981", // Green
|
||||
]
|
||||
|
||||
static func sourceColor(at index: Int) -> Color {
|
||||
let hex = sourceColors[index % sourceColors.count]
|
||||
return Color(hex: hex) ?? .blue
|
||||
}
|
||||
|
||||
// MARK: - Chart Colors
|
||||
|
||||
static let chartColors: [Color] = categoryColors.compactMap { Color(hex: $0) }
|
||||
|
||||
@@ -136,6 +136,18 @@ extension Date {
|
||||
return formatter.localizedString(for: self, relativeTo: Date())
|
||||
}
|
||||
|
||||
var relativeDayDescription: String {
|
||||
let calendar = Calendar.current
|
||||
let days = calendar.dateComponents([.day], from: calendar.startOfDay(for: self), to: calendar.startOfDay(for: Date())).day ?? 0
|
||||
if days == 0 { return String(localized: "date_today") }
|
||||
if days == 1 { return "1d ago" }
|
||||
if days < 31 { return "\(days)d ago" }
|
||||
let months = calendar.dateComponents([.month], from: self, to: Date()).month ?? 0
|
||||
if months < 12 { return "\(max(1, months))mo ago" }
|
||||
let years = calendar.dateComponents([.year], from: self, to: Date()).year ?? 0
|
||||
return "\(max(1, years))y ago"
|
||||
}
|
||||
|
||||
var friendlyDescription: String {
|
||||
if isToday {
|
||||
return String(localized: "date_today")
|
||||
|
||||
Reference in New Issue
Block a user