fun TalkCard()

in ui-components/src/commonMain/kotlin/org/jetbrains/kotlinconf/ui/components/TalkCard.kt [117:208]


fun TalkCard(
    title: String,
    titleHighlights: List<IntRange>,
    bookmarked: Boolean,
    onBookmark: (Boolean) -> Unit,
    tags: Set<String>,
    tagHighlights: List<String>,
    speakers: String,
    speakerHighlights: List<IntRange>,
    location: String,
    lightning: Boolean,
    time: String,
    timeNote: String?,
    status: TalkStatus,
    initialEmotion: Emotion? = null,
    onSubmitFeedback: (Emotion?) -> Unit,
    onRequestFeedbackWithComment: (() -> Unit)?,
    onSubmitFeedbackWithComment: (Emotion, String) -> Unit,
    onClick: () -> Unit,
    feedbackEnabled: Boolean,
    userSignedIn: Boolean,
    modifier: Modifier = Modifier,
) {
    val backgroundColor by animateColorAsState(
        if (status == TalkStatus.Past) KotlinConfTheme.colors.cardBackgroundPast
        else Color.Transparent,
        animationSpec = tween(1000),
    )
    val textColor by animateColorAsState(
        if (status == TalkStatus.Past) KotlinConfTheme.colors.secondaryText
        else KotlinConfTheme.colors.primaryText,
        animationSpec = tween(1000),
    )
    val borderColor by animateColorAsState(
        if (bookmarked) KotlinConfTheme.colors.strokeHalf
        else KotlinConfTheme.colors.strokePale,
        animationSpec = tween(1000),
    )

    Column(
        modifier
            .border(width = 1.dp, color = borderColor, shape = KotlinConfTheme.shapes.roundedCornerMd)
            .clip(KotlinConfTheme.shapes.roundedCornerMd)
            .clickable(onClick = onClick)
            .background(backgroundColor)
    ) {
        TopBlock(
            title = title,
            titleHighlights = titleHighlights,
            textColor = textColor,
            bookmarked = bookmarked,
            onBookmark = onBookmark,
            tags = tags,
            selectedTags = tagHighlights,
            speakers = speakers,
            speakerHighlights = speakerHighlights,
            status = status,
        )
        Spacer(Modifier.weight(1f))
        Divider(
            thickness = 1.dp,
            color = KotlinConfTheme.colors.strokePale,
        )
        TimeBlock(
            location = location,
            textColor = textColor,
            timeNote = timeNote,
            status = status,
            lightning = lightning,
            time = time,
        )
        AnimatedVisibility(
            visible = feedbackEnabled,
            enter = fadeIn(tween(300, 70, EaseOut)) + expandVertically(tween(150, 0, EaseOut)),
            exit = fadeOut(tween(300, 70, EaseOut)) + shrinkVertically(tween(150, 0, EaseOut)),
        ) {
            Divider(
                thickness = 1.dp,
                color = KotlinConfTheme.colors.strokePale,
            )
            FeedbackBlock(
                status = status,
                userSignedIn = userSignedIn,
                initialEmotion = initialEmotion,
                onSubmitFeedback = onSubmitFeedback,
                onSubmitFeedbackWithComment = onSubmitFeedbackWithComment,
                onRequestFeedbackWithComment = onRequestFeedbackWithComment,
                isWorkshop = tags.contains("Workshop"),
            )
        }
    }
}