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

[feat] 한경대 서비스 관련 추가 구현 사항점 #260

Merged
merged 11 commits into from
Sep 18, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ internal fun MenuEntity.toModel(): MenuModel {
name = name,
price = price,
imgUrl = imgUrl,
status = status,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ internal fun BoothDetail.toModel(): BoothDetailModel {
longitude = longitude,
menus = menus.map { it.toModel() },
waitingEnabled = waitingEnabled,
openTime = openTime ?: "등록된 정보가 없습니다",
easyhooon marked this conversation as resolved.
Show resolved Hide resolved
closeTime = closeTime ?: "등록된 정보가 없습니다",
)
}

Expand All @@ -33,6 +35,7 @@ internal fun Menu.toModel(): MenuModel {
name = name,
price = price,
imgUrl = imgUrl ?: "",
status = status ?: "등록된 정보가 없습니다",
easyhooon marked this conversation as resolved.
Show resolved Hide resolved
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ data class MenuEntity(
val name: String = "",
val price: Int = 0,
val imgUrl: String = "",
val status: String = "",
)
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,26 @@ fun WaitingCancelDialog(
}
}

@Composable
fun NoShowWaitingCancelDialog(
onCancelClick: () -> Unit,
onConfirmClick: () -> Unit,
) {
UnifestTheme {
UnifestDialog(
onDismissRequest = {},
titleResId = R.string.waiting_no_show_dialog_title,
iconResId = R.drawable.ic_caution,
iconDescription = "Caution Icon",
descriptionResId = R.string.waiting_no_show_dialog_description,
confirmTextResId = R.string.confirm,
cancelTextResId = R.string.cancel,
onCancelClick = onCancelClick,
onConfirmClick = onConfirmClick,
)
}
}

