feat: Add avatar deletion functionality and update ProfileScreen to handle avatar presence

This commit is contained in:
2026-01-30 03:36:01 +05:00
parent 7691926ef6
commit 5091eb557a
4 changed files with 149 additions and 29 deletions

View File

@@ -1137,8 +1137,12 @@ fun ProfilePhotoMenu(
expanded: Boolean,
onDismiss: () -> Unit,
isDarkTheme: Boolean,
onSetPhotoClick: () -> Unit
onSetPhotoClick: () -> Unit,
onDeletePhotoClick: (() -> Unit)? = null,
hasAvatar: Boolean = false
) {
val dividerColor = if (isDarkTheme) Color.White.copy(alpha = 0.1f) else Color.Black.copy(alpha = 0.08f)
DropdownMenu(
expanded = expanded,
onDismissRequest = onDismiss,
@@ -1156,6 +1160,25 @@ fun ProfilePhotoMenu(
tintColor = if (isDarkTheme) Color.White else Color.Black,
textColor = if (isDarkTheme) Color.White else Color.Black
)
// Показываем Delete только если есть аватар
if (hasAvatar && onDeletePhotoClick != null) {
Box(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 4.dp)
.height(0.5.dp)
.background(dividerColor)
)
ProfilePhotoMenuItem(
icon = TablerIcons.Trash,
text = "Delete Photo",
onClick = onDeletePhotoClick,
tintColor = Color(0xFFFF3B30),
textColor = Color(0xFFFF3B30)
)
}
}
}