Skip to content

Commit

Permalink
Merge pull request #37 from team-haribo/feature/36-publishing-outing-…
Browse files Browse the repository at this point in the history
…current-situation

🔀 :: (#36) - publishing outing current situation
  • Loading branch information
diejdkll authored Feb 2, 2024
2 parents dfd1299 + 4cc028d commit de44dba
Show file tree
Hide file tree
Showing 23 changed files with 657 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import com.goms.login.navigation.navigateToInputLogin
import com.goms.login.navigation.navigateToLogin
import com.goms.main.navigation.mainScreen
import com.goms.main.navigation.navigateToMain
import com.goms.main.navigation.navigateToOutingStatus
import com.goms.main.navigation.outingStatusScreen
import com.goms.sign_up.navigation.navigateToNumber
import com.goms.sign_up.navigation.navigateToPassword
import com.goms.sign_up.navigation.navigateToSignUp
Expand Down Expand Up @@ -55,6 +57,13 @@ fun GomsNavHost(
onBackClick = navController::popBackStack,
onLoginClick = { appState.navigateToTopLevelDestination(TopLevelDestination.LOGIN) }
)
mainScreen()
mainScreen(
viewModelStoreOwner = viewModelStoreOwner,
onOutingStatusClick = navController::navigateToOutingStatus
)
outingStatusScreen(
viewModelStoreOwner = viewModelStoreOwner,
onBackClick = navController::popBackStack
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.goms.design_system.component.modifier.gomsClickable
import com.goms.design_system.component.timer.CountdownTimer
import com.goms.design_system.icon.SearchIcon
import com.goms.design_system.theme.GomsTheme

@Composable
Expand Down Expand Up @@ -434,6 +435,81 @@ fun GomsPasswordTextField(
}
}

@Composable
fun GomsSearchTextField(
modifier: Modifier = Modifier,
placeHolder: String = "",
readOnly: Boolean = false,
focusManager: FocusManager = LocalFocusManager.current,
focusRequester: FocusRequester = FocusRequester(),
setText: String,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
maxLines: Int = Int.MAX_VALUE,
singleLine: Boolean = false,
visualTransformation: VisualTransformation = VisualTransformation.None,
onValueChange: (String) -> Unit = {},
) {
val isFocused = remember { mutableStateOf(false) }

DisposableEffect(Unit) {
onDispose {
focusManager.clearFocus()
}
}

GomsTheme { colors, typography ->
Column {
OutlinedTextField(
value = setText,
onValueChange = {
onValueChange(it)
},
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
placeholder = {
Text(
text = placeHolder,
style = typography.textMedium,
fontWeight = FontWeight.Normal,
color = colors.G4
)
},
modifier = modifier
.fillMaxWidth()
.focusRequester(focusRequester)
.clip(RoundedCornerShape(12.dp))
.background(colors.G1)
.border(
width = 1.dp,
color = colors.WHITE.copy(0.15f),
shape = RoundedCornerShape(12.dp)
)
.onFocusChanged {
isFocused.value = it.isFocused
},
maxLines = maxLines,
singleLine = singleLine,
textStyle = typography.textMedium,
colors = OutlinedTextFieldDefaults.colors(
focusedTextColor = colors.WHITE,
unfocusedTextColor = colors.WHITE,
focusedPlaceholderColor = colors.G4,
unfocusedPlaceholderColor = colors.G4,
focusedBorderColor = Color.Transparent,
unfocusedBorderColor = Color.Transparent,
cursorColor = colors.I5
),
trailingIcon = {
SearchIcon(tint = colors.G4)
},
readOnly = readOnly,
visualTransformation = visualTransformation
)
}
}
}

@Composable
@Preview(showBackground = true)
fun GomsTextFieldPreview() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,28 @@ fun PersonIcon(
modifier = modifier,
colorFilter = if (tint != Color.Unspecified) ColorFilter.tint(tint) else null
)
}

@Composable
fun SearchIcon(
modifier: Modifier = Modifier,
tint: Color = Color.Unspecified
) {
Image(
painter = painterResource(id = R.drawable.ic_search),
contentDescription = "Search Icon",
modifier = modifier,
colorFilter = if (tint != Color.Unspecified) ColorFilter.tint(tint) else null
)
}

