Skip to content

Commit

Permalink
[MERGE] #214 -> develop
Browse files Browse the repository at this point in the history
[UI/#214] 달력 / 2차 스프린트
  • Loading branch information
boiledEgg-s authored Sep 9, 2024
2 parents 57a5058 + ab8d72d commit 61fa69b
Show file tree
Hide file tree
Showing 41 changed files with 465 additions and 298 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ fun CalendarTopAppBar(
.fillMaxWidth()
.background(color = Color.White)
.padding(
top = 23.dp,
bottom = 22.dp,
start = 22.dp,
end = 22.dp
vertical = 20.dp,
horizontal = 21.dp
)
) {
Row(
Expand Down
32 changes: 32 additions & 0 deletions core/src/main/java/com/terning/core/extension/Modifier.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.focus.FocusManager
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Paint
import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
Expand Down Expand Up @@ -88,3 +92,31 @@ fun Modifier.customShadow(
}
}
}

@SuppressLint("ModifierFactoryUnreferencedReceiver", "ReturnFromAwaitPointerEventScope")
fun Modifier.swipableVertically(
setHideComponent: () -> Unit
) = composed {
var initialTouchPosition by remember { mutableStateOf<Offset?>(null) }
pointerInput(Unit) {
awaitPointerEventScope {
while (true) {
val event = awaitPointerEvent()
val position = event.changes.first().position

if (event.changes.first().pressed) {
if (initialTouchPosition == null) {
initialTouchPosition = position
} else {
val deltaY = initialTouchPosition?.let { position.y - it.y }
if (deltaY != null && deltaY > 300f) {
setHideComponent()
}
}
} else {
initialTouchPosition = null
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terning.data.datasource

import com.terning.data.dto.NonDataBaseResponse
import com.terning.domain.entity.CalendarScrapRequest
import com.terning.domain.entity.calendar.CalendarScrapRequest

interface ScrapDataSource {
suspend fun postScrap(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.terning.data.datasource.ScrapDataSource
import com.terning.data.dto.NonDataBaseResponse
import com.terning.data.dto.request.ScrapColorRequestDto
import com.terning.data.service.ScrapService
import com.terning.domain.entity.CalendarScrapRequest
import com.terning.domain.entity.calendar.CalendarScrapRequest
import javax.inject.Inject

class ScrapDataSourceImpl @Inject constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
package com.terning.data.dto.response

import com.terning.domain.entity.CalendarScrapDetail
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class CalendarDayListResponseDto(
@SerialName("scrapId")
val scrapId: Long,
@SerialName("internshipAnnouncementId")
val internshipAnnouncementId: Long,
@SerialName("title")
val title: String,
@SerialName("dDay")
val dDay: String,
@SerialName("deadline")
val deadline: String,
@SerialName("workingPeriod")
val workingPeriod: String,
@SerialName("color")
val color: String,
@SerialName("companyImage")
val companyImage: String,
@SerialName("startYear")
val startYear: Int,
@SerialName("startMonth")
val startMonth: Int
@SerialName("startYearMonth")
val startYearMonth: String,
@SerialName("isScrapped")
val isScrapped: Boolean
)
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
package com.terning.data.dto.response

import com.terning.domain.entity.CalendarScrapDetail
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class CalendarMonthListResponseDto(
@SerialName("deadline")
val deadline: String,
@SerialName("scraps")
val scraps: List<Scrap>
@SerialName("announcements")
val announcements: List<Announcement>
) {
@Serializable
data class Scrap(
@SerialName("scrapId")
val scrapId: Long,
data class Announcement(
@SerialName("internshipAnnouncementId")
val internshipAnnouncementId: Long,
@SerialName("title")
val title: String,
@SerialName("companyImage")
val companyImage: String,
@SerialName("dDay")
val dDay: String,
@SerialName("title")
val title: String,
@SerialName("workingPeriod")
val workingPeriod: String,
@SerialName("isScrapped")
val isScrapped: Boolean,
@SerialName("color")
val color: String,
@SerialName("companyImage")
val companyImage: String,
@SerialName("startYear")
val startYear: Int,
@SerialName("startMonth")
val startMonth: Int
@SerialName("deadline")
val deadline: String,
@SerialName("startYearMonth")
val startYearMonth: String,
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.terning.data.dto.response

import com.terning.domain.entity.CalendarScrap
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package com.terning.data.mapper

import com.terning.data.dto.response.CalendarMonthListResponseDto
import com.terning.domain.entity.CalendarScrapDetail
import com.terning.domain.entity.calendar.CalendarScrapDetail

fun CalendarMonthListResponseDto.toCalendarScrapDetailList(): List<CalendarScrapDetail> = scraps.map { scrap ->
fun CalendarMonthListResponseDto.toCalendarScrapDetailList(): List<CalendarScrapDetail> = announcements.map { announcement ->
CalendarScrapDetail(
scrapId = scrap.scrapId,
internshipAnnouncementId = scrap.internshipAnnouncementId,
title = scrap.title,
dDay = scrap.dDay,
workingPeriod = scrap.workingPeriod,
color = scrap.color,
companyImage = scrap.companyImage,
startYear = scrap.startYear,
startMonth = scrap.startMonth,
deadLine = deadline
internshipAnnouncementId = announcement.internshipAnnouncementId,
title = announcement.title,
dDay = announcement.dDay,
workingPeriod = announcement.workingPeriod,
color = announcement.color,
companyImage = announcement.companyImage,
startYearMonth = announcement.startYearMonth,
deadline = announcement.deadline,
isScrapped = announcement.isScrapped
)
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package com.terning.data.mapper

import com.terning.data.dto.response.CalendarDayListResponseDto
import com.terning.domain.entity.CalendarScrapDetail
import com.terning.domain.entity.calendar.CalendarScrapDetail

fun CalendarDayListResponseDto.toCalendarScrapDetail() =
CalendarScrapDetail(
scrapId = scrapId,
internshipAnnouncementId = internshipAnnouncementId,
title = title,
dDay = dDay,
workingPeriod = workingPeriod,
color = color,
companyImage = companyImage,
startYear = startYear,
startMonth = startMonth,
deadLine = ""
startYearMonth = startYearMonth,
deadline = deadline,
isScrapped = isScrapped
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terning.data.mapper

import com.terning.data.dto.response.CalendarMonthResponseDto
import com.terning.domain.entity.CalendarScrap
import com.terning.domain.entity.calendar.CalendarScrap

fun CalendarMonthResponseDto.toCalendarScrapList(): List<CalendarScrap> = scraps.map { scrap ->
CalendarScrap(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.terning.data.dto.request.CalendarMonthRequestDto
import com.terning.data.mapper.toCalendarScrapDetail
import com.terning.data.mapper.toCalendarScrapDetailList
import com.terning.data.mapper.toCalendarScrapList
import com.terning.domain.entity.CalendarScrapDetail
import com.terning.domain.entity.CalendarScrap
import com.terning.domain.entity.calendar.CalendarScrapDetail
import com.terning.domain.entity.calendar.CalendarScrap
import com.terning.domain.repository.CalendarRepository
import java.time.LocalDate
import java.time.format.DateTimeFormatter
Expand Down Expand Up @@ -50,7 +50,7 @@ class CalendarRepositoryImpl @Inject constructor(

val scrapModelMapByDeadLine = result.flatMap { dto ->
dto.toCalendarScrapDetailList()
}.groupBy { it.deadLine }
}.groupBy { it.deadline }

scrapModelMapByDeadLine
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terning.data.repositoryimpl

import com.terning.data.datasource.ScrapDataSource
import com.terning.domain.entity.CalendarScrapRequest
import com.terning.domain.entity.calendar.CalendarScrapRequest
import com.terning.domain.repository.ScrapRepository
import javax.inject.Inject

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.terning.domain.entity
package com.terning.domain.entity.calendar

data class CalendarScrap(
val scrapId: Long,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.terning.domain.entity
package com.terning.domain.entity.calendar

data class CalendarScrapDetail(
val scrapId: Long,
val internshipAnnouncementId: Long,
val title: String,
val dDay: String,
val workingPeriod: String,
val deadline: String,
val color: String,
val companyImage: String,
val startYear: Int,
val startMonth: Int,
val deadLine: String,
val isScrapped: Boolean = true
val startYearMonth: String,
val isScrapped: Boolean
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.terning.domain.entity
package com.terning.domain.entity.calendar

data class CalendarScrapRequest(
val id: Long,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terning.domain.repository

import com.terning.domain.entity.CalendarScrapDetail
import com.terning.domain.entity.CalendarScrap
import com.terning.domain.entity.calendar.CalendarScrapDetail
import com.terning.domain.entity.calendar.CalendarScrap
import java.time.LocalDate

interface CalendarRepository{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terning.domain.repository

import com.terning.domain.entity.CalendarScrapRequest
import com.terning.domain.entity.calendar.CalendarScrapRequest

interface ScrapRepository {
suspend fun postScrap(calendarScrapRequest: CalendarScrapRequest): Result<Unit>
Expand Down
Loading

0 comments on commit 61fa69b

Please sign in to comment.