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/#22] : 그룹 상세, 약속 확정 뷰 엔티티 수정 #24

Merged
merged 22 commits into from
Jan 17, 2025

Conversation

gaeulzzang
Copy link
Contributor

@gaeulzzang gaeulzzang commented Jan 14, 2025

✅ 𝗖𝗵𝗲𝗰𝗸-𝗟𝗶𝘀𝘁

  • merge할 브랜치의 위치를 확인해 주세요.(main❌/develop⭕)
  • 리뷰가 필요한 경우 리뷰어를 지정해 주세요.
  • 리뷰는 PR이 올라오면 최대한 빠르게 진행합니다.
  • P1 단계의 리뷰는 빠르게 확인 후 반영합니다.
  • Approve된 PR은 assigner가 머지하고, 수정 요청이 온 경우 수정 후 다시 push를 합니다.

📌 𝗜𝘀𝘀𝘂𝗲𝘀

📎 𝗪𝗼𝗿𝗸 𝗗𝗲𝘀𝗰𝗿𝗶𝗽𝘁𝗶𝗼𝗻

  • 서버 api 명세서 참고해서 엔티티 수정하기
  • 뷰 디테일 다듬기 (그룹 상세 그룹 이미지 추가, 패딩 수정)

📷 𝗦𝗰𝗿𝗲𝗲𝗻𝘀𝗵𝗼𝘁

Screen_recording_20250114_224118.mp4

💬 𝗧𝗼 𝗥𝗲𝘃𝗶𝗲𝘄𝗲𝗿𝘀

계속 기능이 추가되는 느낌이라 명세서에도 놓친 부분이 많더라구요...
일단 명세서 최대한 반영해서 엔티티 수정했습니답..!!

core/util에 CalculateTime 클래스 만들어서 날짜 계산하는 함수 만들어놨는데.. 진행 중, 확정, 약속 상세 뷰에서 날짜 형식이 다 달라서 통일 시켜야 될 것 같아요... 😢 (날짜 통일 관련된건리더 회의 때 얘기해보겠습니답) ISO 8601 날짜 형식에서 필요한 정보만 쏙쏙 뽑을 수 있는 효율적인 로직 작성하는 방법 있으면 알려주세욤...

class CalculateTime {
    fun extractDate(dateTime: String): String {
        return parseDateTime(dateTime).toLocalDate().format(DateTimeFormatter.ofPattern("MM/dd"))
    }

    fun extractDayOfWeek(dateTime: String): String {
        return parseDateTime(dateTime).dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.KOREAN)
    }

    fun extractHour(dateTime: String): String {
        return "${parseDateTime(dateTime).hour}"
    }

    fun extractFullDate(dateTime: String): String {
        val parsedDateTime = parseDateTime(dateTime)
        val year = parsedDateTime.year
        val month = parsedDateTime.monthValue
        val day = parsedDateTime.dayOfMonth
        val dayOfWeek = parsedDateTime.dayOfWeek.getDisplayName(TextStyle.FULL, Locale.KOREAN)

        return "${year}${month}${day}$dayOfWeek"
    }

    private fun parseDateTime(dateTime: String): LocalDateTime {
        val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")
        return LocalDateTime.parse(dateTime, formatter)
    }
}

AppointmentConfirmRoute랑 ConfirmedDetailRoute 보면 유저가 참여 가능한지 불가능한지를 계산해서 "나" 칩으로 보이도록 하는 로직이 있는데 ... 코드가 너무 더러운 것 같아요. 깔끔하게 바꾸는 방법 알려주시면 감사하겠습니답

    val isAvailable = data.myIdentity.availability == "available"
    val rearrangeList = RearrangeList()
    val availableMembers = rearrangeList.rearrangeMembersBasedOnAvailability(
        data.myIdentity,
        data.availableMembers
    )
    val unavailableMembers = rearrangeList.rearrangeMembersBasedOnAvailability(
        data.myIdentity,
        data.unavailableMembers
    )

@gaeulzzang gaeulzzang added ♻️ [REFACTOR] 코드 리팩토링 🍂 가을 가응가 labels Jan 14, 2025
@gaeulzzang gaeulzzang self-assigned this Jan 14, 2025
@gaeulzzang gaeulzzang requested a review from a team as a code owner January 14, 2025 13:58
Copy link
Member

@Eonji-sw Eonji-sw left a comment

Choose a reason for hiding this comment

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

전... 충분히 리팩 했다고 생각합니당 ㅋㅋ ㄹㅇ 너무 복잡해서 이해도 어려움;

Copy link
Contributor

@youjin09222 youjin09222 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 말씀해주신 부분 확인해봤는데 좋은 아이디어가 떠오르지 않네요..

Comment on lines 173 to 179
availableMembers.forEachIndexed { index, member ->
NoostakUserChip(
text = member,
text = if (isAvailable && index == 0) stringResource(id = R.string.user_chip_me) else member,
textColor = NoostakTheme.colors.black,
backgroundColor = if (member == "나") NoostakTheme.colors.blue200 else NoostakTheme.colors.white,
backgroundColor = if (isAvailable && index == 0) NoostakTheme.colors.blue200 else NoostakTheme.colors.white,
borderColor = NoostakTheme.colors.blue200
)
Copy link
Contributor

Choose a reason for hiding this comment

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

P2: 여기 ConfirmedDetail이랑 로직 같은거 같은데 따로 빼서 같이 쓰는건 어때요??

@Composable
fun GenerateUserChips(
    members: List<String>,
    myIdentity: IdentityEntity
) {
    members.forEachIndexed { index, member ->
        val isMe = index == 0 && myIdentity.availability == "available"
        NoostakUserChip(
            text = if (isMe) stringResource(id = R.string.user_chip_me) else member,
            textColor = NoostakTheme.colors.black,
            backgroundColor = if (isMe) NoostakTheme.colors.blue200 else NoostakTheme.colors.white,
            borderColor = NoostakTheme.colors.blue200
        )
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

할렐루야 ⛪ Amen

Comment on lines 195 to 201
unavailableMembers.forEachIndexed { index, member ->
NoostakUserChip(
text = member,
text = if (!isAvailable && index == 0) stringResource(id = R.string.user_chip_me) else member,
textColor = NoostakTheme.colors.gray800,
backgroundColor = if (member == "나") NoostakTheme.colors.blue200 else NoostakTheme.colors.gray200,
borderColor = if (member == "나") NoostakTheme.colors.blue200 else NoostakTheme.colors.gray200
backgroundColor = if (!isAvailable && index == 0) NoostakTheme.colors.blue200 else NoostakTheme.colors.gray200,
borderColor = if (!isAvailable && index == 0) NoostakTheme.colors.blue200 else NoostakTheme.colors.gray200
)
Copy link
Contributor

Choose a reason for hiding this comment

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

P3: 이것도 같이 관리하고 싶었는데 if문 넘 많아서 포기...

@gaeulzzang gaeulzzang merged commit 83a4679 into develop Jan 17, 2025
1 check passed
@gaeulzzang gaeulzzang deleted the feature/#22-entity-refactor branch January 22, 2025 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍂 가을 가응가 ♻️ [REFACTOR] 코드 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] : 엔티티 수정
3 participants