@Composable
fun DeleteIcon(
modifier: Modifier = Modifier
) {
Image(
painter = painterResource(id = R.drawable.ic_delete),
contentDescription = "Delete Icon",
modifier = modifier
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.goms.design_system.util

fun String.formatTime(): String {
if (this.length >= 5) {
return this.substring(0, 5)
}
return this
}
9 changes: 9 additions & 0 deletions core/design-system/src/main/res/drawable/ic_delete.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M10,5H14C14,3.895 13.105,3 12,3C10.895,3 10,3.895 10,5ZM8.5,5C8.5,3.067 10.067,1.5 12,1.5C13.933,1.5 15.5,3.067 15.5,5H21.25C21.664,5 22,5.336 22,5.75C22,6.164 21.664,6.5 21.25,6.5H19.931L18.759,18.611C18.573,20.533 16.958,22 15.026,22H8.974C7.043,22 5.427,20.533 5.241,18.611L4.069,6.5H2.75C2.336,6.5 2,6.164 2,5.75C2,5.336 2.336,5 2.75,5H8.5ZM10.5,9.75C10.5,9.336 10.164,9 9.75,9C9.336,9 9,9.336 9,9.75V17.25C9,17.664 9.336,18 9.75,18C10.164,18 10.5,17.664 10.5,17.25V9.75ZM14.25,9C13.836,9 13.5,9.336 13.5,9.75V17.25C13.5,17.664 13.836,18 14.25,18C14.664,18 15,17.664 15,17.25V9.75C15,9.336 14.664,9 14.25,9Z"
android:fillColor="#E43620"/>
</vector>
9 changes: 9 additions & 0 deletions core/design-system/src/main/res/drawable/ic_search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M10,2.5C14.142,2.5 17.5,5.858 17.5,10C17.5,11.71 16.928,13.287 15.964,14.548L20.707,19.293C21.098,19.683 21.098,20.317 20.707,20.707C20.347,21.068 19.779,21.095 19.387,20.79L19.293,20.707L14.548,15.964C13.287,16.928 11.71,17.5 10,17.5C5.858,17.5 2.5,14.142 2.5,10C2.5,5.858 5.858,2.5 10,2.5ZM10,4.5C6.962,4.5 4.5,6.962 4.5,10C4.5,13.038 6.962,15.5 10,15.5C13.038,15.5 15.5,13.038 15.5,10C15.5,6.962 13.038,4.5 10,4.5Z"
android:fillColor="#666666"/>
</vector>
8 changes: 0 additions & 8 deletions core/model/src/main/java/com/goms/model/enum/Major.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,4 @@ enum class Major(val value: String) {
SW_DEVELOP("SW"),
SMART_IOT("IoT"),
AI("AI")
}

fun Major.toText(): String {
return when (this) {
Major.SW_DEVELOP -> "SW개발"
Major.SMART_IOT -> "IoT"
Major.AI -> "AI"
}
}
11 changes: 11 additions & 0 deletions core/ui/src/main/java/com/goms/ui/MajorText.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.goms.ui

import com.goms.model.enum.Major

fun Major.toText(): String {
return when (this) {
Major.SW_DEVELOP -> "SW개발"
Major.SMART_IOT -> "IoT"
Major.AI -> "AI"
}
}
53 changes: 29 additions & 24 deletions feature/main/src/main/java/com/goms/main/MainScreen.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.goms.main

import android.util.Log
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand All @@ -13,49 +12,52 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.ViewModelStoreOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.goms.design_system.icon.SettingIcon
import com.goms.design_system.theme.GomsTheme
import com.goms.main.viewmodel.GetLateRankListUiState
import com.goms.main.viewmodel.GetOutingCountUiState
import com.goms.main.viewmodel.GetOutingListUiState
import com.goms.main.viewmodel.GetProfileUiState
import com.goms.main.viewmodel.MainViewModel
import com.goms.model.enum.Authority
import com.goms.ui.GomsTopBar
import com.goms.ui.GomsFloatingButton
import com.goms.main.component.MainLateCard
import com.goms.main.component.MainOutingCard
import com.goms.main.component.MainProfileCard
import com.goms.main.viewmodel.MainViewModelProvider

@Composable
fun MainRoute(
viewModel: MainViewModel = hiltViewModel()
viewModelStoreOwner: ViewModelStoreOwner,
onOutingStatusClick: () -> Unit
) {
val role by viewModel.role.collectAsStateWithLifecycle(initialValue = "")
val getProfileUiState by viewModel.getProfileUiState.collectAsStateWithLifecycle()
val getLateRankListUiState by viewModel.getLateRankListUiState.collectAsStateWithLifecycle()
val getOutingListUiState by viewModel.getOutingListUiState.collectAsStateWithLifecycle()
val getOutingCountUiState by viewModel.getOutingCountUiState.collectAsStateWithLifecycle()
MainViewModelProvider(viewModelStoreOwner = viewModelStoreOwner) { viewModel ->
val role by viewModel.role.collectAsStateWithLifecycle(initialValue = "")
val getProfileUiState by viewModel.getProfileUiState.collectAsStateWithLifecycle()
val getLateRankListUiState by viewModel.getLateRankListUiState.collectAsStateWithLifecycle()
val getOutingListUiState by viewModel.getOutingListUiState.collectAsStateWithLifecycle()
val getOutingCountUiState by viewModel.getOutingCountUiState.collectAsStateWithLifecycle()

MainScreen(
role = if (role.isNotBlank()) Authority.valueOf(role) else Authority.ROLE_STUDENT,
getProfileUiState = getProfileUiState,
getLateRankListUiState = getLateRankListUiState,
getOutingListUiState = getOutingListUiState,
getOutingCountUiState = getOutingCountUiState,
getData = {
viewModel.getProfile()
viewModel.getLateRankList()
viewModel.getOutingCount()
}
)
MainScreen(
role = if (role.isNotBlank()) Authority.valueOf(role) else Authority.ROLE_STUDENT,
getProfileUiState = getProfileUiState,
getLateRankListUiState = getLateRankListUiState,
getOutingListUiState = getOutingListUiState,
getOutingCountUiState = getOutingCountUiState,
getData = {
viewModel.getProfile()
viewModel.getLateRankList()
viewModel.getOutingCount()
},
onOutingStatusClick = onOutingStatusClick
)
}
}

@Composable
Expand All @@ -65,7 +67,8 @@ fun MainScreen(
getLateRankListUiState: GetLateRankListUiState,
getOutingListUiState: GetOutingListUiState,
getOutingCountUiState: GetOutingCountUiState,
getData: () -> Unit
getData: () -> Unit,
onOutingStatusClick: () -> Unit,
) {
LaunchedEffect(true) {
getData()
Expand Down Expand Up @@ -107,7 +110,9 @@ fun MainScreen(
role = role,
getOutingListUiState = getOutingListUiState,
getOutingCountUiState = getOutingCountUiState
) {}
) {
onOutingStatusClick()
}
}
}
GomsFloatingButton(
Expand Down
Loading

0 comments on commit de44dba

Please sign in to comment.