package com.aiosman.ravenow.ui.composables

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import com.aiosman.ravenow.entity.MomentEntity

@Composable
fun RelPostCard(
    momentEntity: MomentEntity,
    modifier: Modifier = Modifier,
) {
    val image = momentEntity.images.firstOrNull()
    val context = LocalContext.current
    Column(
        modifier = modifier
    ) {
        MomentTopRowGroup(momentEntity = momentEntity)
        Box(
            modifier=Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
        ) {
            image?.let {
                CustomAsyncImage(
                    context,
                    image.thumbnail,
                    contentDescription = null,
                    modifier = Modifier.size(100.dp),
                    contentScale = ContentScale.Crop
                )
            }
        }
    }
}