Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.navigation.compose.NavHost
import com.yapp.app.official.ui.NavigatorState
import com.yapp.app.official.ui.clearBackStackNavOptions
import com.yapp.feature.history.navigation.attendanceHistoryNavGraph
import com.yapp.feature.history.navigation.previousHistoryNavGraph
import com.yapp.feature.home.navigation.homeNavGraph
import com.yapp.feature.home.navigation.settingNavGraph
import com.yapp.feature.login.navigation.loginNavGraph
Expand Down Expand Up @@ -81,11 +82,14 @@ fun YappNavHost(
profileNavGraph(
onNavigateToSetting = { navigator.navigateSettingScreen() },
onNavigateToLogin = { navigator.navigateLoginScreen(clearBackStackNavOptions) },
onNavigateToPreviousHistory = {},
onNavigateToPreviousHistory = { navigator.navigateToPreviousHistory() },
onNavigateToAttendHistory = { navigator.navigateToAttendance() }
)
attendanceHistoryNavGraph(
navigateToBack = { navigator.popBackStack() }
)
previousHistoryNavGraph(
navigateToBack = { navigator.popBackStack() }
)
}
}
5 changes: 5 additions & 0 deletions app/src/main/java/com/yapp/app/official/ui/Navigator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.navigation.compose.rememberNavController
import androidx.navigation.navOptions
import com.yapp.app.official.navigation.TopLevelDestination
import com.yapp.feature.history.navigation.navigateToAttendance
import com.yapp.feature.history.navigation.navigateToPreviousHistory
import com.yapp.feature.home.navigation.navigateToHome
import com.yapp.feature.home.navigation.navigateToSetting
import com.yapp.feature.login.navigation.LoginRoute
Expand Down Expand Up @@ -86,6 +87,10 @@ class NavigatorState(
navController.navigateToAttendance()
}

fun navigateToPreviousHistory() {
navController.navigateToPreviousHistory()
}

