Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature/#5] : 그룹 상세 페이지 구현 #7

Merged
merged 11 commits into from
Jan 2, 2025
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.sopt.core.designsystem.component.button

import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExtendedFloatingActionButton
import androidx.compose.material3.FloatingActionButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import com.sopt.core.R
import com.sopt.core.designsystem.theme.NoostakTheme
import com.sopt.core.util.NoRippleInteractionSource

@Composable
fun NoostakFloatingActionButton(
title: String,
modifier: Modifier = Modifier,
onClick: () -> Unit
) {
ExtendedFloatingActionButton(
modifier = modifier,
shape = RoundedCornerShape(dimensionResource(id = R.dimen.fab_radius)),
containerColor = NoostakTheme.colors.black,
contentColor = NoostakTheme.colors.white,
elevation = FloatingActionButtonDefaults.elevation(4.dp),
onClick = { onClick() },
interactionSource = NoRippleInteractionSource
) {
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_add),
contentDescription = null,
tint = NoostakTheme.colors.white
)
Spacer(modifier = Modifier.width(5.dp))
Text(
text = title,
color = NoostakTheme.colors.white,
style = NoostakTheme.typography.b4SemiBold1
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.sopt.core.designsystem.component.chip

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.unit.dp
import com.sopt.core.R
import com.sopt.core.designsystem.theme.NoostakTheme

@Composable
fun NoostakCategoryChip(
text: String,
backgroundColor: Color
) {
NoostakChip(
text = text,
textStyle = NoostakTheme.typography.c2SemiBold,
textColor = NoostakTheme.colors.white,
backgroundColor = backgroundColor,
borderColor = Color.Transparent,
horizontalPaddingValues = dimensionResource(id = R.dimen.category_chip_horizontal_padding),
verticalPaddingValues = dimensionResource(id = R.dimen.category_chip_vertical_padding)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.sopt.core.designsystem.component.chip

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.sopt.core.R
import com.sopt.core.designsystem.theme.NoostakAndroidTheme
import com.sopt.core.designsystem.theme.NoostakTheme

@Composable
fun NoostakChip(
text: String,
textStyle: TextStyle,
textColor: Color,
backgroundColor: Color,
borderColor: Color,
horizontalPaddingValues: Dp,
verticalPaddingValues: Dp
) {
Box(
modifier = Modifier
.background(
color = backgroundColor,
shape = RoundedCornerShape(dimensionResource(id = R.dimen.chip_radius))
)
.border(
width = 1.dp,
color = borderColor,
shape = RoundedCornerShape(dimensionResource(id = R.dimen.chip_radius))
)
.defaultMinSize(minWidth = 39.dp)
.padding(horizontal = horizontalPaddingValues, vertical = verticalPaddingValues)
) {
Text(
modifier = Modifier
.align(Alignment.Center)
.wrapContentSize(),
text = text,
style = textStyle,
color = textColor,
textAlign = TextAlign.Center,
overflow = TextOverflow.Ellipsis,
maxLines = 1
)
}
}

@Preview(showBackground = true)
@Composable
fun NoostakChipPreview() {
NoostakAndroidTheme {
NoostakChip(
text = "나",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 : string 파일에 test string 하나 만들어서 재사용하면 좋을듯

textStyle = NoostakTheme.typography.c3Regular,
textColor = NoostakTheme.colors.gray900,
backgroundColor = NoostakTheme.colors.blue200,
borderColor = NoostakTheme.colors.blue200,
horizontalPaddingValues = 8.dp,
verticalPaddingValues = 6.dp
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.sopt.core.designsystem.component.chip

import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.unit.dp
import com.sopt.core.R
import com.sopt.core.designsystem.theme.NoostakTheme

@Composable
fun NoostakUserChip(
text: String,
textColor: Color,
backgroundColor: Color,
borderColor: Color
) {
NoostakChip(
text = text,
textStyle = NoostakTheme.typography.c3Regular,
textColor = textColor,
backgroundColor = backgroundColor,
borderColor = borderColor,
horizontalPaddingValues = dimensionResource(id = R.dimen.user_chip_horizontal_padding),
verticalPaddingValues = dimensionResource(id = R.dimen.user_chip_vertical_padding)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package com.sopt.core.designsystem.component.topappbar

import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color.Companion.White
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.sopt.core.R
import com.sopt.core.designsystem.theme.NoostakAndroidTheme
import com.sopt.core.designsystem.theme.NoostakTheme
import com.sopt.core.extension.noRippleClickable
import com.sopt.core.extension.showIf

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun NoostakTopAppBar(
title: String = "",
modifier: Modifier = Modifier,
isIconVisible: Boolean,
onBackButtonClick: () -> Unit = {}
) {
CenterAlignedTopAppBar(
modifier = modifier.fillMaxWidth(),
title = {
Text(
text = title,
textAlign = TextAlign.Center,
style = NoostakTheme.typography.b2Regular,
color = NoostakTheme.colors.black
)
},
navigationIcon = {
Icon(
painter = painterResource(id = R.drawable.ic_back),
contentDescription = stringResource(id = R.string.ic_back),
modifier = Modifier
.padding(start = 8.dp)
.noRippleClickable { onBackButtonClick() }
.showIf(isIconVisible),
tint = NoostakTheme.colors.black
)
},
colors = TopAppBarDefaults.topAppBarColors(White),
windowInsets = WindowInsets(0)
)
}

@Preview(showBackground = true)
@Composable
fun NoostakTopAppBarPreview() {
NoostakAndroidTheme {
NoostakTopAppBar(
modifier = Modifier.fillMaxWidth(),
isIconVisible = true,
title = "그룹"
)
}
}
19 changes: 19 additions & 0 deletions core/src/main/java/com/sopt/core/util/BaseViewModel.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.sopt.core.util

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.launch

abstract class BaseViewModel<T> : ViewModel() {
private val _sideEffects = MutableSharedFlow<T>()
val sideEffects: SharedFlow<T> get() = _sideEffects.asSharedFlow()

protected fun emitSideEffect(sideEffect: T) {
viewModelScope.launch {
_sideEffects.emit(sideEffect)
}
}
}
18 changes: 18 additions & 0 deletions core/src/main/res/drawable/ic_add.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="13dp"
android:viewportWidth="12"
android:viewportHeight="13">
<path
android:pathData="M6,1.5L6,11.5"
android:strokeWidth="1.5"
android:fillColor="#00000000"
android:strokeColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M11,6.5L1,6.5"
android:strokeWidth="1.5"
android:fillColor="#00000000"
android:strokeColor="#ffffff"
android:strokeLineCap="round"/>
</vector>
9 changes: 9 additions & 0 deletions core/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="chip_radius">16dp</dimen>
<dimen name="user_chip_horizontal_padding">8dp</dimen>
<dimen name="user_chip_vertical_padding">6dp</dimen>
<dimen name="category_chip_horizontal_padding">15dp</dimen>
<dimen name="category_chip_vertical_padding">6dp</dimen>
<dimen name="fab_radius">30dp</dimen>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.sopt.domain.entity

data class ConfirmedDetailEntity(
val appointName: String,
val date: String,
val weekday: String,
val startTime: String,
val endTime: String,
val category: String,
val likes: Int,
val availableMembersCount: Int,
val availableMembers: List<String>,
val unavailableMembersCount: Int,
val unavailableMembers: List<String>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.sopt.domain.entity

data class ConfirmedEntity(
val appointmentId: Long,
val appointmentName: String,
val date: String,
val weekday: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.sopt.domain.entity

data class GroupDetailEntity(
val groupName: String,
val groupMembersCount: Int,
val progressEntities: List<ProgressEntity>,
val confirmedEntities: List<ConfirmedEntity>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.sopt.domain.entity

data class GroupMembersEntity(
val groupName: String,
val groupMembersCount: Int,
val groupLeader: GroupLeaderEntity,
val groupMembers: List<GroupMemberEntity>
)

data class GroupLeaderEntity(
val groupLeaderName: String,
val groupLeaderImage: String
)

data class GroupMemberEntity(
val groupMemberName: String,
val groupMemberImage: String
)
12 changes: 12 additions & 0 deletions domain/src/main/java/com/sopt/domain/entity/ProgressEntity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.sopt.domain.entity

data class ProgressEntity(
val appointmentId: Int,
val appointmentName: String,
val date: String,
val weekday: String,
val startTime: String,
val endTime: String,
val participants: Int,
val maxParticipants: Int
)
Loading
Loading