Skip to content

Commit

Permalink
Merge pull request #104 from PawWithU/feature/inter_home
Browse files Browse the repository at this point in the history
feature/inter home: ํ”„๋กœํ•„ ํ™ˆ ํ™”๋ฉด ๋””์ž์ธ ์ถ”๊ฐ€ ๊ตฌํ˜„ ๋ฐ ์ˆ˜์ •
  • Loading branch information
kang9366 authored Mar 29, 2024
2 parents c62a649 + a316cb0 commit 75f68b8
Show file tree
Hide file tree
Showing 15 changed files with 167 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,18 @@ fun ConnectDogBottomButton(
onClick = onClick,
contentPadding = PaddingValues(vertical = 16.dp),
shape = RoundedCornerShape(12.dp),
modifier = modifier.height(56.dp).fillMaxWidth(),
modifier = modifier
.height(56.dp)
.fillMaxWidth(),
colors = ButtonDefaults.buttonColors(containerColor = color, contentColor = textColor),
border = border
) {
Text(text = content, style = Typography.titleSmall, color = textColor, fontSize = fontSize.sp)
Text(
text = content,
style = Typography.titleSmall,
color = textColor,
fontSize = fontSize.sp
)
}
}

Expand Down Expand Up @@ -131,6 +138,39 @@ fun ConnectDogOutlinedButton(
}
}

@Composable
fun ConnectDogFilledButton(
width: Int,
height: Int,
text: String,
padding: Int,
onClick: () -> Unit,
modifier: Modifier = Modifier,
backgroundColor: Color = Color.White,
fontColor: Color = MaterialTheme.colorScheme.primary
) {
Button(
onClick = onClick,
modifier = modifier
.width(width.dp)
.height(height.dp),
contentPadding = PaddingValues(
top = 1.dp,
bottom = 1.dp,
start = padding.dp,
end = padding.dp
),
colors = ButtonDefaults.buttonColors(backgroundColor)
) {
Text(
text = text,
fontSize = 8.sp,
color = fontColor,
fontWeight = FontWeight.SemiBold
)
}
}

@Composable
fun ConnectDogOutlinedButton(
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -163,10 +203,17 @@ fun ConnectDogSecondaryButton(
contentPadding = PaddingValues(vertical = 11.dp),
shape = RoundedCornerShape(6.dp),
border = BorderStroke(1.dp, borderColor),
modifier = modifier.fillMaxWidth().height(40.dp),
modifier = modifier
.fillMaxWidth()
.height(40.dp),
colors = ButtonDefaults.buttonColors(containerColor = color, contentColor = textColor)
) {
Text(text = stringResource(id = contentRes), style = Typography.titleSmall, color = textColor, fontSize = 12.sp)
Text(
text = stringResource(id = contentRes),
style = Typography.titleSmall,
color = textColor,
fontSize = 12.sp
)
}
}

Expand Down Expand Up @@ -209,3 +256,17 @@ private fun OutlinedButton() {
)
}
}

