Storing a prospect's e-mail, and renaming header component.

Commit
7c8ea56eb6d87e405d40f56156e766a8c11d5659
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
Changed files
src/MyFitnessTracker/MFTHeaderComponent.class.st
index 7fb719bf..00000000 100644..000000
@@ -1,111 +0,0 @@
1 Removed: Class {
2 Removed: #name : #MFTHeaderComponent,
3 Removed: #superclass : #SBSComponent,
4 Removed: #instVars : [
5 Removed: 'email',
6 Removed: 'localPart',
7 Removed: 'domain'
8 Removed: ],
9 Removed: #category : #'MyFitnessTracker-Components'
10 Removed: }
11 Removed:
12 Removed: { #category : #adding }
13 Removed: MFTHeaderComponent >> addUserEmail [
14 Removed:
15 Removed: | emailToCheck emailPattern |
16 Removed: emailToCheck := self call: MFTEmailSignupDialog new.
17 Removed: emailPattern := '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]{3,}\.[a-zA-Z]{2,}$'
18 Removed: asRegex.
19 Removed: (emailToCheck isNil or: [ (emailPattern matches: emailToCheck) not ])
20 Removed: ifTrue: [ ^ nil ].
21 Removed: email := emailToCheck.
22 Removed: MFTSQLite3Database storeProspectEmail: email
23 Removed: ]
24 Removed:
25 Removed: { #category : #rendering }
26 Removed: MFTHeaderComponent >> renderContentOn: html [
27 Removed:
28 Removed: self session user isLoggedIn ifTrue: [ "If a user is logged in, the CTA banner is not displayed."
29 Removed: ^ nil ].
30 Removed: email
31 Removed: ifNil: [
32 Removed: html alert
33 Removed: beWarning;
34 Removed: beDismissible;
35 Removed: marginBottom: 0;
36 Removed: with: [
37 Removed: html closeButton dataDismiss: 'alert'.
38 Removed: html alertHeading: 'This app is still in beta.'.
39 Removed: html paragraph: [
40 Removed: html
41 Removed: text:
42 Removed: 'My Fitness Tracker is still under heavy development, with improvements being made daily.';
43 Removed: space;
44 Removed: text: 'I can''t wait to share the finished product with you!' ].
45 Removed: html form with: [
46 Removed: html label
47 Removed: style: 'margin-right: 1em';
48 Removed: with: [ html strong: 'Want to know when version 1.0 is out?' ].
49 Removed: html formButton
50 Removed: beInfo;
51 Removed: callback: [ self addUserEmail ];
52 Removed: with: 'E-mail me!' ] ] ]
53 Removed: ifNotNil: [
54 Removed: html alert
55 Removed: beSuccess;
56 Removed: beDismissible;
57 Removed: marginBottom: 0;
58 Removed: with: [
59 Removed: html closeButton dataDismiss: 'alert'.
60 Removed: html text: email , ' will be notified when v1 is released!' ] ]
61 Removed: ]
62 Removed:
63 Removed: { #category : #rendering }
64 Removed: MFTHeaderComponent >> renderEmailInputModalButtonOn: html [
65 Removed:
66 Removed: ^ html formButton
67 Removed: bePrimary;
68 Removed: beSmall;
69 Removed: dataToggle: 'modal';
70 Removed: dataTarget: '#emailInputModal';
71 Removed: with: 'E-mail me!'
72 Removed: ]
73 Removed:
74 Removed: { #category : #rendering }
75 Removed: MFTHeaderComponent >> renderEmailInputModalOn: html [
76 Removed:
77 Removed: html modal
78 Removed: id: 'emailInputModal';
79 Removed: fade;
80 Removed: with: [
81 Removed: html modalDialog
82 Removed: beCentered;
83 Removed: with: [
84 Removed: html modalContent: [
85 Removed: html form: [
86 Removed: html modalHeader: [
87 Removed: html modalTitle
88 Removed: level5;
89 Removed: with:
90 Removed: 'You''ll be the first to know when My Fitness Tracker is ready to use.'.
91 Removed: html modalCloseButton ].
92 Removed:
93 Removed: html modalBody: [
94 Removed: html inputGroup: [
95 Removed: html formTextInput
96 Removed: callback: [ :value | localPart := value ];
97 Removed: placeholder: 'my-user'.
98 Removed: html inputGroupAppend: [ html inputGroupText: '@' ].
99 Removed: html formTextInput
100 Removed: callback: [ :value | domain := value ];
101 Removed: placeholder: 'example.com' ] ].
102 Removed:
103 Removed: html modalFooter: [
104 Removed: html paragraph:
105 Removed: 'You will receive a single e-mail when the app is ready to use. Your e-mail address shall not be used in any other way.'.
106 Removed: html formButton
107 Removed: bePrimary;
108 Removed: beSubmit;
109 Removed: callback: [ email := localPart , '@' , domain ];
110 Removed: with: 'Confirm' ] ] ] ] ]
111 Removed: ]
src/MyFitnessTracker/MFTHeaderProspectComponent.class.st
index 00000000..8337d2ce 000000..100644
@@ -0,0 +1,111 @@
1 Added: Class {
2 Added: #name : #MFTHeaderProspectComponent,
3 Added: #superclass : #SBSComponent,
4 Added: #instVars : [
5 Added: 'email',
6 Added: 'localPart',
7 Added: 'domain'
8 Added: ],
9 Added: #category : #'MyFitnessTracker-Components'
10 Added: }
11 Added:
12 Added: { #category : #adding }
13 Added: MFTHeaderProspectComponent >> addUserEmail [
14 Added:
15 Added: | emailToCheck emailPattern |
16 Added: emailToCheck := self call: MFTEmailSignupDialog new.
17 Added: emailPattern := '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]{3,}\.[a-zA-Z]{2,}$'
18 Added: asRegex.
19 Added: (emailToCheck isNil or: [ (emailPattern matches: emailToCheck) not ])
20 Added: ifTrue: [ ^ nil ].
21 Added: email := emailToCheck.
22 Added: MFTSQLite3Database storeProspectEmail: email
23 Added: ]
24 Added:
25 Added: { #category : #rendering }
26 Added: MFTHeaderProspectComponent >> renderContentOn: html [
27 Added:
28 Added: self session user isLoggedIn ifTrue: [ "If a user is logged in, the CTA banner is not displayed."
29 Added: ^ nil ].
30 Added: email
31 Added: ifNil: [
32 Added: html alert
33 Added: beWarning;
34 Added: beDismissible;
35 Added: marginBottom: 0;
36 Added: with: [
37 Added: html closeButton dataDismiss: 'alert'.
38 Added: html alertHeading: 'This app is still in beta.'.
39 Added: html paragraph: [
40 Added: html
41 Added: text:
42 Added: 'My Fitness Tracker is still under heavy development, with improvements being made daily.';
43 Added: space;
44 Added: text: 'I can''t wait to share the finished product with you!' ].
45 Added: html form with: [
46 Added: html label
47 Added: style: 'margin-right: 1em';
48 Added: with: [ html strong: 'Want to know when version 1.0 is out?' ].
49 Added: html formButton
50 Added: beInfo;
51 Added: callback: [ self addUserEmail ];
52 Added: with: 'E-mail me!' ] ] ]
53 Added: ifNotNil: [
54 Added: html alert
55 Added: beSuccess;
56 Added: beDismissible;
57 Added: marginBottom: 0;
58 Added: with: [
59 Added: html closeButton dataDismiss: 'alert'.
60 Added: html text: email , ' will be notified when v1 is released!' ] ]
61 Added: ]
62 Added:
63 Added: { #category : #rendering }
64 Added: MFTHeaderProspectComponent >> renderEmailInputModalButtonOn: html [
65 Added:
66 Added: ^ html formButton
67 Added: bePrimary;
68 Added: beSmall;
69 Added: dataToggle: 'modal';
70 Added: dataTarget: '#emailInputModal';
71 Added: with: 'E-mail me!'
72 Added: ]
73 Added:
74 Added: { #category : #rendering }
75 Added: MFTHeaderProspectComponent >> renderEmailInputModalOn: html [
76 Added:
77 Added: html modal
78 Added: id: 'emailInputModal';
79 Added: fade;
80 Added: with: [
81 Added: html modalDialog
82 Added: beCentered;
83 Added: with: [
84 Added: html modalContent: [
85 Added: html form: [
86 Added: html modalHeader: [
87 Added: html modalTitle
88 Added: level5;
89 Added: with:
90 Added: 'You''ll be the first to know when My Fitness Tracker is ready to use.'.
91 Added: html modalCloseButton ].
92 Added:
93 Added: html modalBody: [
94 Added: html inputGroup: [
95 Added: html formTextInput
96 Added: callback: [ :value | localPart := value ];
97 Added: placeholder: 'my-user'.
98 Added: html inputGroupAppend: [ html inputGroupText: '@' ].
99 Added: html formTextInput
100 Added: callback: [ :value | domain := value ];
101 Added: placeholder: 'example.com' ] ].
102 Added:
103 Added: html modalFooter: [
104 Added: html paragraph:
105 Added: 'You will receive a single e-mail when the app is ready to use. Your e-mail address shall not be used in any other way.'.
106 Added: html formButton
107 Added: bePrimary;
108 Added: beSubmit;
109 Added: callback: [ email := localPart , '@' , domain ];
110 Added: with: 'Confirm' ] ] ] ] ]
111 Added: ]
src/MyFitnessTracker/MFTSQLite3Database.class.st
index 2cdc1e49..b1f1eb3d 100644..100644
@@ -29,6 +29,20 @@
29 29 )'
30 30 ]
31 31
32 Added: { #category : #setting }
33 Added: MFTSQLite3Database class >> storeProspectEmail: anEmail [
34 Added:
35 Added: | connection |
36 Added: connection := (self openOn:
37 Added: (Smalltalk imageDirectory / 'mft.sqlite3') fullName)
38 Added: connection.
39 Added: connection
40 Added: execute: 'INSERT INTO prospects(email,date_time) VALUES (?, ?);'
41 Added: value: anEmail
42 Added: value: DateAndTime now asUTC rounded asString.
43 Added: connection close
44 Added: ]
45 Added:
32 46 { #category : #'as yet unclassified' }
33 47 MFTSQLite3Database >> select: attributes from: aTable [
34 48
@@ -40,13 +54,4 @@
40 54 MFTSQLite3Database >> selectAll: aTable [
41 55
42 56 ^ self select: '*' from: aTable
43 Removed: ]
44 Removed:
45 Removed: { #category : #setting }
46 Removed: MFTSQLite3Database >> storeProspectEmail: anEmail [
47 Removed:
48 Removed: connection
49 Removed: execute: 'INSERT INTO prospects(email,date_time) VALUES (?, ?);'
50 Removed: value: anEmail
51 Removed: value: DateAndTime now asUTC rounded asString
52 57 ]
src/MyFitnessTracker/MFTScreenComponent.class.st
index 66b75b2f..4fe25aca 100644..100644
@@ -23,7 +23,7 @@
23 23 MFTScreenComponent >> initialize [
24 24
25 25 super initialize.
26 Removed: header := MFTHeaderComponent new.
26 Added: header := MFTHeaderProspectComponent new.
27 27 mainTabs := MFTMainNavigationBarComponent new.
28 28 footer := MFTFooterComponent new
29 29 ]