Skip to content

Commit

Permalink
Merge pull request #328 from 6QuizOnTheBlock/and/feat#317-relay_pass
Browse files Browse the repository at this point in the history
And/feat#317 ํ•™์ƒ ๋ฆด๋ ˆ์ด ์ „๋‹ฌ ๊ธฐ๋Šฅ
  • Loading branch information
ghddbwns9808 authored May 14, 2024
2 parents f28518f + 53409c4 commit b516e13
Show file tree
Hide file tree
Showing 42 changed files with 1,156 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
Expand Down Expand Up @@ -44,7 +45,7 @@ fun UlbanRunnerItem(
color: Color = Cream
) {
Column(modifier = modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
Box(modifier = Modifier.wrapContentSize()) {
Box(modifier = Modifier.wrapContentSize().padding(bottom = 10.dp)) {
Card(
colors = CardDefaults.cardColors(
containerColor = color
Expand All @@ -64,7 +65,8 @@ fun UlbanRunnerItem(
model = memberPhoto,
placeholder = painterResource(id = R.drawable.student_boy),
contentDescription = null,
modifier = Modifier.size(80.dp)
modifier = Modifier.size(80.dp),
contentScale = ContentScale.Crop
)
Column(
modifier = Modifier.padding(start = 16.dp),
Expand All @@ -86,7 +88,7 @@ fun UlbanRunnerItem(
Text(
text = question,
style = UlbanTypography.bodyMedium,
maxLines = 1,
maxLines = 2,
overflow = TextOverflow.Ellipsis
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
package com.sixkids.designsystem.component.screen

import androidx.annotation.DrawableRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
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.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.sixkids.designsystem.R
import com.sixkids.designsystem.component.button.UlbanFilledButton
import com.sixkids.designsystem.theme.Orange
import com.sixkids.designsystem.theme.Purple
import com.sixkids.designsystem.theme.UlbanTheme
import com.sixkids.designsystem.theme.UlbanTypography

@Composable
fun RelayPassResultScreen(
paddingValues: PaddingValues = PaddingValues(horizontal = 30.dp, vertical = 40.dp),
title: String = stringResource(R.string.relay_pass_result_title),
subTitle: String = stringResource(R.string.relay_pass_result_subtitle_sender),
bodyTop: String = stringResource(R.string.relay_pass_result_body_top_receiver),
bodyMiddle: String,
bodyBottom: String = stringResource(R.string.relay_pass_result_body_bottom_sender),
@DrawableRes imgRes: Int = R.drawable.relay_success,
backgroundColor: Color = Orange,
onClick: () -> Unit = {}
) {
val screenWidthDp = with(LocalDensity.current) {
LocalContext.current.resources.displayMetrics.widthPixels.toDp()
}

Column(
modifier = Modifier
.fillMaxSize()
.padding(paddingValues),
) {
Text(
text = title,
style = UlbanTypography.titleMedium,
modifier = Modifier.padding(bottom = 15.dp)
)

Text(text = subTitle, style = UlbanTypography.bodyMedium)

Spacer(modifier = Modifier.height(100.dp))

BoxWithConstraints(modifier = Modifier.fillMaxWidth()) {
Box(modifier = Modifier.align(Alignment.Center)) {
Box(
modifier = Modifier
.size(screenWidthDp / 2)
.clip(RoundedCornerShape(28.dp))
.background(backgroundColor)
.align(Alignment.Center)
)

Image(
painter = painterResource(id = imgRes),
contentDescription = "success",
modifier = Modifier
.size(screenWidthDp / 2 + screenWidthDp / 7)
.offset(y = -screenWidthDp / 10)
.align(Alignment.Center)
)
}
}

Column(
modifier = Modifier.align(Alignment.CenterHorizontally),
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = bodyTop,
style = UlbanTypography.bodyLarge,
modifier = Modifier.padding(top = 30.dp),
textAlign = TextAlign.Center
)

Text(
text = bodyMiddle,
style = UlbanTypography.titleMedium.copy(lineHeight = 30.sp),
modifier = Modifier.padding(top = 30.dp, start = 20.dp, end = 20.dp),
textAlign = TextAlign.Center
)

Text(
text = bodyBottom,
style = UlbanTypography.bodyLarge,
modifier = Modifier.padding(top = 30.dp),
textAlign = TextAlign.Center
)

}

Spacer(modifier = Modifier.weight(1f))

UlbanFilledButton(
modifier = Modifier.fillMaxWidth(),
text = stringResource(R.string.relay_pass_result_button_done),
onClick = { onClick() }
)

}
}

@Composable
@Preview(showBackground = true)
fun RelayPassResultScreenPreview() {
UlbanTheme {
RelayPassResultScreen(
bodyTop = "์˜คํ•˜๋นˆ ํ•™์ƒ์ด",
bodyMiddle = "\"์šฐ๋ฆฌ๋ฐ˜์—์„œ ๊ฐ€์žฅ ๊ณต๋ถ€๋ฅผ ์ž˜ ํ•˜๋Š” ์นœ๊ตฌ๋Š” ๋ˆ„๊ตฌ์•ผ?\"",
)
}
}

@Composable
@Preview(showBackground = true)
fun RelayPassResultBombScreenPreview() {
UlbanTheme {
RelayPassResultScreen(
title = "์ด๋Ÿฐ! ํญํƒ„์ด ํ„ฐ์กŒ์–ด์š”",
subTitle = "-100 exp",
bodyTop = "์˜คํ•˜๋นˆ ํ•™์ƒ์ด",
bodyMiddle = "\"์šฐ๋ฆฌ๋ฐ˜์—์„œ ๊ฐ€์žฅ ๊ณต๋ถ€๋ฅผ ์ž˜ ํ•˜๋Š” ์นœ๊ตฌ๋Š” ๋ˆ„๊ตฌ์•ผ?\"",
imgRes = R.drawable.bomb,
backgroundColor = Purple
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package com.sixkids.designsystem.component.screen

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.sixkids.designsystem.R
import com.sixkids.designsystem.component.button.UlbanFilledButton
import com.sixkids.designsystem.theme.UlbanTypography

@Composable
fun RelayTaggingScreen(
isSender: Boolean = true,
onClick: () -> Unit = {}
) {
val title =
if (isSender) stringResource(R.string.relay_tagging_title_sender)
else stringResource(R.string.relay_tagging_title_receiver)

val subTitle =
if (isSender) stringResource(R.string.relay_tagging_sub_title_sender)
else stringResource(R.string.relay_tagging_sub_title_receiver)

val body =
if (isSender) stringResource(R.string.relay_tagging_body_sender)
else stringResource(R.string.relay_tagging_body_receiver)

Column(
modifier = Modifier.fillMaxSize()
) {
Text(
text = title,
style = UlbanTypography.titleMedium,
modifier = Modifier.padding(30.dp, 40.dp, 30.dp, 15.dp)
)

Text(
text = subTitle, style = UlbanTypography.bodyMedium,
modifier = Modifier.padding(start = 30.dp)
)

Spacer(modifier = Modifier.height(100.dp))

Image(painter = painterResource(id = R.drawable.relay_tag), contentDescription = "tagging",
modifier = Modifier
.fillMaxWidth()
.aspectRatio(1f)
)


Text(
text = body, style = UlbanTypography.bodyMedium,
modifier = Modifier.align(Alignment.CenterHorizontally)
)

Spacer(modifier = Modifier.weight(1f))
if (isSender) {
UlbanFilledButton(
text = "๋‹ค์Œ",
onClick = { onClick() },
modifier = Modifier
.padding(horizontal = 30.dp, vertical = 40.dp)
.fillMaxWidth()
)
}
}
}

@Composable
@Preview(showBackground = true)
fun RelayTaggingScreenPreview() {
RelayTaggingScreen(false)
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ val UlbanTypography = Typography(
fontFamily = npsFont,
fontWeight = FontWeight.Bold,
fontSize = 20.sp,
lineHeight = 20.sp,
lineHeight = 26.sp,
letterSpacing = 0.8.sp
),

Expand Down
Binary file modified android/core/designsystem/src/main/res/drawable/relay_tag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions android/core/designsystem/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,20 @@
<string name="relay_item_last_member">%s ํ•™์ƒ์ด ํญํƒ„์„ ํ„ฐํŠธ๋ ธ์–ด์š”</string>
<string name="relay_item_count">%d๋ฒˆ</string>
<string name="runner_question">๋ฐ›์€ ์งˆ๋ฌธ</string>
<string name="relay_pass_result_title">์ด์–ด ๋‹ฌ๋ฆฌ๊ธฐ ์ „๋‹ฌ ์„ฑ๊ณต</string>
<string name="relay_pass_result_title_bomb">์ด๋Ÿฐ ํญํƒ„์ด ํ„ฐ์กŒ์–ด์š”!</string>
<string name="relay_pass_result_subtitle_sender">๋‹ค์Œ ์นœ๊ตฌ์—๊ฒŒ ์ž˜ ์ „๋‹ฌ ๋์–ด์š”</string>
<string name="relay_pass_result_subtitle_receiver">์นœ๊ตฌ์—๊ฒŒ ์ž˜ ์ „๋‹ฌ ๋ฐ›์•˜์–ด์š”</string>
<string name="relay_pass_result_subtitle_bomb">%d exp</string>
<string name="relay_pass_result_body_bottom_sender">์งˆ๋ฌธ์— ๋‚˜๋ฅผ ์ง€๋ชฉํ–ˆ์–ด์š”!</string>
<string name="relay_pass_result_body_bottom_receiver">์–ด๋–ค ์งˆ๋ฌธ์— ๋‚˜๋ฅผ ์ง€๋ชฉํ–ˆ๋Š”์ง€\nํ™•์ธํ•  ์ˆ˜ ์žˆ์–ด์š”!</string>
<string name="relay_pass_result_body_top_receiver">๋‹ค์Œ ์นœ๊ตฌ์—๊ฒŒ ์ „๋‹ฌํ•˜๋ฉด</string>
<string name="relay_pass_result_button_done">์™„๋ฃŒ</string>
<string name="relay_tagging_title_sender">์ด์–ด ๋‹ฌ๋ฆฌ๊ธฐ ์ „๋‹ฌํ•˜๊ธฐ</string>
<string name="relay_tagging_title_receiver">์ด์–ด ๋‹ฌ๋ฆฌ๊ธฐ ์ „๋‹ฌ ๋ฐ›๊ธฐ</string>
<string name="relay_tagging_sub_title_sender">๋‚ด๊ฐ€ ๋ฐ›์€ ์งˆ๋ฌธ์— ๋งž๋Š” ์นœ๊ตฌ์—๊ฒŒ ์ „๋‹ฌ ํ•ด๋ด์š”</string>
<string name="relay_tagging_sub_title_receiver">์นœ๊ตฌ์—๊ฒŒ ์ด์–ด ๋‹ฌ๋ฆฌ๊ธฐ๋ฅผ ์ „๋‹ฌ ๋ฐ›์•„์š”</string>
<string name="relay_tagging_body_sender">์นœ๊ตฌ์™€ ํ•ธ๋“œํฐ ๋’ท๋ฉด์„ ๋งž๋Œ€์„œ ์ „๋‹ฌํ•ด์š”</string>
<string name="relay_tagging_body_receiver">์นœ๊ตฌ์™€ ํ•ธ๋“œํฐ ๋’ท๋ฉด์„ ๋งž๋Œ€์„œ ์ „๋‹ฌ ๋ฐ›์•„์š”</string>

</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.sixkids.model

data class RelayReceive(
val senderName: String = "",
val question: String = "",
val lastStatus: Boolean = false,
val demerit: Int = 0,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.sixkids.model

data class RelaySend(
val prevMemberName: String = "",
val prevQuestion: String = ""
)
24 changes: 22 additions & 2 deletions android/data/src/main/java/com/sixkids/data/api/RelayService.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package com.sixkids.data.api

import com.sixkids.data.model.request.ReceiveRelayRequest
import com.sixkids.data.model.request.RelayCreateRequest
import com.sixkids.data.model.response.ReceiveRelayResponse
import com.sixkids.data.model.response.RelayDetailResponse
import com.sixkids.data.model.response.RelayHistoryResponse
import com.sixkids.data.model.response.RunningRelayResponse
import com.sixkids.data.model.response.SendRelayResponse
import com.sixkids.data.network.ApiResponse
import com.sixkids.data.network.ApiResult
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query

interface RelayService {
Expand All @@ -26,14 +30,30 @@ interface RelayService {
@Query("organizationId") organizationId: Long
): ApiResult<ApiResponse<RunningRelayResponse>>

@GET("relays")
@GET("relays/{id}")
suspend fun getRelayDetail(
@Query("id") relayId: Long
@Path("id") relayId: Long
): ApiResult<ApiResponse<RelayDetailResponse>>

@POST("relays")
suspend fun createRelay(
@Body relayCreateRequest: RelayCreateRequest
): ApiResult<ApiResponse<Long>>

@GET("relays/{id}/question")
suspend fun getRelayQuestion(
@Path("id") relayId: Long
): ApiResult<ApiResponse<String>>

@POST("relays/{id}/receive")
suspend fun receiveRelay(
@Path("id") relayId: Int,
@Body receiveRelayRequest: ReceiveRelayRequest
): ApiResult<ApiResponse<ReceiveRelayResponse>>

@POST("relays/{id}/send")
suspend fun sendRelay(
@Path("id") relayId: Int,
): ApiResult<ApiResponse<SendRelayResponse>>

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.sixkids.data.model.request

data class ReceiveRelayRequest(
val senderId: Long,
val question: String
)
Loading

0 comments on commit b516e13

Please sign in to comment.