Skip to content

Commit

Permalink
[FEATURE]#74 : 차단된 리스트 목록 Ui 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongjaino committed Aug 3, 2024
1 parent e7bd5b8 commit 85d62e2
Showing 1 changed file with 82 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.bff.wespot.entire.screen.screen

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import com.bff.wespot.designsystem.component.header.WSTopBar
import com.bff.wespot.designsystem.theme.StaticTypeScale
import com.bff.wespot.designsystem.theme.WeSpotThemeManager
import com.bff.wespot.entire.R
import com.bff.wespot.entire.screen.state.EntireAction
import com.bff.wespot.entire.screen.viewmodel.EntireViewModel
import com.bff.wespot.ui.ReservedMessageItem
import com.ramcosta.composedestinations.annotation.Destination
import org.orbitmvi.orbit.compose.collectAsState

interface BlockListNavigator {
fun navigateUp()
}

@OptIn(ExperimentalMaterial3Api::class)
@Destination
@Composable
fun BlockListScreen(
navigator: BlockListNavigator,
viewModel: EntireViewModel = hiltViewModel(),
) {
val action = viewModel::onAction
val state by viewModel.collectAsState()

Scaffold(
topBar = {
WSTopBar(
title = "",
canNavigateBack = true,
navigateUp = { navigator.navigateUp() },
)
},
) {
Column(
modifier = Modifier.padding(it),
) {
Text(
modifier = Modifier.padding(bottom = 16.dp, start = 24.dp, end = 24.dp),
text = stringResource(R.string.block_list),
style = StaticTypeScale.Default.header1,
color = WeSpotThemeManager.colors.txtTitleColor,
)

LazyColumn(
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
items(state.blockList, key = { message -> message.id }) { item ->
ReservedMessageItem(
reservedMessage = item,
chipText = stringResource(R.string.unblock),
chipEnabled = item.id in state.unBlockList,
chipDisabledText = stringResource(R.string.unblock_done),
onClick = {
action(EntireAction.UnBlockMessage(item.id))
},
)
}
}
}
}

LaunchedEffect(Unit) {
action(EntireAction.OnBlockListScreenEntered)
}
}

0 comments on commit 85d62e2

Please sign in to comment.