@@ -17,40 +17,69 @@ struct WelcomeView: View {
17
17
ZStack {
18
18
19
19
backgroundView
20
- . frame ( width: viewModel. size. width, height: viewModel. size. height)
21
- . transition ( AnyTransition . opacity)
20
+ . frame ( width: viewModel. size. width, height: viewModel. size. height)
21
+ . transition ( AnyTransition . opacity)
22
22
23
23
VStack ( alignment: . leading) {
24
24
PagerView ( pageCount: 3 , currentIndex: $currentPage) {
25
- firstView
26
- secondView
25
+ firstView
26
+ secondView
27
27
}
28
28
}
29
29
. frame ( width: viewModel. size. width / 2.5 ,
30
30
height: viewModel. size. height / 1.5 ,
31
31
alignment: . center)
32
- . background ( Color . secondary )
33
- . cornerRadius ( 4.0 )
34
- . offset ( x: 0 ,
35
- y: viewModel. isVisible ? ( ( viewModel. size. height / 2 ) - ( ( viewModel. size. height / 1.5 ) / 1.5 ) ) : 10000 )
36
- . transition ( AnyTransition . move ( edge: . bottom) )
32
+ . background ( Color . BLACK_500 )
33
+ . cornerRadius ( 4.0 )
34
+ . offset ( x: 0 ,
35
+ y: viewModel. isVisible ? ( ( viewModel. size. height / 2 ) - ( ( viewModel. size. height / 1.5 ) / 1.5 ) ) : 10000 )
36
+ . transition ( AnyTransition . move ( edge: . bottom) )
37
37
}
38
38
}
39
39
40
40
var firstView : some View {
41
41
VStack {
42
- Spacer ( )
43
- Text ( " Test 1 " )
42
+ HStack {
43
+ Spacer ( )
44
+ Text ( " Welcome! " )
45
+ . foregroundColor ( . text)
46
+ . font ( . title)
47
+ Spacer ( )
48
+ }
49
+ Text ( " Changelog Ver. 1.2 " )
50
+ . font ( . subheadline)
51
+ . foregroundColor ( . text)
52
+ . padding ( EdgeInsets ( top: 16 , leading: 0 , bottom: 16 , trailing: 0 ) )
53
+ HStack {
54
+ Text ( " - Fix 'non clickable' area \n - Add snippet from StackOverflow via a Chrome Ext. \n - A StackOverflow snippet has a special top bar button to open the dedicated StackOverflow Post " )
55
+ . font ( Font . custom ( " CourierNewPSMT " , size: 12 ) )
56
+ . foregroundColor ( . text)
57
+ Spacer ( )
58
+ }
59
+ . padding ( EdgeInsets ( top: 16 , leading: 8 , bottom: 16 , trailing: 8 ) )
60
+ . background ( Color . BLACK_200)
61
+ Text ( " We Need Your Help! " )
62
+ . font ( . subheadline)
63
+ . foregroundColor ( . text)
64
+ . padding ( EdgeInsets ( top: 16 , leading: 0 , bottom: 16 , trailing: 0 ) )
65
+ CodeView ( code: . constant( " Snip needs your help to grow! \n \n Want to translate snip into your native language? \n Want to have first-day in our next features? \n \n JOIN US now! " ) , mode: . constant( CodeMode . text. mode ( ) ) )
66
+ . frame ( maxWidth: . infinity)
44
67
Spacer ( )
45
68
HStack {
46
69
Spacer ( )
47
70
Button ( action: {
48
- self . currentPage += 1
71
+ self . viewModel . isVisible = false
49
72
} ) {
50
- Text ( " Next " )
51
- . padding ( EdgeInsets ( top: 8 , leading: 20 , bottom: 8 , trailing: 20 ) )
52
- . background ( Color . accent)
53
- . cornerRadius ( 4 )
73
+ Text ( " Close " )
74
+ . padding ( EdgeInsets ( top: 8 , leading: 20 , bottom: 8 , trailing: 20 ) )
75
+ . background ( Color . transparent)
76
+ }
77
+ . buttonStyle ( PlainButtonStyle ( ) )
78
+ Button ( action: self . viewModel. openSnipWebsite) {
79
+ Text ( " JOIN US " )
80
+ . padding ( EdgeInsets ( top: 8 , leading: 20 , bottom: 8 , trailing: 20 ) )
81
+ . background ( Color . accentDark)
82
+ . cornerRadius ( 4 )
54
83
}
55
84
. buttonStyle ( PlainButtonStyle ( ) )
56
85
}
@@ -74,18 +103,23 @@ struct WelcomeView: View {
74
103
75
104
final class WelcomeViewModel : ObservableObject {
76
105
77
- var isVisible : Bool
106
+ @ Binding var isVisible : Bool
78
107
var size : CGSize
79
108
80
- init ( isVisible: Bool , readerSize: CGSize ) {
81
- self . isVisible = isVisible
109
+ init ( isVisible: Binding < Bool > , readerSize: CGSize ) {
110
+ self . _isVisible = isVisible
82
111
self . size = readerSize
83
112
}
113
+
114
+ func openSnipWebsite( ) {
115
+ guard let url = URL ( string: " https://snip.picta-hub.io " ) else { return }
116
+ NSWorkspace . shared. open ( url)
117
+ }
84
118
}
85
119
86
120
struct WelcomeView_Previews : PreviewProvider {
87
121
static var previews : some View {
88
- WelcomeView ( viewModel: WelcomeViewModel ( isVisible: true ,
122
+ WelcomeView ( viewModel: WelcomeViewModel ( isVisible: . constant ( true ) ,
89
123
readerSize: CGSize ( width: 300 , height: 400 ) ) )
90
124
}
91
125
}
0 commit comments