Implement fully dynamic task summary UI from API data
Updated both iOS and Android to build residence task summary UI entirely from API response data, with no hardcoded categories, icons, colors, or labels. **Changes:** **Backend Integration:** - Updated TaskSummary model to use dynamic categories list instead of static fields - Added TaskColumnCategory and TaskColumnIcon models for metadata - Categories now include: name, displayName, icons (ios/android/web), color, count **Android (ResidencesScreen.kt):** - Removed hardcoded category extraction (overdue_tasks, current_tasks, in_progress_tasks) - Now dynamically iterates over first 3 categories from API - Added getIconForCategory() helper to map icon names to Material Icons - Added parseHexColor() helper that works in commonMain (no Android-specific code) - Uses category.displayName, category.icons.android, category.color from API **iOS (ResidenceCard.swift):** - Removed hardcoded category extraction and SF Symbol names - Now dynamically iterates over first 3 categories using ForEach - Uses category.displayName, category.icons.ios, category.color from API - Leverages existing Color(hex:) extension for color parsing **Component Organization:** - Moved TaskSummaryCard.kt from commonMain to androidMain (uses Android-specific APIs) - Created TaskSummaryCard.swift for iOS with dynamic category rendering **Benefits:** ✅ Backend controls all category metadata (icons, colors, display names) ✅ Apps automatically reflect backend changes without redeployment ✅ No platform-specific hardcoded values ✅ Single source of truth in task/constants.py TASK_COLUMNS **Files Changed:** - Residence.kt: Added TaskColumnCategory, TaskColumnIcon models - ResidencesScreen.kt: Dynamic category rendering with helpers - ResidenceCard.swift: Dynamic category rendering with ForEach - TaskSummaryCard.kt: Moved to androidMain - TaskSummaryCard.swift: New iOS dynamic component 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -52,13 +52,26 @@ data class ResidenceCreateRequest(
|
||||
@SerialName("is_primary") val isPrimary: Boolean = false
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class TaskColumnIcon(
|
||||
val ios: String,
|
||||
val android: String,
|
||||
val web: String
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class TaskColumnCategory(
|
||||
val name: String,
|
||||
@SerialName("display_name") val displayName: String,
|
||||
val icons: TaskColumnIcon,
|
||||
val color: String,
|
||||
val count: Int
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class TaskSummary(
|
||||
val total: Int,
|
||||
val completed: Int,
|
||||
val pending: Int,
|
||||
@SerialName("in_progress") val inProgress: Int,
|
||||
val overdue: Int
|
||||
val categories: List<TaskColumnCategory>
|
||||
)
|
||||
|
||||
@Serializable
|
||||
|
||||
Reference in New Issue
Block a user