Skip to content

Commit 3ea855f

Browse files
authored
Merge pull request #81 from YAPP-Github/TNT-233-trainerAddPTSessionAPI
[TNT-233] ํŠธ๋ ˆ์ด๋„ˆ ์ˆ˜์—… ์ถ”๊ฐ€ ํ™”๋ฉด API, ํ™”๋ฉด ํ๋ฆ„ ์—ฐ๊ฒฐ ์™„๋ฃŒ
2 parents 6765a1f + c0fbeff commit 3ea855f

File tree

13 files changed

+401
-177
lines changed

13 files changed

+401
-177
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "icn_clock_red.svg",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Lines changed: 11 additions & 0 deletions
Loading

โ€ŽTnT/Projects/DesignSystem/Sources/Components/TextField/TTextEditor.swiftโ€Ž

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public struct TTextEditor: View {
2222
private let footer: Footer?
2323
/// Placeholder ํ…์ŠคํŠธ
2424
private let placeholder: String
25+
/// ํ…์ŠคํŠธ ์—๋””ํ„ฐ ์‚ฌ์ด์ฆˆ
26+
private let size: Size
2527
/// ํ…์ŠคํŠธ ํ•„๋“œ ์ƒํƒœ
2628
@Binding private var status: Status
2729
/// ์ž…๋ ฅ๋œ ํ…์ŠคํŠธ
@@ -35,74 +37,58 @@ public struct TTextEditor: View {
3537
/// TTextEditor ์ƒ์„ฑ์ž
3638
/// - Parameters:
3739
/// - placeholder: Placeholder ํ…์ŠคํŠธ (๊ธฐ๋ณธ๊ฐ’: "๋‚ด์šฉ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”").
40+
/// - size: ํ…์ŠคํŠธ ์—๋””ํ„ฐ ์‚ฌ์ด์ฆˆ.
3841
/// - text: ์ž…๋ ฅ๋œ ํ…์ŠคํŠธ๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ๋ฐ”์ธ๋”ฉ.
3942
/// - textEditorStatus: ํ…์ŠคํŠธ ์—๋””ํ„ฐ ์ƒํƒœ๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ๋ฐ”์ธ๋”ฉ.
4043
/// - footer: Textfield ํ•˜๋‹จ์— ํ‘œ์‹œ๋  `TTextEditor.FooterView`๋ฅผ ์ •์˜ํ•˜๋Š” ํด๋กœ์ €.
4144
public init(
4245
placeholder: String = "๋‚ด์šฉ์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”",
46+
size: Size = .large,
4347
text: Binding<String>,
4448
textEditorStatus: Binding<Status>,
4549
footer: () -> Footer? = { nil }
4650
) {
4751
self.placeholder = placeholder
52+
self.size = size
4853
self._text = text
4954
self._status = textEditorStatus
5055
self.footer = footer()
5156
}
5257

5358
public var body: some View {
54-
GeometryReader { geometry in
55-
VStack(alignment: .leading, spacing: 8) {
56-
ZStack(alignment: .topLeading) {
57-
TextEditor(text: $text)
58-
.autocorrectionDisabled()
59-
.scrollDisabled(true)
60-
.focused($isFocused)
61-
.font(Typography.FontStyle.body1Medium.font)
62-
.lineSpacing(Typography.FontStyle.body1Medium.lineSpacing)
63-
.kerning(Typography.FontStyle.body1Medium.letterSpacing)
64-
.tint(Color.neutral800)
65-
.frame(minHeight: textHeight, maxHeight: .infinity)
66-
.padding(.vertical, TTextEditor.verticalPadding)
67-
.padding(.horizontal, TTextEditor.horizontalPadding)
68-
.background(Color.common0)
69-
.scrollContentBackground(.hidden)
70-
.cornerRadius(8)
71-
.overlay(
72-
RoundedRectangle(cornerRadius: 8)
73-
.stroke(status.borderColor(isFocused: isFocused), lineWidth: status.borderWidth(isFocused: isFocused))
74-
)
75-
.onChange(of: text) {
76-
withAnimation {
77-
textHeight = getNewHeight(geometry: geometry)
78-
}
79-
}
80-
.onAppear {
81-
textHeight = getNewHeight(geometry: geometry)
82-
}
83-
84-
if text.isEmpty {
85-
Text(placeholder)
86-
.typographyStyle(.body1Medium, with: .neutral400)
87-
.padding(.vertical, TTextEditor.verticalPadding + 8)
88-
.padding(.horizontal, TTextEditor.horizontalPadding + 4)
89-
}
90-
}
91-
if let footer {
92-
footer
59+
VStack(alignment: .leading, spacing: 8) {
60+
ZStack(alignment: .topLeading) {
61+
TextEditor(text: $text)
62+
.autocorrectionDisabled()
63+
.scrollDisabled(true)
64+
.focused($isFocused)
65+
.font(Typography.FontStyle.body1Medium.font)
66+
.lineSpacing(Typography.FontStyle.body1Medium.lineSpacing)
67+
.kerning(Typography.FontStyle.body1Medium.letterSpacing)
68+
.tint(Color.neutral800)
69+
.frame(minHeight: textHeight, maxHeight: .infinity)
70+
.padding(.vertical, TTextEditor.verticalPadding)
71+
.padding(.horizontal, TTextEditor.horizontalPadding)
72+
.background(Color.common0)
73+
.scrollContentBackground(.hidden)
74+
.cornerRadius(8)
75+
.overlay(
76+
RoundedRectangle(cornerRadius: 8)
77+
.stroke(status.borderColor(isFocused: isFocused), lineWidth: status.borderWidth(isFocused: isFocused))
78+
)
79+
.frame(height: size.height)
80+
81+
if text.isEmpty {
82+
Text(placeholder)
83+
.typographyStyle(.body1Medium, with: .neutral400)
84+
.padding(.vertical, TTextEditor.verticalPadding + 8)
85+
.padding(.horizontal, TTextEditor.horizontalPadding + 4)
9386
}
9487
}
88+
if let footer {
89+
footer
90+
}
9591
}
96-
.frame(height: TTextEditor.defaultHeight)
97-
}
98-
99-
private func getNewHeight(geometry: GeometryProxy) -> CGFloat {
100-
let newHeight: CGFloat = TextUtility.calculateTextHeight(
101-
boxWidth: geometry.size.width - TTextEditor.horizontalPadding * 2,
102-
text: text,
103-
style: .body1Medium
104-
) + TTextEditor.verticalPadding * 2
105-
return max(newHeight, TTextEditor.defaultHeight)
10692
}
10793
}
10894

@@ -198,4 +184,20 @@ public extension TTextEditor {
198184
}
199185
}
200186
}
187+
188+
/// TextEditor์˜ ํฌ๊ธฐ
189+
enum Size {
190+
case small
191+
case large
192+
193+
/// ๋†’์ด
194+
var height: CGFloat {
195+
switch self {
196+
case .small:
197+
return 52
198+
case .large:
199+
return 130
200+
}
201+
}
202+
}
201203
}

โ€ŽTnT/Projects/DesignSystem/Sources/DesignSystem/Image+DesignSystem.swiftโ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public extension ImageResource {
4444
static let icnTriangleDown: ImageResource = DesignSystemAsset.icnTriangleDown.imageResource
4545
static let icnTriangleRight: ImageResource = DesignSystemAsset.icnTriangleRight.imageResource
4646
static let icnClock: ImageResource = DesignSystemAsset.icnClock.imageResource
47+
static let icnClockRed: ImageResource = DesignSystemAsset.icnClockRed.imageResource
4748
static let icnStar: ImageResource = DesignSystemAsset.icnStar.imageResource
4849
static let icnStarSmile: ImageResource = DesignSystemAsset.icnStarSmile.imageResource
4950
static let icnWriteBlackFilled: ImageResource = DesignSystemAsset.icnWriteBlackFilled.imageResource

โ€ŽTnT/Projects/Domain/Sources/DTO/Trainer/TrainerRequestDTO.swiftโ€Ž

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,14 @@ public struct PostLessonReqDTO: Encodable {
1616
let end: String
1717
/// ํŠธ๋ ˆ์ด๋‹ˆ id
1818
let traineeId: Int
19+
20+
public init(
21+
start: String,
22+
end: String,
23+
traineeId: Int
24+
) {
25+
self.start = start
26+
self.end = end
27+
self.traineeId = traineeId
28+
}
1929
}
File renamed without changes.
File renamed without changes.

โ€ŽTnT/Projects/Domain/Sources/Mapper/TrainerMapper.swiftโ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,12 @@ public extension GetConnectedTraineeInfoResponseDTO {
3232
)
3333
}
3434
}
35+
36+
public extension ActiveTraineeInfoResDTO {
37+
func toEntity() -> TraineeListItemEntity {
38+
return .init(
39+
id: self.id,
40+
name: self.name
41+
)
42+
}
43+
}

