| 1 |
efrain |
1 |
//
|
|
|
2 |
// CommentAndRatingPickerView.swift
|
|
|
3 |
// twogetskills
|
|
|
4 |
//
|
|
|
5 |
// Created by Efrain Yanez Recanatini on 7/28/22.
|
|
|
6 |
//
|
|
|
7 |
|
|
|
8 |
import SwiftUI
|
|
|
9 |
|
|
|
10 |
enum CommentAndRatingPickerType : String
|
|
|
11 |
{
|
|
|
12 |
case introduction
|
|
|
13 |
case comments
|
|
|
14 |
case postcomment
|
|
|
15 |
}
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
struct CommentAndRatingPickerView : View {
|
|
|
19 |
var capsuleModel : CapsuleModel
|
|
|
20 |
@Binding var selectedType: CommentAndRatingPickerType
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
var body : some View {
|
|
|
24 |
|
|
|
25 |
GeometryReader { geometry in
|
|
|
26 |
VStack {
|
|
|
27 |
|
|
|
28 |
HStack {
|
|
|
29 |
Spacer()
|
|
|
30 |
Button(action: {
|
|
|
31 |
self.selectedType = .introduction
|
|
|
32 |
}, label: {
|
|
|
33 |
//VStack(spacing: 0) {
|
|
|
34 |
if self.selectedType == .introduction {
|
|
|
35 |
|
|
|
36 |
Text(Config.LANG_PICKER_INTRODUCTION)
|
|
|
37 |
.font(Font.custom(Config.FONT_NAME_BOLD, size: Config.FONT_SIZE_PICKER_BUTTONS))
|
|
|
38 |
.foregroundColor(Color("color_picker_foreground_highlight"))
|
|
|
39 |
.tag(0)
|
|
|
40 |
.padding(.top, 8)
|
|
|
41 |
.padding(.leading, 5)
|
|
|
42 |
.padding(.trailing, 5)
|
|
|
43 |
.padding(.bottom, 8)
|
|
|
44 |
.overlay(
|
|
|
45 |
Rectangle()
|
|
|
46 |
.frame(height: 2)
|
|
|
47 |
.foregroundColor(Color("color_picker_overlay_highlight"))
|
|
|
48 |
, alignment: .bottom)
|
|
|
49 |
} else {
|
|
|
50 |
Text(Config.LANG_PICKER_INTRODUCTION)
|
|
|
51 |
.font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_PICKER_BUTTONS))
|
|
|
52 |
.foregroundColor(Color("color_picker_foreground"))
|
|
|
53 |
.tag(0)
|
|
|
54 |
.padding(.top, 8)
|
|
|
55 |
.padding(.leading, 5)
|
|
|
56 |
.padding(.trailing, 5)
|
|
|
57 |
.padding(.bottom, 8)
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
// Spacer()
|
|
|
61 |
//}
|
|
|
62 |
})
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
Spacer()
|
|
|
66 |
Button(action: {
|
|
|
67 |
self.selectedType = .comments
|
|
|
68 |
}, label: {
|
|
|
69 |
// VStack(spacing: 0) {
|
|
|
70 |
if self.selectedType == .comments {
|
|
|
71 |
|
|
|
72 |
Text(Config.LANG_PICKER_COMMENTS)
|
|
|
73 |
.font(Font.custom(Config.FONT_NAME_BOLD, size: Config.FONT_SIZE_PICKER_BUTTONS))
|
|
|
74 |
.foregroundColor(Color("color_picker_foreground_highlight"))
|
|
|
75 |
.tag(1)
|
|
|
76 |
.padding(.top, 8)
|
|
|
77 |
.padding(.leading, 5)
|
|
|
78 |
.padding(.trailing, 5)
|
|
|
79 |
.padding(.bottom, 8)
|
|
|
80 |
.overlay(
|
|
|
81 |
Rectangle()
|
|
|
82 |
.frame(height: 2)
|
|
|
83 |
.foregroundColor(Color("color_picker_overlay_highlight"))
|
|
|
84 |
, alignment: .bottom)
|
|
|
85 |
} else {
|
|
|
86 |
Text(Config.LANG_PICKER_COMMENTS)
|
|
|
87 |
.font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_PICKER_BUTTONS))
|
|
|
88 |
.foregroundColor(Color("color_picker_foreground"))
|
|
|
89 |
.tag(1)
|
|
|
90 |
.padding(.top, 8)
|
|
|
91 |
.padding(.leading, 5)
|
|
|
92 |
.padding(.trailing, 5)
|
|
|
93 |
.padding(.bottom, 8)
|
|
|
94 |
|
|
|
95 |
}
|
|
|
96 |
//Spacer()
|
|
|
97 |
//}
|
|
|
98 |
})
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
Spacer()
|
|
|
103 |
|
|
|
104 |
if self.capsuleModel.completed == 1 {
|
|
|
105 |
Button(action: {
|
|
|
106 |
self.selectedType = .postcomment
|
|
|
107 |
}, label: {
|
|
|
108 |
//VStack(spacing: 0) {
|
|
|
109 |
if( self.selectedType == .postcomment) {
|
|
|
110 |
|
|
|
111 |
Text(Config.LANG_PICKER_POST_COMMENT).tag(2)
|
|
|
112 |
.font(Font.custom(Config.FONT_NAME_BOLD, size: Config.FONT_SIZE_PICKER_BUTTONS))
|
|
|
113 |
.foregroundColor(Color("color_picker_foreground_highlight"))
|
|
|
114 |
.padding(.top, 8)
|
|
|
115 |
.padding(.leading, 5)
|
|
|
116 |
.padding(.trailing, 5)
|
|
|
117 |
.padding(.bottom, 8)
|
|
|
118 |
.overlay(
|
|
|
119 |
Rectangle()
|
|
|
120 |
.frame(height: 2)
|
|
|
121 |
.foregroundColor(Color("color_picker_overlay_highlight"))
|
|
|
122 |
, alignment: .bottom)
|
|
|
123 |
} else {
|
|
|
124 |
Text(Config.LANG_PICKER_POST_COMMENT).tag(2)
|
|
|
125 |
.font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_PICKER_BUTTONS))
|
|
|
126 |
.foregroundColor(Color("color_picker_foreground"))
|
|
|
127 |
.padding(.top, 8)
|
|
|
128 |
.padding(.leading, 5)
|
|
|
129 |
.padding(.trailing, 5)
|
|
|
130 |
.padding(.bottom, 8)
|
|
|
131 |
|
|
|
132 |
}
|
|
|
133 |
//Spacer()
|
|
|
134 |
//}
|
|
|
135 |
})
|
|
|
136 |
Spacer()
|
|
|
137 |
}
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
}
|
|
|
144 |
.frame(height: 48)
|
|
|
145 |
.background(Color("color_picker_background"))
|
|
|
146 |
|
|
|
147 |
}
|
|
|
148 |
|
|
|
149 |
}
|
|
|
150 |
}
|
|
|
151 |
struct CommentAndRatingPickerView_Previews: PreviewProvider {
|
|
|
152 |
|
|
|
153 |
static var capsuleModel : CapsuleModel = CapsuleModel()
|
|
|
154 |
@State static var selectedType : CommentAndRatingPickerType = .introduction
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
static var previews: some View {
|
|
|
158 |
CommentAndRatingPickerView(capsuleModel: capsuleModel, selectedType: self.$selectedType)
|
|
|
159 |
}
|
|
|
160 |
}
|