Skip to content

Commit ef264a5

Browse files
committed
fix: 공지 상세 화면 수정
1 parent cdce932 commit ef264a5

1 file changed

Lines changed: 90 additions & 61 deletions

File tree

feature/setting/src/main/java/com/combo/runcombi/setting/screen/AnnouncementDetailScreen.kt

Lines changed: 90 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,65 @@ fun AnnouncementDetailScreen(
100100
.fillMaxSize()
101101
.background(Grey01)
102102
) {
103+
val onApplyClick: (String) -> Unit = { url -> viewModel.openEventApplyUrl(url) }
104+
103105
Column(modifier = Modifier.fillMaxSize()) {
104-
RunCombiAppTopBar(
105-
onBack = onBack,
106-
title = "",
107-
padding = PaddingValues(8.dp)
108-
)
109-
AnnouncementDetailContent(
110-
uiState = uiState,
111-
onApplyClick = { url -> viewModel.openEventApplyUrl(url) }
112-
)
106+
Box(
107+
modifier = Modifier
108+
.fillMaxWidth()
109+
.background(Grey01)
110+
) {
111+
Box(
112+
modifier = Modifier
113+
.fillMaxWidth()
114+
.height(1.dp)
115+
.background(Grey03)
116+
.align(Alignment.BottomCenter)
117+
)
118+
119+
RunCombiAppTopBar(
120+
onBack = onBack,
121+
title = "",
122+
padding = PaddingValues(8.dp)
123+
)
124+
}
125+
126+
Box(
127+
modifier = Modifier
128+
.weight(1f)
129+
.fillMaxWidth()
130+
) {
131+
AnnouncementDetailContent(
132+
uiState = uiState,
133+
)
134+
}
135+
136+
if (uiState.detail?.announcementType == "EVENT" && uiState.detail?.eventApplyUrl?.isNotEmpty() == true) {
137+
Box(
138+
modifier = Modifier
139+
.fillMaxWidth()
140+
.background(Grey01)
141+
) {
142+
Box(
143+
modifier = Modifier
144+
.fillMaxWidth()
145+
.height(1.dp)
146+
.background(Grey03)
147+
.align(Alignment.TopCenter)
148+
)
149+
150+
Column(
151+
modifier = Modifier
152+
.fillMaxWidth()
153+
.padding(horizontal = 14.dp, vertical = 16.dp)
154+
) {
155+
RunCombiButton(
156+
text = "응모하기",
157+
onClick = { onApplyClick(uiState.detail!!.eventApplyUrl) }
158+
)
159+
}
160+
}
161+
}
113162
}
114163

115164
if (uiState.isLoading) {
@@ -128,57 +177,42 @@ fun AnnouncementDetailScreen(
128177
@Composable
129178
fun AnnouncementDetailContent(
130179
uiState: AnnouncementDetailUiState,
131-
onApplyClick: (String) -> Unit,
132180
) {
133181
val detail = uiState.detail ?: return
134182

135-
Box(modifier = Modifier.fillMaxSize()) {
136-
Column(
137-
modifier = Modifier
138-
.fillMaxSize()
139-
.padding(horizontal = 20.dp)
140-
) {
141-
// 상단 고정 영역
142-
Spacer(modifier = Modifier.height(20.dp))
183+
Column(
184+
modifier = Modifier
185+
.fillMaxWidth()
186+
.padding(horizontal = 20.dp)
187+
.verticalScroll(rememberScrollState())
188+
) {
189+
Spacer(modifier = Modifier.height(20.dp))
143190

144-
TitleSection(
145-
title = detail.title,
146-
startDate = detail.startDate,
147-
endDate = detail.endDate
148-
)
191+
TitleSection(
192+
title = detail.title,
193+
startDate = detail.startDate,
194+
endDate = detail.endDate
195+
)
149196

150-
Spacer(modifier = Modifier.height(16.dp))
197+
Spacer(modifier = Modifier.height(16.dp))
151198

152-
Column(
153-
modifier = Modifier
154-
.weight(1f)
155-
.verticalScroll(rememberScrollState())
156-
) {
157-
if (detail.content.isNotEmpty()) {
158-
ContentSection(content = detail.content)
159-
Spacer(modifier = Modifier.height(16.dp))
160-
}
199+
if (detail.content.isNotEmpty()) {
200+
ContentSection(content = detail.content)
201+
Spacer(modifier = Modifier.height(16.dp))
202+
}
161203

162-
if (detail.announcementImageUrl.isNotEmpty()) {
163-
ImageSection(imageUrl = detail.announcementImageUrl)
164-
Spacer(modifier = Modifier.height(16.dp))
165-
}
166-
}
204+
if (detail.announcementImageUrl.isNotEmpty()) {
205+
ImageSection(imageUrl = detail.announcementImageUrl)
206+
Spacer(modifier = Modifier.height(16.dp))
207+
}
167208

168-
if (detail.announcementType == "EVENT") {
169-
if (detail.code.isNotEmpty()) {
170-
EventCodeSection(eventCode = detail.code)
171-
Spacer(modifier = Modifier.height(16.dp))
172-
}
209+
if (detail.announcementType == "EVENT" && detail.code.isNotEmpty()) {
210+
EventCodeSection(eventCode = detail.code)
211+
Spacer(modifier = Modifier.height(16.dp))
212+
}
173213

174-
if (detail.eventApplyUrl.isNotEmpty()) {
175-
RunCombiButton(
176-
text = "응모하기",
177-
onClick = { onApplyClick(detail.eventApplyUrl) }
178-
)
179-
Spacer(modifier = Modifier.height(24.dp))
180-
}
181-
}
214+
if (detail.announcementType == "EVENT" && detail.eventApplyUrl.isNotEmpty()) {
215+
Spacer(modifier = Modifier.height(24.dp))
182216
}
183217
}
184218
}
@@ -235,17 +269,13 @@ fun ContentSection(
235269
fun ImageSection(
236270
imageUrl: String,
237271
) {
238-
Box(
272+
NetworkImage(
273+
imageUrl = imageUrl,
239274
modifier = Modifier
240275
.fillMaxWidth()
241-
.height(240.dp)
242-
.background(Grey03.copy(alpha = 0.1f))
243-
) {
244-
NetworkImage(
245-
imageUrl = imageUrl,
246-
modifier = Modifier.fillMaxSize(),
247-
)
248-
}
276+
.height(240.dp),
277+
contentScale = androidx.compose.ui.layout.ContentScale.Crop
278+
)
249279
}
250280

251281
@Composable
@@ -342,6 +372,5 @@ fun PreviewAnnouncementDetailContent() {
342372

343373
AnnouncementDetailContent(
344374
uiState = mockUiState,
345-
onApplyClick = { url -> }
346375
)
347376
}

0 commit comments

Comments
 (0)