fun popBackStack() {
navController.popBackStack()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.yapp.dataapi

import com.yapp.model.ActivityHistory
import com.yapp.model.UserInfo
import kotlinx.coroutines.flow.Flow

interface UserRepository {
suspend fun getUserAccessToken() : Flow<String>
suspend fun deleteAccount()
suspend fun getUserProfile(): Flow<UserInfo>
fun getUserActivityHistories(): Flow<ActivityHistory>
Copy link
Member

Choose a reason for hiding this comment

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

C: 저희 저번에 꼭 필요한 경우에만 Flow를 사용하기로 했던 것 같아요.

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal class SessionsRepositoryImpl @Inject constructor(
private val sessionApi: SessionApi
): SessionRepository{
override fun getSessions() = flow {
emit(sessionApi.getSessions().map { result ->
emit(sessionApi.getSessions().sessions.map { result ->
Sessions(
id = result.id,
name = result.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.yapp.core.data.data.repository
import com.yapp.core.data.local.SecurityPreferences
import com.yapp.core.data.remote.api.UserApi
import com.yapp.dataapi.UserRepository
import com.yapp.model.ActivityHistory
import com.yapp.model.UserInfo
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
Expand All @@ -22,4 +23,7 @@ internal class UserRepositoryImpl @Inject constructor(
}

override suspend fun getUserProfile() = flow<UserInfo> { emit(userApi.getUserProfile().toModel())}
}
override fun getUserActivityHistories() = flow {
emit(userApi.getUserActivityHistories().toModel())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import retrofit2.http.GET

interface SessionApi {
@GET("v1/sessions")
suspend fun getSessions(): List<SessionResponse>
suspend fun getSessions(): SessionResponse
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.yapp.core.data.remote.api

import com.yapp.core.data.remote.model.response.UserActivityHistoryResponse
import com.yapp.core.data.remote.model.response.UserProfileResponse
import retrofit2.http.DELETE
import retrofit2.http.GET
Expand All @@ -10,4 +11,7 @@ interface UserApi {

@DELETE("v1/auth/user")
suspend fun deleteUser()

@GET("v1/users/activity-histories")
suspend fun getUserActivityHistories(): UserActivityHistoryResponse
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ import kotlinx.serialization.Serializable

@Serializable
data class SessionResponse(
val id: String,
val name: String,
val place: String?,
val date: String,
val endDate: String?,
val time: String?,
val type: String,
val progressPhase: String
)
val sessions: List<Session>
) {
@Serializable
data class Session(
val id: String,
val name: String,
val place: String?,
val date: String,
val endDate: String?,
val time: String?,
val type: String,
val progressPhase: String
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.yapp.core.data.remote.model.response

import com.yapp.model.ActivityHistory
import kotlinx.serialization.Serializable

@Serializable
data class UserActivityHistoryResponse(
val activityUnits: List<Unit>
) {
@Serializable
data class Unit(
val generation: Int,
val position: String,
val activityStartDate: String?,
val activityEndDate: String?
)

fun toModel(): ActivityHistory {
return ActivityHistory(
activityUnits = activityUnits.map {
ActivityHistory.Unit(
generation = it.generation,
position = it.position,
activityStartDate = it.activityStartDate,
activityEndDate = it.activityEndDate
)
}
)
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions core/model/src/main/java/com/yapp/model/ActivityHistory.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.yapp.model

data class ActivityHistory(
val activityUnits: List<Unit>
) {
data class Unit(
val generation: Int,
val position: String,
val activityStartDate: String?,
val activityEndDate: String?
)
}
2 changes: 1 addition & 1 deletion core/model/src/main/java/com/yapp/model/Sessions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ data class Sessions(
val progressPhase: String
) {
enum class AttendType {

OFFLINE, TEAM
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yapp.feature.history
package com.yapp.feature.history.attend

import com.yapp.model.Sessions

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yapp.feature.history
package com.yapp.feature.history.attend

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
Expand All @@ -18,13 +18,14 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.yapp.core.designsystem.component.header.YappHeaderActionbar
import com.yapp.core.designsystem.theme.YappTheme
import com.yapp.feature.history.components.AttendanceStatusSection
import com.yapp.feature.history.components.StatusItem
import com.yapp.feature.history.R
import com.yapp.feature.history.attend.components.AttendanceStatusSection
import com.yapp.feature.history.attend.components.StatusItem
import com.yapp.model.Sessions
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import com.yapp.feature.history.AttendHistoryIntent as Intent
import com.yapp.feature.history.AttendHistorySideEffect as SideEffect
import com.yapp.feature.history.attend.AttendHistoryIntent as Intent
import com.yapp.feature.history.attend.AttendHistorySideEffect as SideEffect
import com.yapp.core.designsystem.R as coreDesignR

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yapp.feature.history
package com.yapp.feature.history.attend

import com.yapp.dataapi.AttendanceRepository
import com.yapp.dataapi.SessionRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yapp.feature.history
package com.yapp.feature.history.attend

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yapp.feature.history.components
package com.yapp.feature.history.attend.components

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yapp.feature.history.components
package com.yapp.feature.history.attend.components

import androidx.compose.runtime.Composable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yapp.feature.history.components
package com.yapp.feature.history.attend.components

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,36 @@ package com.yapp.feature.history.navigation
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.yapp.feature.history.AttendHistoryRoute
import com.yapp.feature.history.attend.AttendHistoryRoute
import com.yapp.feature.history.previous.PreviousHistoryRoute
import kotlinx.serialization.Serializable

@Serializable
data object AttendanceHistory

@Serializable
data object PreviousHistory

fun NavController.navigateToAttendance() {
navigate(AttendanceHistory)
}

fun NavController.navigateToPreviousHistory() {
navigate(PreviousHistory)
}

fun NavGraphBuilder.attendanceHistoryNavGraph(
navigateToBack: () -> Unit
) {
composable<AttendanceHistory> {
AttendHistoryRoute(navigateToBack = navigateToBack)
}
}

fun NavGraphBuilder.previousHistoryNavGraph(
navigateToBack: () -> Unit
) {
composable<PreviousHistory> {
PreviousHistoryRoute(navigateToBack = navigateToBack)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.yapp.feature.history.previous

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
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.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.yapp.core.designsystem.theme.YappTheme
import com.yapp.core.designsystem.R as coreDesignR

@Composable
internal fun HistoryItems(
modifier: Modifier = Modifier,
generation: Int,
position: String,
slot: @Composable (() -> Unit)? = null
) {
Column(modifier = modifier.fillMaxWidth()) {
Row(horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = Alignment.CenterVertically) {
Text(modifier = Modifier.weight(1f), text = position, style = YappTheme.typography.heading2Bold)
Image(painter = painterResource(coreDesignR.drawable.icon_yapp), contentDescription = null)
Text("${generation}기", style = YappTheme.typography.label1NormalMedium)
}

slot?.invoke()
}
}
Comment on lines +21 to +37
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

히스토리 아이템 컴포넌트 구현 검토

히스토리 항목을 표시하기 위한 컴포넌트가 잘 구현되어 있습니다. 다만 몇 가지 개선할 점이 있습니다:

  1. Image 컴포넌트의 contentDescriptionnull입니다. 접근성을 위해 적절한 설명을 추가하는 것이 좋습니다.
  2. 함수에 KDoc 문서화 주석을 추가하면 다른 개발자들이 컴포넌트의 목적과 사용법을 이해하는 데 도움이 될 것입니다.

다음과 같이 개선해 보세요:

 @Composable
+/**
+ * 활동 이력 항목을 표시하는 컴포넌트
+ *
+ * @param modifier 컴포넌트에 적용할 수정자
+ * @param generation YAPP 기수
+ * @param position 포지션(직책)
+ * @param slot 추가 콘텐츠를 위한 선택적 슬롯
+ */
 internal fun HistoryItems(
     modifier: Modifier = Modifier,
     generation: Int,
     position: String,
     slot: @Composable (() -> Unit)? = null
 ) {
     Column(modifier = modifier.fillMaxWidth()) {
         Row(horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = Alignment.CenterVertically) {
             Text(modifier = Modifier.weight(1f), text = position, style = YappTheme.typography.heading2Bold)
-            Image(painter = painterResource(coreDesignR.drawable.icon_yapp), contentDescription = null)
+            Image(painter = painterResource(coreDesignR.drawable.icon_yapp), contentDescription = "YAPP 로고")
             Text("${generation}기", style = YappTheme.typography.label1NormalMedium)
         }

         slot?.invoke()
     }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Composable
internal fun HistoryItems(
modifier: Modifier = Modifier,
generation: Int,
position: String,
slot: @Composable (() -> Unit)? = null
) {
Column(modifier = modifier.fillMaxWidth()) {
Row(horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = Alignment.CenterVertically) {
Text(modifier = Modifier.weight(1f), text = position, style = YappTheme.typography.heading2Bold)
Image(painter = painterResource(coreDesignR.drawable.icon_yapp), contentDescription = null)
Text("${generation}", style = YappTheme.typography.label1NormalMedium)
}
slot?.invoke()
}
}
@Composable
/**
* 활동 이력 항목을 표시하는 컴포넌트
*
* @param modifier 컴포넌트에 적용할 수정자
* @param generation YAPP 기수
* @param position 포지션(직책)
* @param slot 추가 콘텐츠를 위한 선택적 슬롯
*/
internal fun HistoryItems(
modifier: Modifier = Modifier,
generation: Int,
position: String,
slot: @Composable (() -> Unit)? = null
) {
Column(modifier = modifier.fillMaxWidth()) {
Row(horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = Alignment.CenterVertically) {
Text(
modifier = Modifier.weight(1f),
text = position,
style = YappTheme.typography.heading2Bold
)
Image(
painter = painterResource(coreDesignR.drawable.icon_yapp),
contentDescription = "YAPP 로고"
)
Text(
text = "${generation}",
style = YappTheme.typography.label1NormalMedium
)
}
slot?.invoke()
}
}

Comment on lines +21 to +37
Copy link
Member

@DongChyeon DongChyeon Apr 26, 2025

Choose a reason for hiding this comment

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

R:

@Composable
internal fun HistoryItems(
    modifier: Modifier = Modifier,
    generation: Int,
    position: String,
    slot: @Composable (() -> Unit)? = null
) {
    Column(modifier = modifier.fillMaxWidth()) {
        Row(
            horizontalArrangement = Arrangement.spacedBy(2.dp),
            verticalAlignment = Alignment.CenterVertically
        ) {
            Text(
                modifier = Modifier.weight(1f),
                text = position,
                style = YappTheme.typography.heading2Bold
            )
            Box(
                modifier = Modifier.size(20.dp),
                contentAlignment = Alignment.Center
            ) {
                Image(
                    modifier = Modifier.size(16.dp),
                    painter = painterResource(coreDesignR.drawable.icon_yapp),
                    contentDescription = null
                )
            }
            Text(
                "${generation}",
                style = YappTheme.typography.label1NormalMedium
            )
        }

        slot?.invoke()
    }
}

피그마 디자인에 맞춰 아이콘 크기 및 간격이 수정이 필요해보입니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

넵 이거 확인해보니 Column 에도 수직 간격이 달라서 그것도 수정했습니다


@Preview(showBackground = true)
@Composable
private fun PreviewHistoryItems() {
HistoryItems(
modifier = Modifier.background(
color = YappTheme.colorScheme.orange99,
shape = RoundedCornerShape(12.dp)
).padding(16.dp),
generation = 20,
position = "운영진"
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.yapp.feature.history.previous

data class PreviousHistoryState(
val items: List<History> = emptyList()
) {
data class History(
val generation: Int,
val position: String,
val activityStartDate: String?,
val activityEndDate: String?
) {
val showSlot = activityEndDate.orEmpty().isNotEmpty() && activityStartDate.orEmpty().isNotEmpty()
}
}

sealed interface PreviousHistorySideEffect {
data object Finish : PreviousHistorySideEffect
}

sealed interface PreviousHistoryIntent {
data object OnEntryScreen : PreviousHistoryIntent
data object OnClickBackButton : PreviousHistoryIntent
Comment on lines +21 to +22
Copy link
Member

Choose a reason for hiding this comment

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

A: 여기도 컨벤션 맞춰주시면 좋을 것 같습니다.

}

Loading