Skip to content

Commit

Permalink
[MERGE] #204 -> develop
Browse files Browse the repository at this point in the history
[UI/#204] ν™ˆ λ·° / UI μˆ˜μ •μ‚¬ν•­ 반영 및 λ¦¬νŒ©ν† λ§
  • Loading branch information
Hyobeen-Park authored Sep 9, 2024
2 parents 5e95261 + ec25157 commit 9f64413
Show file tree
Hide file tree
Showing 43 changed files with 953 additions and 1,544 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.noRippleClickable
import com.terning.core.type.SortBy
import kotlinx.coroutines.launch

@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -64,7 +65,7 @@ fun SortingBottomSheet(
) {
items(sortByCount) { sortIndex ->
Text(
text = stringResource(id = SortBy.entries[sortIndex].type),
text = stringResource(id = SortBy.entries[sortIndex].sortBy),
style = TerningTheme.typography.button3,
color = if (currentSortBy == sortIndex) TerningMain else Grey400,
textAlign = TextAlign.Start,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.Grey150
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.Grey375
import com.terning.core.designsystem.theme.Grey50
import com.terning.core.designsystem.theme.TerningMain
import com.terning.core.designsystem.theme.TerningSub1
import com.terning.core.designsystem.theme.TerningSub5
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.core.util.NoRippleTheme
Expand All @@ -42,16 +43,16 @@ fun ChangeFilterButton(
val isPressed by interactionSource.collectIsPressedAsState()
val backgroundColor = when {
!isSelected && !isPressed -> White
!isSelected && isPressed -> TerningSub5
else -> TerningMain
!isSelected && isPressed -> Grey50
else -> White
}
val textColor = when {
!isSelected -> Grey400
else -> White
!isSelected -> Grey375
else -> TerningMain
}
val borderColor = when {
!isSelected && !isPressed -> TerningMain
!isSelected && isPressed -> TerningSub1
!isSelected && !isPressed -> Grey150
!isSelected && isPressed -> Grey200
else -> TerningMain
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,43 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.terning.core.R
import com.terning.core.designsystem.component.bottomsheet.SortBy
import com.terning.core.type.SortBy
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.extension.noRippleClickable

@Composable
fun SortingButton(
sortBy: Int = 0,
modifier: Modifier = Modifier,
sortBy: Int = 0,
onCLick: () -> Unit,
) {
Row(
modifier = modifier
.noRippleClickable { onCLick() }
.noRippleClickable(onCLick),
) {
Text(
text = stringResource(
id = SortBy.entries[sortBy].type
id = SortBy.entries[sortBy].sortBy
),
style = TerningTheme.typography.button3,
color = Black,
modifier = modifier
modifier = Modifier
.padding(
top = 6.dp,
bottom = 5.dp,
start = 12.dp,
bottom = 6.dp,
)
)
Image(
painter = painterResource(id = R.drawable.ic_down_18),
contentDescription = stringResource(id = R.string.sort_button_description),
modifier = modifier
.padding(vertical = 5.dp)
.padding(end = 2.dp)
modifier = Modifier
.padding(
start = 2.dp,
end = 2.dp,
top = 6.dp,
bottom = 4.dp,
)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.ui.graphics.Color

// Grey Scale
val White = Color(0xFFFFFFFF)
val Grey50 = Color(0xFFFCFCFC)
val Grey100 = Color(0xFFF5F5F5)
val Grey150 = Color(0xFFE9E9E9)
val Grey200 = Color(0xFFDDDDDD)
Expand Down
24 changes: 24 additions & 0 deletions core/src/main/java/com/terning/core/type/Grade.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.terning.core.type

import androidx.annotation.StringRes
import com.terning.core.R

enum class Grade(
val stringValue: String,
@StringRes val stringResId: Int,
) {
FRESHMAN("freshman", R.string.change_filter_grade_1),
SOPHOMORE("sophomore", R.string.change_filter_grade_2),
JUNIOR("junior", R.string.change_filter_grade_3),
SENIOR("senior", R.string.change_filter_grade_4);

companion object {
fun fromString(value: String?): Grade = when (value) {
"freshman" -> FRESHMAN
"sophomore" -> SOPHOMORE
"junior" -> JUNIOR
"senior" -> SENIOR
else -> FRESHMAN
}
}
}
15 changes: 15 additions & 0 deletions core/src/main/java/com/terning/core/type/SortBy.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.terning.core.type

import androidx.annotation.StringRes
import com.terning.core.R

enum class SortBy(
@StringRes val sortBy: Int,
val type: String,
) {
EARLIEST(R.string.sort_by_earliest, "deadlineSoon"),
SHORTEST(R.string.sort_by_shortest, "shortestDuration"),
LONGEST(R.string.sort_by_longest, "longestDuration"),
SCRAP(R.string.sort_by_scrap, "mostScrapped"),
VIEW_COUNT(R.string.sort_by_view_count, "mostViewed"),
}
22 changes: 22 additions & 0 deletions core/src/main/java/com/terning/core/type/WorkingPeriod.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.terning.core.type

import androidx.annotation.StringRes
import com.terning.core.R

enum class WorkingPeriod(
val stringValue: String,
@StringRes val stringResId: Int,
) {
SHORT("short", R.string.change_filter_period_1),
MIDDLE("middle", R.string.change_filter_period_2),
LONG("long", R.string.change_filter_period_3);

companion object {
fun fromString(value: String?): WorkingPeriod = when (value) {
"short" -> SHORT
"middle" -> MIDDLE
"long" -> LONG
else -> SHORT
}
}
}
14 changes: 14 additions & 0 deletions core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,18 @@
<string name="sign_up_helper_available">μ‚¬μš© κ°€λŠ₯ν•œ μ΄λ¦„μ΄μ—μš”</string>
<string name="sign_up_helper_out">이름은 12자리 μ΄λ‚΄λ‘œ μ„€μ •ν•΄ μ£Όμ„Έμš”</string>

<!--ChangeFilter-->
<string name="change_filter_top_bar_title">필터링 μž¬μ„€μ •</string>
<string name="change_filter_grade_title">μž¬ν•™ μƒνƒœ</string>
<string name="change_filter_save">μ €μž₯ν•˜κΈ°</string>
<string name="change_filter_grade_1">1ν•™λ…„</string>
<string name="change_filter_grade_2">2ν•™λ…„</string>
<string name="change_filter_grade_3">3ν•™λ…„</string>
<string name="change_filter_grade_4">4ν•™λ…„</string>
<string name="change_filter_period_title">희망 근무 κΈ°κ°„</string>
<string name="change_filter_period_1">1κ°œμ›” ~ 3κ°œμ›”</string>
<string name="change_filter_period_2">4κ°œμ›” ~ 6κ°œμ›”</string>
<string name="change_filter_period_3">7κ°œμ›” 이상</string>
<string name="change_filter_start_work_title">근무 μ‹œμž‘ μ‹œκΈ°</string>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import com.terning.data.dto.NonDataBaseResponse
import com.terning.data.dto.request.ChangeFilterRequestDto
import com.terning.data.dto.response.HomeFilteringInfoResponseDto
import com.terning.data.dto.response.HomeRecommendInternResponseDto
import com.terning.data.dto.response.HomeTodayInternResponseDto
import com.terning.data.dto.response.HomeUpcomingInternResponseDto

interface HomeDataSource {
suspend fun getTodayIntern(): BaseResponse<List<HomeTodayInternResponseDto>>
suspend fun getUpcomingIntern(): BaseResponse<List<HomeUpcomingInternResponseDto>>

suspend fun getRecommendIntern(
sortBy: String,
startYear: Int,
startMonth: Int
): BaseResponse<List<HomeRecommendInternResponseDto>>
): BaseResponse<HomeRecommendInternResponseDto>

suspend fun getFilteringInfo(): BaseResponse<HomeFilteringInfoResponseDto>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ import com.terning.data.dto.NonDataBaseResponse
import com.terning.data.dto.request.ChangeFilterRequestDto
import com.terning.data.dto.response.HomeFilteringInfoResponseDto
import com.terning.data.dto.response.HomeRecommendInternResponseDto
import com.terning.data.dto.response.HomeTodayInternResponseDto
import com.terning.data.dto.response.HomeUpcomingInternResponseDto
import com.terning.data.service.HomeService
import javax.inject.Inject

class HomeDataSourceImpl @Inject constructor(
private val homeService: HomeService,
) : HomeDataSource {
override suspend fun getTodayIntern(): BaseResponse<List<HomeTodayInternResponseDto>> =
homeService.getHomeTodayIntern()
override suspend fun getUpcomingIntern(): BaseResponse<List<HomeUpcomingInternResponseDto>> =
homeService.getHomeUpcomingIntern()

override suspend fun getRecommendIntern(
sortBy: String,
startYear: Int,
startMonth: Int
): BaseResponse<List<HomeRecommendInternResponseDto>> =
): BaseResponse<HomeRecommendInternResponseDto> =
homeService.getRecommendIntern(
sortBy = sortBy,
startYear = startYear,
Expand All @@ -30,6 +30,6 @@ class HomeDataSourceImpl @Inject constructor(
override suspend fun getFilteringInfo(): BaseResponse<HomeFilteringInfoResponseDto> =
homeService.getFilteringInfo()

override suspend fun putFilteringInfo(request: ChangeFilterRequestDto): NonDataBaseResponse =
homeService.putFilteringInfo(request)
override suspend fun putFilteringInfo(changeFilterRequestDto: ChangeFilterRequestDto): NonDataBaseResponse =
homeService.putFilteringInfo(changeFilterRequestDto)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@ import kotlinx.serialization.Serializable

@Serializable
data class HomeRecommendInternResponseDto(
@SerialName("scrapId")
val scrapId: Long?,
@SerialName("intershipAnnouncementId")
val internshipAnnouncementId: Long,
@SerialName("title")
val title: String,
@SerialName("dDay")
val dDay: String,
@SerialName("deadline")
val deadline: String,
@SerialName("workingPeriod")
val workingPeriod: String,
@SerialName("startYearMonth")
val startYearMonth: String,
@SerialName("companyImage")
val companyImage: String,
@SerialName("isScrapped")
val isScrapped: Boolean,
)
@SerialName("totalCount")
val totalCount: Int,
@SerialName("result")
val result: List<Result>
) {
@Serializable
data class Result(
@SerialName("intershipAnnouncementId")
val internshipAnnouncementId: Long,
@SerialName("title")
val title: String,
@SerialName("dDay")
val dDay: String,
@SerialName("deadline")
val deadline: String,
@SerialName("workingPeriod")
val workingPeriod: String,
@SerialName("startYearMonth")
val startYearMonth: String,
@SerialName("companyImage")
val companyImage: String,
@SerialName("isScrapped")
val isScrapped: Boolean,
@SerialName("color")
val color: String?,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class HomeTodayInternResponseDto(
@SerialName("scrapId")
val scrapId: Long,
data class HomeUpcomingInternResponseDto(
@SerialName("internshipAnnouncementId")
val internshipAnnouncementId: Long,
@SerialName("companyImage")
Expand All @@ -19,9 +17,10 @@ data class HomeTodayInternResponseDto(
val deadline: String,
@SerialName("workingPeriod")
val workingPeriod: String,
@SerialName("isScrapped")
val isScrapped: Boolean,
@SerialName("color")
val color: String,
@SerialName("startYearMonth")
val startYearMonth: String,

)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import com.terning.domain.entity.home.HomeRecommendIntern

fun HomeRecommendInternResponseDto.toHomeRecommendInternList(): HomeRecommendIntern =
HomeRecommendIntern(
scrapId = this.scrapId,
totalCount = this.totalCount,
homeRecommendInternDetail = this.result.map {
it.toHomeRecommendInternDetail()
}
)

fun HomeRecommendInternResponseDto.Result.toHomeRecommendInternDetail(): HomeRecommendIntern.HomeRecommendInternDetail =
HomeRecommendIntern.HomeRecommendInternDetail(
internshipAnnouncementId = this.internshipAnnouncementId,
title = this.title,
dDay = this.dDay,
Expand All @@ -14,4 +21,5 @@ fun HomeRecommendInternResponseDto.toHomeRecommendInternList(): HomeRecommendInt
startYearMonth = this.startYearMonth,
companyImage = this.companyImage,
isScrapped = this.isScrapped,
)
color = this.color,
)
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.terning.data.mapper.home

import com.terning.data.dto.response.HomeTodayInternResponseDto
import com.terning.domain.entity.home.HomeTodayIntern
import com.terning.data.dto.response.HomeUpcomingInternResponseDto
import com.terning.domain.entity.home.HomeUpcomingIntern

fun HomeTodayInternResponseDto.toHomeTodayInternList(): HomeTodayIntern =
HomeTodayIntern(
scrapId = this.scrapId,
fun HomeUpcomingInternResponseDto.toHomeUpcomingInternList(): HomeUpcomingIntern =
HomeUpcomingIntern(
internshipAnnouncementId = this.internshipAnnouncementId,
companyImage = this.companyImage,
title = this.title,
dDay = this.dDay,
deadline = this.deadline,
workingPeriod = this.workingPeriod,
isScrapped = this.isScrapped,
startYearMonth = this.startYearMonth,
color = this.color,
)
Loading

0 comments on commit 9f64413

Please sign in to comment.