@ComponentPreview
@Composable
private fun ServerErrorDialogPreview() {
Expand Down
14 changes: 14 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_clock.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M8,8m-7.25,0a7.25,7.25 0,1 1,14.5 0a7.25,7.25 0,1 1,-14.5 0"
android:strokeWidth="1.5"
android:fillColor="#ffffff"
android:strokeColor="#1FC0BA"/>
<path
android:pathData="M8.189,3.714C8.189,3.346 7.89,3.048 7.522,3.048C7.154,3.048 6.855,3.346 6.855,3.714V7.986C6.855,8.332 7.035,8.654 7.33,8.836L10.956,11.078C11.267,11.271 11.675,11.17 11.861,10.856C12.043,10.549 11.944,10.152 11.64,9.966L8.667,8.149C8.37,7.967 8.189,7.644 8.189,7.296V3.714Z"
android:fillColor="#1FC0BA"/>
</vector>
8 changes: 8 additions & 0 deletions core/designsystem/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
<string name="liked_booth_removed_failed_message">관심 부스에서 삭제를 실패했습니다.</string>
<string name="booth_empty_menu">등록된 메뉴가 없어요.</string>
<string name="booth_empty_waiting">올바른 전화번호를 입력해 주세요!</string>
<string name="booth_isRunning">운영중</string>
<string name="booth_isClosed">운영종료</string>
<string name="booth_waiting_full">웨이팅은 최대 3부스까지 가능해요!</string>
easyhooon marked this conversation as resolved.
Show resolved Hide resolved
<string name="booth_waiting_already_exists">이미 웨이팅 한 부스에요!</string>

<!-- Map -->
<string name="map_booth_search_text_field_hint">부스 / 주점을 검색해보세요.</string>
Expand Down Expand Up @@ -71,6 +75,10 @@
<string name="waiting_no_waiting">신청한 웨이팅이 없어요</string>
<string name="waiting_no_waiting_description">주점/부스 구경하러 가기></string>
<string name="waiting_my_turn">입장해주세요</string>
<string name="waiting_no_show">부재 처리</string>
<string name="waiting_no_show_description">부재 웨이팅 지우기</string>
<string name="waiting_no_show_dialog_title">부재 웨이팅을 지웁니다</string>
<string name="waiting_no_show_dialog_description">문제가 있는 경우 해당 부스 운영자에 문의바랍니다</string>

<!-- Menu -->
<string name="menu_title">메뉴</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ data class BoothDetailModel(
val likes: Int = 0,
val isLiked: Boolean = false,
val waitingEnabled: Boolean = false,
val openTime: String = "",
val closeTime: String = "",
)

@Stable
Expand All @@ -25,6 +27,7 @@ data class MenuModel(
val name: String,
val price: Int,
val imgUrl: String,
val status: String,
)

@Stable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ data class BoothDetail(
val menus: List<Menu>,
@SerialName("waitingEnabled")
val waitingEnabled: Boolean,
@SerialName("openTime")
val openTime: String? = null,
@SerialName("closeTime")
val closeTime: String? = null,
)

@Serializable
Expand All @@ -79,6 +83,8 @@ data class Menu(
val price: Int,
@SerialName("imgUrl")
val imgUrl: String? = null,
@SerialName("status")
val status: String? = null,
)

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ fun BoothDetailContent(
warning = uiState.boothDetailInfo.warning,
description = uiState.boothDetailInfo.description,
location = uiState.boothDetailInfo.location,
isRunning = uiState.isRunning,
openTime = uiState.boothDetailInfo.openTime,
closeTime = uiState.boothDetailInfo.closeTime,
onAction = onAction,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fun BoothLocationScreen(
) {
Box(modifier = Modifier.fillMaxSize()) {
val cameraPositionState = rememberCameraPositionState {
position = CameraPosition(LatLng(37.5420, 127.07673671067072), 14.8)
position = CameraPosition(LatLng(37.0122749, 127.2635972), 15.8)
}
NaverMap(
cameraPositionState = cameraPositionState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ private fun MenuImageDialogPreview() {
name = "모둠 사시미",
price = 45000,
imgUrl = "",
status = "10개 미만 남음",
),
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.unifest.android.feature.booth.component

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
Expand Down Expand Up @@ -33,22 +36,59 @@ import com.unifest.android.core.designsystem.theme.Content2
import com.unifest.android.core.designsystem.theme.Title5
import com.unifest.android.core.designsystem.theme.UnifestTheme
import com.unifest.android.feature.booth.viewmodel.BoothUiAction
import java.time.LocalTime
import java.time.format.DateTimeFormatter
import java.time.format.DateTimeParseException

@Composable
fun BoothDescription(
name: String,
warning: String,
description: String,
location: String,
isRunning: Boolean,
openTime: String,
closeTime: String,
onAction: (BoothUiAction) -> Unit,
) {
val configuration = LocalConfiguration.current
val maxWidth = remember(configuration) {
val screenWidth = configuration.screenWidthDp.dp - 40.dp
screenWidth * (2 / 3f)
}
// 포매터 정의
val formatter = DateTimeFormatter.ofPattern("HH:mm")
val parser = DateTimeFormatter.ofPattern("HH:mm:ss")

Column(modifier = Modifier.padding(horizontal = 20.dp)) {
// 시간 파싱 및 형식화 함수
fun parseAndFormatTime(time: String?): Pair<String, LocalTime?> {
easyhooon marked this conversation as resolved.
Show resolved Hide resolved
return if (time.isNullOrBlank() || time == "등록된 정보가 없습니다") {
"등록된 정보가 없습니다" to null
} else {
try {
val localTime = LocalTime.parse(time, parser)
localTime.format(formatter) to localTime
} catch (e: DateTimeParseException) {
"등록된 정보가 없습니다" to null
}
}
}

val (openTimeFormatted, openLocalTime) = parseAndFormatTime(openTime)
val (closeTimeFormatted, closeLocalTime) = parseAndFormatTime(closeTime)

// 현재 시간 가져오기
val currentTime = LocalTime.now()

// 부스 운영 여부 확인
val isBoothRunning = openLocalTime != null && closeLocalTime != null &&
currentTime.isAfter(openLocalTime) && currentTime.isBefore(closeLocalTime)

Column(
modifier = Modifier
.padding(horizontal = 20.dp)
.animateContentSize(),
) {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
text = name,
Expand All @@ -73,7 +113,52 @@ fun BoothDescription(
color = MaterialTheme.colorScheme.onSecondary,
style = Content2.copy(lineHeight = 18.sp),
)
Spacer(modifier = Modifier.height(20.dp))
Spacer(modifier = Modifier.height(22.dp))
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.padding(top = 8.dp)
.clickable { onAction(BoothUiAction.OnRunningClick) },
) {
Icon(
imageVector = ImageVector.vectorResource(id = R.drawable.ic_clock),
contentDescription = "location icon",
tint = Color.Unspecified,
)
Spacer(modifier = Modifier.width(8.dp))
Text(
text = if (isBoothRunning) {
stringResource(id = R.string.booth_isRunning)
} else {
stringResource(id = R.string.booth_isClosed)
},
color = MaterialTheme.colorScheme.onBackground,
style = BoothLocation,
)
Spacer(modifier = Modifier.width(8.dp))
Icon(
imageVector = ImageVector.vectorResource(R.drawable.ic_arrow_below),
contentDescription = "arrow below",
tint = Color.Unspecified,
)
}
AnimatedVisibility(visible = isRunning) {
Column {
Spacer(modifier = Modifier.height(8.dp))
Text(
text = "Open Time: $openTimeFormatted",
color = MaterialTheme.colorScheme.onBackground,
style = BoothLocation,
)
Spacer(modifier = Modifier.height(4.dp))
Text(
text = "Close Time: $closeTimeFormatted",
color = MaterialTheme.colorScheme.onBackground,
style = BoothLocation,
)
}
}
Spacer(modifier = Modifier.height(11.dp))
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(top = 8.dp),
Expand Down Expand Up @@ -112,6 +197,9 @@ fun BoothDescriptionPreview() {
warning = "누구나 환영",
description = "컴퓨터 공학과와 물리학과가 함께하는 협동부스입니다. 방문자 이벤트로 무료 안주 하나씩 제공중이에요!!",
location = "공학관",
isRunning = true,
openTime = "10:00",
closeTime = "22:00",
onAction = {},
)
}
Expand Down
Loading
Loading