-
Notifications
You must be signed in to change notification settings - Fork 1
Style/#359 ai 답장 UI #369
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
Merged
The head ref may contain hidden characters: "style/#359-ai-\uB2F5\uC7A5-ui"
Merged
Style/#359 ai 답장 UI #369
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
402ee79
style: #359 로딩/실패 UI 구현
juri123123 b5dc98e
style: #359 보리 답장 UI 구현
juri123123 b0d1557
Merge branch 'develop' into style/#359-ai-답장-ui
juri123123 7a007b9
feat: #359 답장 버튼 추가
juri123123 0c82fc1
feat: #359 보리 답장 스크롤 추가
juri123123 2da130e
fix: #359 코드리뷰 반영
juri123123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
ByeBoo-iOS/ByeBoo-iOS/Presentation/Enum/AIAnswerState.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // | ||
| // AIAnswerState.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 최주리 on 2/18/26. | ||
| // | ||
|
|
||
| import UIKit | ||
|
|
||
| enum AIAnswerState { | ||
| case loading | ||
| case fail | ||
| case success | ||
| } | ||
|
|
||
| extension AIAnswerState { | ||
| var text: String { | ||
| switch self { | ||
| case .loading: | ||
| "보리가 열심히 답변을 작성하고 있어요!" | ||
| case .fail: | ||
| "답변 생성을 실패했어요.\n잠시 뒤에 다시 시도해 주세요." | ||
| case .success: | ||
| "" | ||
| } | ||
| } | ||
|
|
||
| var image: UIImage { | ||
| switch self { | ||
| case .loading: | ||
| .boriWriting | ||
| case .fail: | ||
| .boriRetry | ||
| case .success: | ||
| .boriLetter | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
ByeBoo-iOS/ByeBoo-iOS/Presentation/Feature/WriteQuest/View/AIAnswer/AIAnswerCardView.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // | ||
| // AIAnswerCardView.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 최주리 on 2/18/26. | ||
| // | ||
|
|
||
| import UIKit | ||
|
|
||
| final class AIAnswerCardView: BaseView { | ||
|
|
||
| private let cardImageView = UIImageView() | ||
| private let scrollView = UIScrollView() | ||
| private let contentView = UIView() | ||
| private let contentLabel = UILabel() | ||
| private let boriLabel = UILabel() | ||
|
|
||
| override func setStyle() { | ||
| backgroundColor = .grayscale900 | ||
|
|
||
| cardImageView.do { | ||
| $0.image = .boriLetter | ||
| $0.isUserInteractionEnabled = true | ||
| } | ||
| scrollView.do { | ||
| $0.showsVerticalScrollIndicator = false | ||
| } | ||
| contentLabel.do { | ||
| $0.applyByeBooFont( | ||
| style: .body3R16, | ||
| text: "", | ||
| color: .primary50 | ||
| ) | ||
| $0.numberOfLines = 0 | ||
| } | ||
| boriLabel.do { | ||
| $0.applyByeBooFont( | ||
| style: .boriVoiceR18, | ||
| text: "보리의 답장", | ||
| color: .primary50 | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| override func setUI() { | ||
| addSubviews(cardImageView) | ||
| cardImageView.addSubviews(scrollView, boriLabel) | ||
| scrollView.addSubview(contentView) | ||
| contentView.addSubview(contentLabel) | ||
| } | ||
|
|
||
| override func setLayout() { | ||
| cardImageView.snp.makeConstraints { | ||
| $0.edges.equalToSuperview() | ||
| } | ||
| scrollView.snp.makeConstraints { | ||
| $0.top.equalToSuperview().inset(217.adjustedH) | ||
| $0.horizontalEdges.equalToSuperview().inset(24.adjustedW) | ||
| $0.bottom.equalToSuperview().inset(98.adjustedH) | ||
| } | ||
| contentView.snp.makeConstraints { | ||
| $0.edges.equalToSuperview() | ||
| $0.width.equalToSuperview() | ||
| $0.height.greaterThanOrEqualTo(scrollView.frameLayoutGuide) | ||
| } | ||
| contentLabel.snp.makeConstraints { | ||
| $0.horizontalEdges.equalToSuperview() | ||
| $0.verticalEdges.equalToSuperview() | ||
| } | ||
| boriLabel.snp.makeConstraints { | ||
| $0.top.equalTo(scrollView.snp.bottom).offset(44.adjustedH) | ||
| $0.trailing.equalToSuperview().inset(24.adjustedW) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| extension AIAnswerCardView { | ||
| func updateText(answer: String) { | ||
| contentLabel.text = answer | ||
| } | ||
| } | ||
92 changes: 92 additions & 0 deletions
92
ByeBoo-iOS/ByeBoo-iOS/Presentation/Feature/WriteQuest/View/AIAnswer/AIAnswerView.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| // | ||
| // AIAnswerView.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 최주리 on 2/18/26. | ||
| // | ||
|
|
||
| import UIKit | ||
|
|
||
| final class AIAnswerView: BaseView { | ||
|
|
||
| private let answerState: AIAnswerState | ||
|
|
||
| private let stackView = UIStackView() | ||
| private let imageView = UIImageView() | ||
| private let textLabel = UILabel() | ||
| private let cardView = AIAnswerCardView() | ||
|
|
||
| init(answerState: AIAnswerState) { | ||
| self.answerState = answerState | ||
|
|
||
| super.init(frame: .zero) | ||
| updateState(state: answerState) | ||
| } | ||
|
|
||
| required init?(coder: NSCoder) { | ||
| fatalError("init(coder:) has not been implemented") | ||
| } | ||
|
|
||
| override func setStyle() { | ||
| backgroundColor = .grayscale900 | ||
|
|
||
| stackView.do { | ||
| $0.axis = .vertical | ||
| $0.spacing = 8.adjustedH | ||
| $0.alignment = .center | ||
| } | ||
| textLabel.do { | ||
| $0.applyByeBooFont( | ||
| style: .body3R16, | ||
| text: answerState.text, | ||
| color: .grayscale100, | ||
| textAlignment: .center | ||
| ) | ||
| $0.numberOfLines = 0 | ||
| } | ||
| imageView.do { | ||
| $0.image = .boriWriting | ||
| } | ||
| cardView.do { | ||
| $0.isHidden = true | ||
| } | ||
| } | ||
|
|
||
| override func setUI() { | ||
| addSubviews(stackView, cardView) | ||
| stackView.addArrangedSubviews(imageView, textLabel) | ||
| } | ||
|
|
||
| override func setLayout() { | ||
| stackView.snp.makeConstraints { | ||
| $0.horizontalEdges.equalToSuperview().inset(48.adjustedW) | ||
| $0.centerY.equalToSuperview() | ||
| } | ||
| imageView.snp.makeConstraints { | ||
| $0.size.equalTo(100) | ||
| } | ||
| cardView.snp.makeConstraints { | ||
| $0.horizontalEdges.equalToSuperview().inset(24.adjustedW) | ||
| $0.centerY.equalToSuperview() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| extension AIAnswerView { | ||
| func updateState(state: AIAnswerState) { | ||
| textLabel.text = state.text | ||
| imageView.image = state.image | ||
|
|
||
| switch state { | ||
| case .loading: | ||
| stackView.isHidden = false | ||
| cardView.isHidden = true | ||
| case .fail: | ||
| stackView.isHidden = false | ||
| cardView.isHidden = true | ||
| case .success: | ||
| stackView.isHidden = true | ||
| cardView.isHidden = false | ||
| } | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
...OS/ByeBoo-iOS/Presentation/Feature/WriteQuest/ViewController/AIAnswerViewController.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // | ||
| // AIAnswerViewController.swift | ||
| // ByeBoo-iOS | ||
| // | ||
| // Created by 최주리 on 2/18/26. | ||
| // | ||
|
|
||
| import Combine | ||
| import UIKit | ||
|
|
||
| final class AIAnswerViewController: BaseViewController { | ||
|
|
||
| private let rootView = AIAnswerView(answerState: .success) | ||
|
|
||
| override func loadView() { | ||
| view = rootView | ||
| } | ||
|
|
||
| override func viewDidLoad() { | ||
| super.viewDidLoad() | ||
|
|
||
| self.navigationItem.hidesBackButton = true | ||
|
|
||
| ByeBooNavigationBar.makeNavigationBar( | ||
| navigationItem: self.navigationItem, | ||
| navigationController: self.navigationController, | ||
| type: .close(header: .black), | ||
| action: #selector(close) | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| extension AIAnswerViewController: Dismissible { | ||
| func close() { | ||
| tabBarController?.tabBar.isHidden = false | ||
| self.navigationController?.popToRootViewController(animated: false) | ||
| } | ||
| } | ||
|
|
||
| extension AIAnswerViewController { | ||
| func configure( ) { } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
멀티라인 라벨일 때는 text만 교체해주면 lineheight 들어간게 풀리는 것 같아서 혹시 apply함수로 바꿀 수 있을까요?!