โ€ŽTnT/Projects/Domain/Sources/UseCase/TrainerUseCase.swiftโ€Ž

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,20 @@ public struct DefaultTrainerUseCase: TrainerRepository {
4040
public func getConnectedTraineeInfo(trainerId: Int, traineeId: Int) async throws -> GetConnectedTraineeInfoResponseDTO {
4141
return try await trainerRepository.getConnectedTraineeInfo(trainerId: trainerId, traineeId: traineeId)
4242
}
43+
44+
public func getMonthlyLessonList(year: Int, month: Int) async throws -> GetMonthlyLessonListResDTO {
45+
return try await trainerRepository.getMonthlyLessonList(year: year, month: month)
46+
}
47+
48+
public func getActiveTraineesList() async throws -> GetActiveTraineesListResDTO {
49+
return try await trainerRepository.getActiveTraineesList()
50+
}
51+
52+
public func postLesson(reqDTO: PostLessonReqDTO) async throws -> PostLessonResDTO {
53+
return try await trainerRepository.postLesson(reqDTO: reqDTO)
54+
}
55+
56+
public func putCompleteLesson(lessonId: Int) async throws -> PutCompleteLessonResDTO {
57+
return try await trainerRepository.putCompleteLesson(lessonId: lessonId)
58+
}
4359
}

0 commit comments

Comments
ย (0)