11package team.aliens.dms.android.feature.main.application
22
3- import android.R.id.tabs
43import androidx.compose.animation.AnimatedVisibility
54import androidx.compose.animation.animateContentSize
65import androidx.compose.animation.fadeIn
@@ -14,40 +13,31 @@ import androidx.compose.foundation.layout.Box
1413import androidx.compose.foundation.layout.Column
1514import androidx.compose.foundation.layout.PaddingValues
1615import androidx.compose.foundation.layout.Row
17- import androidx.compose.foundation.layout.Spacer
1816import androidx.compose.foundation.layout.fillMaxHeight
1917import androidx.compose.foundation.layout.fillMaxSize
2018import androidx.compose.foundation.layout.fillMaxWidth
2119import androidx.compose.foundation.layout.height
2220import androidx.compose.foundation.layout.padding
23- import androidx.compose.foundation.layout.size
24- import androidx.compose.foundation.layout.width
2521import androidx.compose.foundation.lazy.LazyColumn
2622import androidx.compose.foundation.lazy.items
2723import androidx.compose.foundation.pager.HorizontalPager
2824import androidx.compose.foundation.pager.rememberPagerState
29- import androidx.compose.foundation.shape.CircleShape
3025import androidx.compose.material3.Card
3126import androidx.compose.material3.CardDefaults
32- import androidx.compose.material3.Divider
3327import androidx.compose.material3.ExperimentalMaterial3Api
34- import androidx.compose.material3.Tab
3528import androidx.compose.material3.Text
3629import androidx.compose.runtime.Composable
3730import androidx.compose.runtime.getValue
38- import androidx.compose.runtime.mutableStateOf
31+ import androidx.compose.runtime.mutableIntStateOf
3932import androidx.compose.runtime.remember
4033import androidx.compose.runtime.setValue
4134import androidx.compose.ui.Alignment
4235import androidx.compose.ui.Modifier
43- import androidx.compose.ui.draw.clip
4436import androidx.compose.ui.graphics.Color
4537import androidx.compose.ui.platform.LocalLifecycleOwner
4638import androidx.compose.ui.res.stringResource
47- import androidx.compose.ui.text.font.FontWeight
4839import androidx.compose.ui.text.style.TextAlign
4940import androidx.compose.ui.unit.dp
50- import androidx.compose.ui.unit.sp
5141import androidx.hilt.navigation.compose.hiltViewModel
5242import androidx.lifecycle.compose.collectAsStateWithLifecycle
5343import com.ramcosta.composedestinations.annotation.Destination
@@ -74,7 +64,6 @@ import java.util.UUID
7464@Composable
7565internal fun ApplicationScreen (
7666 modifier : Modifier = Modifier ,
77- onNavigateToStudyRoomList : () -> Unit ,
7867 onNavigateToRemains : () -> Unit ,
7968 onNavigateToOuting : () -> Unit ,
8069 onNavigateToModelStudent : (voteOptionId: UUID , voteTopicTitle: String ) -> Unit ,
@@ -85,7 +74,7 @@ internal fun ApplicationScreen(
8574 val viewModel: ApplicationViewModel = hiltViewModel()
8675 val uiState by viewModel.stateFlow.collectAsStateWithLifecycle()
8776 val pagerState = rememberPagerState(pageCount = { 2 })
88- var selectedTab by remember { mutableStateOf (0 ) }
77+ var selectedTab by remember { mutableIntStateOf (0 ) }
8978 val tabs = listOf (" 신청" , " 투표" )
9079
9180 LocalLifecycleOwner .current.lifecycle.addObserver(viewModel)
@@ -96,34 +85,34 @@ internal fun ApplicationScreen(
9685 DmsTopAppBar (
9786 title = {
9887 Column (
99- modifier = Modifier .background( Color . White )
88+ modifier = Modifier ,
10089 ) {
10190 Row (
10291 modifier = Modifier
10392 .fillMaxWidth()
10493 .height(56 .dp),
105- horizontalArrangement = Arrangement .Center
94+ horizontalArrangement = Arrangement .Center ,
10695 ) {
10796 tabs.forEachIndexed { index, title ->
10897 Box (
10998 modifier = Modifier
11099 .weight(1f )
111100 .fillMaxHeight()
112101 .clickable { selectedTab = index },
113- contentAlignment = Alignment .Center
102+ contentAlignment = Alignment .Center ,
114103 ) {
115104 Text (
116105 text = title,
117106 style = DmsTheme .typography.body2,
118- color = Color . Black ,
107+ color = DmsTheme .colorScheme.onBackground ,
119108 )
120109 if (selectedTab == index) {
121110 Box (
122111 modifier = Modifier
123112 .fillMaxWidth()
124113 .height(2 .dp)
125- .background( if (selectedTab == index) Color . Black else DmsTheme .colorScheme.line)
126- .align(Alignment .BottomCenter )
114+ .background(if (selectedTab == index) DmsTheme .colorScheme.onBackground else DmsTheme .colorScheme.line)
115+ .align(Alignment .BottomCenter ),
127116 )
128117 }
129118 }
@@ -133,7 +122,7 @@ internal fun ApplicationScreen(
133122 modifier = Modifier
134123 .fillMaxWidth()
135124 .height(1 .dp)
136- .background(Color (0xFFE5E5E5 ))
125+ .background(Color (0xFFE5E5E5 )),
137126 )
138127 }
139128 },
@@ -148,15 +137,15 @@ internal fun ApplicationScreen(
148137 HorizontalPager (
149138 modifier = modifier
150139 .fillMaxSize()
151- .align(Alignment .Start ),
140+ .align(Alignment .CenterHorizontally ),
152141 state = pagerState,
153142 ) { page ->
154143 Column (
155144 modifier = Modifier
156145 .fillMaxSize()
157146 .padding(horizontal = 16 .dp)
158147 .bottomPadding(100 .dp),
159- verticalArrangement = Arrangement .Top ,
148+ verticalArrangement = Arrangement .Center ,
160149 ) {
161150 LazyColumn (
162151 modifier = Modifier .fillMaxSize(),
@@ -165,22 +154,6 @@ internal fun ApplicationScreen(
165154 when (selectedTab) {
166155 0 -> {
167156 items(1 ) {
168- // ApplicationCard(
169- // modifier = Modifier
170- // .fillMaxWidth()
171- // .topPadding(),
172- // title = stringResource(id = R.string.study_room_application),
173- // appliedTitle = uiState.appliedStudyRoom?.let { studyRoom ->
174- // stringResource(
175- // id = R.string.format_study_room_applied_text,
176- // studyRoom.floor,
177- // studyRoom.name,
178- // )
179- // },
180- // description = stringResource(id = R.string.study_room_description),
181- // buttonText = stringResource(id = R.string.study_room_do_application),
182- // onButtonClick = onNavigateToStudyRoomList,
183- // )
184157 ApplicationCard (
185158 modifier = Modifier .fillMaxWidth(),
186159 title = stringResource(id = R .string.remains_application),
@@ -199,45 +172,62 @@ internal fun ApplicationScreen(
199172 }
200173 }
201174 1 -> {
202- items(uiState.modelStudentVoteList) {
203- VoteCard (
204- topStartTimeTitle = it.startTime,
205- topEndTimeTitle = it.endTime,
206- title = it.topicName,
207- description = it.description,
208- isVoted = it.isVoted,
209- onButtonClick = { onNavigateToModelStudent(it.id, it.topicName) },
210- )
211- }
212- items(uiState.selectedVoteList) {
213- VoteCard (
214- topStartTimeTitle = it.startTime,
215- topEndTimeTitle = it.endTime,
216- title = it.topicName,
217- description = it.description,
218- isVoted = it.isVoted,
219- onButtonClick = { onNavigateToSelectedVote(it.id, it.topicName) },
220- )
221- }
222- items(uiState.studentVoteList) {
223- VoteCard (
224- topStartTimeTitle = it.startTime,
225- topEndTimeTitle = it.endTime,
226- title = it.topicName,
227- description = it.description,
228- isVoted = it.isVoted,
229- onButtonClick = { onNavigateToStudentVote(it.id, it.topicName) },
230- )
231- }
232- items(uiState.approvalVoteList) {
233- VoteCard (
234- topStartTimeTitle = it.startTime,
235- topEndTimeTitle = it.endTime,
236- title = it.topicName,
237- description = it.description,
238- isVoted = it.isVoted,
239- onButtonClick = { onNavigateToApprovalVote(it.id, it.topicName) },
240- )
175+ if (uiState.studentVoteList.isEmpty() && uiState.modelStudentVoteList.isEmpty() && uiState.approvalVoteList.isEmpty() && uiState.selectedVoteList.isEmpty()) {
176+ items(1 ) {
177+ Box (
178+ modifier = Modifier
179+ .fillMaxWidth()
180+ .fillParentMaxHeight(),
181+ contentAlignment = Alignment .Center ,
182+ ) {
183+ Text (
184+ text = stringResource(R .string.not_vote_time),
185+ style = DmsTheme .typography.body2,
186+ textAlign = TextAlign .Center ,
187+ )
188+ }
189+ }
190+ } else {
191+ items(uiState.modelStudentVoteList) {
192+ VoteCard (
193+ topStartTimeTitle = it.startTime,
194+ topEndTimeTitle = it.endTime,
195+ title = it.topicName,
196+ description = it.description,
197+ isVoted = it.isVoted,
198+ onButtonClick = { onNavigateToModelStudent(it.id, it.topicName) },
199+ )
200+ }
201+ items(uiState.selectedVoteList) {
202+ VoteCard (
203+ topStartTimeTitle = it.startTime,
204+ topEndTimeTitle = it.endTime,
205+ title = it.topicName,
206+ description = it.description,
207+ isVoted = it.isVoted,
208+ onButtonClick = { onNavigateToSelectedVote(it.id, it.topicName) },
209+ )
210+ }
211+ items(uiState.studentVoteList) {
212+ VoteCard (
213+ topStartTimeTitle = it.startTime,
214+ topEndTimeTitle = it.endTime,
215+ title = it.topicName,
216+ description = it.description,
217+ isVoted = it.isVoted,
218+ onButtonClick = { onNavigateToStudentVote(it.id, it.topicName) },
219+ )
220+ }
221+ items(uiState.approvalVoteList) {
222+ VoteCard (
223+ topStartTimeTitle = it.startTime,
224+ topEndTimeTitle = it.endTime,
225+ title = it.topicName,
226+ description = it.description,
227+ isVoted = it.isVoted,
228+ onButtonClick = { onNavigateToApprovalVote(it.id, it.topicName) },
229+ )
230+ }
241231 }
242232 }
243233 }
0 commit comments