@Preview
@Composable
private fun FilledButton() {
ConnectDogTheme {
ConnectDogFilledButton(
width = 45,
height = 14,
text = "ํ”„๋กœํ•„ ๋ณด๊ธฐ",
padding = 1,
onClick = {}
)
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import androidx.navigation.navArgument
import com.kusitms.connectdog.feature.intermediator.screen.InterManagementRoute
import com.kusitms.connectdog.feature.intermediator.screen.InterProfileScreen
import com.kusitms.connectdog.feature.intermediator.screen.IntermediatorHomeScreen

fun NavController.navigateIntermediatorHome() {
Expand All @@ -18,17 +19,23 @@ fun NavController.navigateInterManagement(tabIndex: Int) {
navigate(route)
}

fun NavController.navigateInterProfile() {
navigate(IntermediatorRoute.inter_profile)
}

fun NavGraphBuilder.intermediatorNavGraph(
onBackClick: () -> Unit,
onSettingClick: () -> Unit,
onNotificationClick: () -> Unit,
onProfileClick: () -> Unit,
onManagementClick: (Int) -> Unit
) {
composable(route = IntermediatorRoute.route) {
IntermediatorHomeScreen(
onNotificationClick = onNotificationClick,
onSettingClick = onSettingClick,
onDataClick = onManagementClick
onManageClick = onManagementClick,
onProfileClick = onProfileClick
)
}

Expand All @@ -41,9 +48,16 @@ fun NavGraphBuilder.intermediatorNavGraph(
tabIndex = it.arguments?.getInt("tabIndex") ?: 0
)
}

composable(route = IntermediatorRoute.inter_profile) {
InterProfileScreen(
onBackClick = onBackClick
)
}
}

object IntermediatorRoute {
const val route = "inter_home"
const val management = "inter_management"
const val inter_profile = "inter_profile"
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ val pages = listOf("๊ธฐ๋ณธ ์ •๋ณด", "ํ›„๊ธฐ", "๊ทผํ™ฉ")

@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@Composable
fun ProfileScreen(
onBackClick: () -> Unit = {}
internal fun InterProfileScreen(
onBackClick: () -> Unit
) {
Scaffold(
topBar = {
Expand Down Expand Up @@ -204,6 +204,6 @@ fun News() {
@Composable
private fun test() {
ConnectDogTheme {
ProfileScreen()
// InterProfileScreen()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.itemsIndexed
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Add
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Card
Expand All @@ -49,6 +48,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import com.kusitms.connectdog.core.designsystem.component.ConnectDogFilledButton
import com.kusitms.connectdog.core.designsystem.component.ConnectDogIntermediatorTopAppBar
import com.kusitms.connectdog.core.designsystem.component.NetworkImage
import com.kusitms.connectdog.core.designsystem.theme.Brown5
Expand Down Expand Up @@ -84,7 +84,8 @@ internal data class CardItem(
fun IntermediatorHomeScreen(
onNotificationClick: () -> Unit,
onSettingClick: () -> Unit,
onDataClick: (Int) -> Unit,
onManageClick: (Int) -> Unit,
onProfileClick: () -> Unit,
viewModel: InterHomeViewModel = hiltViewModel()
) {
LaunchedEffect(Unit) {
Expand All @@ -100,21 +101,28 @@ fun IntermediatorHomeScreen(
) {
Content(
viewModel = viewModel,
onClick = onDataClick
onManageClick = onManageClick,
onProfileClick = onProfileClick
)
}
}

@Composable
private fun Content(
viewModel: InterHomeViewModel,
onClick: (Int) -> Unit
onProfileClick: () -> Unit,
onManageClick: (Int) -> Unit
) {
val recruitingCount = viewModel.recruitingCount.collectAsState()
val waitingCount = viewModel.waitingCount.collectAsState()
val progressingCount = viewModel.progressingCount.collectAsState()
val completedCount = viewModel.completedCount.collectAsState()
val cnt = listOf(recruitingCount.value, waitingCount.value, progressingCount.value, completedCount.value)
val cnt = listOf(
recruitingCount.value,
waitingCount.value,
progressingCount.value,
completedCount.value
)
val list = cnt.mapIndexedNotNull { index, value ->
value?.let {
CardItem(
Expand All @@ -128,20 +136,21 @@ private fun Content(
modifier = Modifier.fillMaxWidth()
) {
Spacer(modifier = Modifier.height(48.dp))
ProfileCard(viewModel)
ManageBoard(list) { onClick(it) }
ProfileCard(viewModel, onProfileClick)
ManageBoard(list) { onManageClick(it) }
}
}

@SuppressLint("StateFlowValueCalledInComposition")
@Composable
private fun ProfileCard(
viewModel: InterHomeViewModel
viewModel: InterHomeViewModel,
onProfileClick: () -> Unit
) {
Box(
modifier = Modifier
.fillMaxWidth()
.height(180.dp)
.height(172.dp)
.background(MaterialTheme.colorScheme.primary)
) {
Row(
Expand All @@ -156,12 +165,25 @@ private fun ProfileCard(
placeholder = painterResource(id = R.drawable.ic_default_intermediator)
)
Spacer(modifier = Modifier.height(18.dp))
Text(
text = viewModel.intermediaryName.value,
style = MaterialTheme.typography.titleSmall,
color = Color.White,
fontSize = 20.sp
)
Row(
modifier = Modifier.wrapContentHeight(),
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = viewModel.intermediaryName.value,
style = MaterialTheme.typography.titleSmall,
color = Color.White,
fontSize = 20.sp
)
Spacer(modifier = Modifier.width(6.dp))
ConnectDogFilledButton(
width = 45,
height = 14,
text = "ํ”„๋กœํ•„ ๋ณด๊ธฐ",
padding = 1,
onClick = onProfileClick
)
}
Spacer(modifier = Modifier.height(6.dp))
Text(
text = viewModel.intro.value,
Expand Down Expand Up @@ -231,9 +253,9 @@ private fun ManageBoard(
) { onClick(index) }
}
}
Spacer(modifier = Modifier.height(20.dp))
Row(
modifier = Modifier.fillMaxWidth(),
modifier = Modifier.fillMaxSize(),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center
) {
ApplyButton(onClick = {})
Expand All @@ -246,23 +268,27 @@ private fun ApplyButton(onClick: () -> Unit) {
val context = LocalContext.current
Button(
onClick = { Toast.makeText(context, "์•„์ง ์ค€๋น„์ค‘์ธ ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค.", Toast.LENGTH_SHORT).show() },
contentPadding = PaddingValues(vertical = 15.dp),
shape = RoundedCornerShape(12.dp),
modifier = Modifier
.width(117.dp)
.height(44.dp),
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.primary,
contentColor = Color.White
)
),
contentPadding = PaddingValues(horizontal = 15.dp)
) {
Icon(
imageVector = Icons.Outlined.Add,
contentDescription = null,
modifier = Modifier.size(24.dp)
painter = painterResource(id = R.drawable.ic_add),
contentDescription = null
)
Spacer(modifier = Modifier.width(11.dp))
Text(
text = "๊ณต๊ณ  ๋“ฑ๋กํ•˜๊ธฐ",
color = Color.White,
style = Typography.titleSmall,
fontSize = 12.sp
)
Spacer(modifier = Modifier.width(6.dp))
Text(text = "๊ณต๊ณ  ๋“ฑ๋ก", color = Color.White, style = Typography.titleSmall, fontSize = 12.sp)
}
}

Expand All @@ -279,8 +305,7 @@ private fun ManageCard(
containerColor = Color.White
),
modifier = Modifier
.width(170.dp)
.height(200.dp)
.size(width = 150.dp, height = 180.dp)
.clickable { onClick() }
) {
Column(
Expand Down Expand Up @@ -318,6 +343,24 @@ private fun ManageCard(
@Composable
private fun test() {
ConnectDogTheme {
IntermediatorHomeScreen(onNotificationClick = {}, onSettingClick = {}, {})
Row(
modifier = Modifier.wrapContentHeight(),
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = "์ด๋™๋ด‰์‚ฌ ์ค‘๊ฐœ",
style = MaterialTheme.typography.titleSmall,
color = Color.White,
fontSize = 20.sp
)
Spacer(modifier = Modifier.width(6.dp))
ConnectDogFilledButton(
width = 45,
height = 14,
text = "ํ”„๋กœํ•„ ๋ณด๊ธฐ",
padding = 1,
onClick = {}
)
}
}
}
9 changes: 9 additions & 0 deletions feature/intermediator/src/main/res/drawable/ic_add.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="13dp"
android:height="14dp"
android:viewportWidth="13"
android:viewportHeight="14">
<path
android:pathData="M5.75,7.75H0.75C0.538,7.75 0.359,7.678 0.216,7.534C0.072,7.39 0,7.212 0,7C0,6.787 0.072,6.609 0.216,6.465C0.359,6.322 0.538,6.25 0.75,6.25H5.75V1.25C5.75,1.038 5.822,0.859 5.966,0.716C6.11,0.572 6.288,0.5 6.5,0.5C6.713,0.5 6.891,0.572 7.035,0.716C7.178,0.859 7.25,1.038 7.25,1.25V6.25H12.25C12.462,6.25 12.641,6.322 12.784,6.466C12.928,6.61 13,6.788 13,7C13,7.213 12.928,7.391 12.784,7.535C12.641,7.678 12.462,7.75 12.25,7.75H7.25V12.75C7.25,12.962 7.178,13.141 7.034,13.284C6.89,13.428 6.712,13.5 6.5,13.5C6.287,13.5 6.109,13.428 5.965,13.284C5.822,13.141 5.75,12.962 5.75,12.75V7.75Z"
android:fillColor="#ffffff"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import com.kusitms.connectdog.feature.home.navigation.navigateSearch
import com.kusitms.connectdog.feature.home.navigation.navigateSearchWithFilter
import com.kusitms.connectdog.feature.intermediator.navigation.IntermediatorRoute
import com.kusitms.connectdog.feature.intermediator.navigation.navigateInterManagement
import com.kusitms.connectdog.feature.intermediator.navigation.navigateInterProfile
import com.kusitms.connectdog.feature.intermediator.navigation.navigateIntermediatorHome
import com.kusitms.connectdog.feature.login.LoginRoute
import com.kusitms.connectdog.feature.login.navigateNormalLogin
Expand Down Expand Up @@ -121,6 +122,7 @@ internal class MainNavigator(
// intermediator
fun navigateIntermediatorHome() = navController.navigateIntermediatorHome()
fun navigateInterManagement(index: Int) = navController.navigateInterManagement(index)
fun navigateInterProfile() = navController.navigateInterProfile()

fun popBackStackIfNotHome() {
if (!isSameCurrentDestination(HomeRoute.route)) {
Expand Down
Loading

0 comments on commit 75f68b8

Please sign in to comment.