package com.suno.android.ui.screens.home.notifications import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.withStyle import com.suno.android.common_networking.remote.entities.MiniProfileSchema fun List.xFormatHandlesAnnotated(): AnnotatedString = buildAnnotatedString { val boldStyle = SpanStyle(fontWeight = FontWeight.Bold) when (size) { 0 -> append("") 1 -> withStyle(boldStyle) { val name = first().displayName val handle = first().handle val tag = "user_handle_$handle" pushStringAnnotation(tag = tag, annotation = handle) append(name) } 2 -> { withStyle(boldStyle) { val name = first().displayName val handle = first().handle val tag = "user_handle_$handle" pushStringAnnotation(tag = tag, annotation = handle) append(name) } append(" and ") withStyle(boldStyle) { val name = last().displayName val handle = last().handle val tag = "user_handle_$handle" pushStringAnnotation(tag = tag, annotation = handle) append(name) } } else -> { withStyle(boldStyle) { val name = first().displayName val handle = first().handle val tag = "user_handle_$handle" pushStringAnnotation(tag = tag, annotation = handle) append(name) } append(" and ") withStyle(boldStyle) { append("${size - 1} others") } } } }