File tree Expand file tree Collapse file tree 4 files changed +41
-11
lines changed
DesignSystem/Sources/DesignSystem Expand file tree Collapse file tree 4 files changed +41
-11
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,7 @@ public struct SWTextEditor: View {
2525 }
2626
2727 public var body : some View {
28- TextEditor ( text: $text)
29- . accentColor ( . swAccent)
28+ textEditorView
3029 . frame ( height: height)
3130 . padding ( . horizontal, 8 )
3231 . overlay (
@@ -49,6 +48,20 @@ public struct SWTextEditor: View {
4948 }
5049}
5150
51+ private extension SWTextEditor {
52+ @ViewBuilder
53+ var textEditorView : some View {
54+ if #available( iOS 16 . 0 , * ) {
55+ TextEditor ( text: $text)
56+ . tint ( . swAccent)
57+ . scrollContentBackground ( . hidden)
58+ } else {
59+ TextEditor ( text: $text)
60+ . accentColor ( . swAccent)
61+ }
62+ }
63+ }
64+
5265#if DEBUG
5366struct SWTextEditor_Previews : PreviewProvider {
5467 static var previews : some View {
Original file line number Diff line number Diff line change @@ -97,11 +97,9 @@ private extension PickedImagesGrid {
9797 selectionLimit
9898 )
9999 if images. isEmpty {
100- return " Добавьте фото площадки , максимум \( selectionLimit) "
100+ return " Добавьте фотографии , максимум \( selectionLimit) "
101101 } else {
102- return selectionLimit > 0
103- ? " Можно добавить ещё \( selectionLimitString) "
104- : " Больше добавить фото нельзя "
102+ return selectionLimit > 0 ? " Можно добавить ещё \( selectionLimitString) " : " "
105103 }
106104 }
107105
Original file line number Diff line number Diff line change @@ -98,7 +98,10 @@ private extension EventFormView {
9898 trailingContent: . chevron
9999 )
100100 }
101- . disabled ( !viewModel. canShowGroundPicker ( with: defaults) )
101+ . disabled (
102+ !viewModel. canShowGroundPicker ( with: defaults, mode: mode)
103+ || !network. isConnected
104+ )
102105 case let . createForSelected( ground) :
103106 ListRowView (
104107 leadingContent: . text( ground. name. valueOrEmpty) ,
@@ -113,7 +116,10 @@ private extension EventFormView {
113116 trailingContent: . chevron
114117 )
115118 }
116- . disabled ( !viewModel. canShowGroundPicker ( with: defaults) )
119+ . disabled (
120+ !viewModel. canShowGroundPicker ( with: defaults, mode: mode)
121+ || !network. isConnected
122+ )
117123 }
118124 }
119125 . sheet ( isPresented: $showGroundPicker) {
Original file line number Diff line number Diff line change @@ -49,9 +49,22 @@ final class EventFormViewModel: ObservableObject {
4949 }
5050
5151 /// Не показываем пикер площадок, если `userID` отсутствует
52- func canShowGroundPicker( with defaults: DefaultsProtocol ) -> Bool {
53- guard let userInfo = defaults. mainUserInfo else { return false }
54- return userInfo. userID != nil && userInfo. usedSportsGroundsCount > 1
52+ func canShowGroundPicker(
53+ with defaults: DefaultsProtocol ,
54+ mode: EventFormView . Mode
55+ ) -> Bool {
56+ guard let userInfo = defaults. mainUserInfo, userInfo. userID != nil else {
57+ return false
58+ }
59+ switch mode {
60+ case . regularCreate:
61+ return true
62+ case . editExisting:
63+ return userInfo. usedSportsGroundsCount > 1
64+ case . createForSelected:
65+ return false
66+ }
67+
5568 }
5669
5770 func clearErrorMessage( ) { errorMessage = " " }
You can’t perform that action at this time.
0 commit comments