Skip to content

Commit 58897dd

Browse files
authored
Merge pull request #339 from Team-Capple/feat/#337-answer
[FEAT] 답변 기수 추가
2 parents 33a80d5 + a2490fb commit 58897dd

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

Qapple/Qapple/SourceCode/Data/Repository/AnswerRepository.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extension AnswerRepository: DependencyKey {
4040
id: $0.answerId,
4141
content: $0.content,
4242
authorNickname: $0.nickname,
43+
authorGeneration: $0.writerGeneration,
4344
publishedDate: $0.writeAt.ISO8601ToDate,
4445
isReported: false,
4546
isMine: true,
@@ -67,6 +68,7 @@ extension AnswerRepository: DependencyKey {
6768
id: $0.answerId,
6869
content: $0.content,
6970
authorNickname: $0.nickname,
71+
authorGeneration: $0.writerGeneration,
7072
publishedDate: $0.writeAt.ISO8601ToDate,
7173
isReported: $0.isReported,
7274
isMine: $0.isMine,
@@ -89,6 +91,7 @@ extension AnswerRepository: DependencyKey {
8991
id: $0.answerId,
9092
content: $0.content,
9193
authorNickname: $0.nickname,
94+
authorGeneration: $0.writerGeneration,
9295
publishedDate: $0.writeAt.ISO8601ToDate,
9396
isReported: $0.isReported,
9497
isMine: $0.isMine,
@@ -129,6 +132,7 @@ extension AnswerRepository: DependencyKey {
129132
id: i,
130133
content: "테스트 답변 \(i)",
131134
authorNickname: "시몬스",
135+
authorGeneration: "3기",
132136
publishedDate: .init(timeIntervalSinceNow: TimeInterval(i * -5000)),
133137
isReported: false,
134138
isMine: true,
@@ -169,6 +173,7 @@ extension AnswerRepository {
169173
id: i,
170174
content: "테스트 답변 \(i)",
171175
authorNickname: "\(i)번째 러너",
176+
authorGeneration: "3기",
172177
publishedDate: .init(timeIntervalSinceNow: TimeInterval(i*(-10000))),
173178
isReported: i == 2,
174179
isMine: i == 1,

Qapple/Qapple/SourceCode/Entity/Answer.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ struct Answer: Identifiable, Equatable {
1818
/// 작성자 닉네임
1919
let authorNickname: String
2020

21+
/// 작성자 기수
22+
let authorGeneration: String
23+
2124
/// 답변 게시 날짜
2225
let publishedDate: Date
2326

@@ -36,6 +39,7 @@ struct Answer: Identifiable, Equatable {
3639
id: 0,
3740
content: "",
3841
authorNickname: "",
42+
authorGeneration: "",
3943
publishedDate: .now,
4044
isReported: false,
4145
isMine: true,

Qapple/Qapple/SourceCode/Feature/2.QuestionTab/2-2.TodayQuestion/TodayQuestionView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ private struct SeeAllButton: View {
268268
id: 0,
269269
content: "테스트 답변 01",
270270
authorNickname: "테스트 러너 1",
271+
authorGeneration: "3기",
271272
publishedDate: .now,
272273
isReported: false,
273274
isMine: false,
@@ -277,6 +278,7 @@ private struct SeeAllButton: View {
277278
id: 1,
278279
content: "테스트 답변 02",
279280
authorNickname: "테스트 러너 2",
281+
authorGeneration: "4기",
280282
publishedDate: .now,
281283
isReported: false,
282284
isMine: false,
@@ -286,6 +288,7 @@ private struct SeeAllButton: View {
286288
id: 2,
287289
content: "테스트 답변 03",
288290
authorNickname: "테스트 러너 3",
291+
authorGeneration: "3기",
289292
publishedDate: .now,
290293
isReported: false,
291294
isMine: false,

Qapple/Qapple/SourceCode/UIComponent/QPAnswerCell.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ private struct NormalCell: View {
9191
.foregroundStyle(.icon)
9292
.padding(.leading, 8)
9393

94+
Text(answer.authorGeneration.isEmpty ? "3기" : answer.authorGeneration)
95+
.pretendard(.medium, 10)
96+
.foregroundStyle(.main)
97+
.padding(.vertical, 2)
98+
.padding(.horizontal, 8)
99+
.background(.secondaryButton)
100+
.clipShape(RoundedRectangle(cornerRadius: 20))
101+
.padding(.leading, 6)
102+
94103
Text(answer.publishedDate.timeAgo)
95104
.pretendard(.regular, 14)
96105
.foregroundStyle(.sub4)
@@ -249,6 +258,7 @@ private struct ReportedCell: View {
249258
id: 0,
250259
content: "일반 답변",
251260
authorNickname: "시몬스",
261+
authorGeneration: "3기",
252262
publishedDate: .now,
253263
isReported: false,
254264
isMine: false,
@@ -258,6 +268,7 @@ private struct ReportedCell: View {
258268
id: 1,
259269
content: "내 답변",
260270
authorNickname: "한톨",
271+
authorGeneration: "4기",
261272
publishedDate: .now,
262273
isReported: false,
263274
isMine: true,
@@ -267,6 +278,7 @@ private struct ReportedCell: View {
267278
id: 2,
268279
content: "탈퇴한 답변",
269280
authorNickname: "무니",
281+
authorGeneration: "3기",
270282
publishedDate: .now,
271283
isReported: false,
272284
isMine: false,
@@ -276,6 +288,7 @@ private struct ReportedCell: View {
276288
id: 3,
277289
content: "신고된 답변",
278290
authorNickname: "리버",
291+
authorGeneration: "4기",
279292
publishedDate: .now,
280293
isReported: true,
281294
isMine: false,

0 commit comments

Comments
 (0)