package com.img.rabbit.pages.screen.mine

import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import com.img.rabbit.R

@Composable
fun OnlineServiceScreen(navController: NavHostController) {
    Scaffold{
        Column(
            modifier = Modifier.fillMaxSize().padding(it)
        ) {
            // 顶部栏
            Row(
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(16.dp),
                verticalAlignment = Alignment.CenterVertically
            ) {
                // 返回按钮
                Icon(
                    painter = painterResource(id = R.mipmap.ic_back),
                    contentDescription = "返回",
                    modifier = Modifier
                        .clickable(
                            indication = null,
                            interactionSource = remember { MutableInteractionSource() }
                        ) { navController.popBackStack() }
                        .padding(end = 16.dp)
                )
                Column(
                    modifier = Modifier.fillMaxWidth().padding(end = 26.dp)
                ) {

                    Text(
                        text = "",
                        color = Color(0xFF1A1A1A),
                        fontSize = 16.sp,
                        fontWeight = FontWeight.Bold,
                        modifier = Modifier.align(Alignment.CenterHorizontally)
                    )
                }
            }
            Box(
                modifier = Modifier.fillMaxWidth().padding(end = 26.dp)
            ){
                //TODO 在线客服内容
            }
        }
    }
}

@Preview(showBackground = true)
@Composable
private fun PreviewOnlineServiceScreen(){
    OnlineServiceScreen(navController = rememberNavController())
}