package com.ys.bdtp.adm.mvvm.ui.screen.offline

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.ys.bdtp.adm.mvvm.ui.compose.Head
import com.ys.bdtp.adm.mvvm.ui.compose.HeadRight
import com.ys.bdtp.adm.mvvm.ui.screen.main.LocalNavHostController
import com.ys.bdtp.adm.mvvm.vm.offline.OfflineViewModel
import org.kodein.di.compose.rememberViewModel

@Composable
fun Offline(projectId: String) {
    val nav = LocalNavHostController.current!!
    val vm by rememberViewModel<OfflineViewModel>()
    val scope = rememberCoroutineScope()
    Column(modifier = Modifier.background(Color.White)) {
        Head(
            left = { OfflineHeadLeft(nav) },
            right = {
                HeadRight(
                    role = { "业务角色" },
                    click = {}
                )
            }
        )

        Spacer(
            modifier = Modifier
                .height(1.dp)
                .fillMaxWidth()
                .background(Color(0xFFEFF0F1))
        )

        Row {
            OfflineSide2(projectId)
            Spacer(
                modifier = Modifier
                    .width(1.dp)
                    .fillMaxHeight()
                    .background(Color(0xFFEFF0F1))
            )
            Column(
                modifier = Modifier
                    .fillMaxSize()
                    .padding(horizontal = 32.dp, vertical = 12.dp)
            ) {
                OfflineContent()
            }
        }

    }
}

@Preview(widthDp = 1137, heightDp = 711)
@Composable
fun PreviewOfflineScreen() {
    //Offline()
}