[Pharo] Personal fitness tracker web app.
Consolidate navbar logic.
Parent component should basically do all the heavy lifting.
Changed files
src/MyFitnessTracker-Web/MFTNavbarComponent.class.st
@@ -9,6 +9,14 @@
9
9
#tag : 'Components'
10
10
}
11
11
12
Added:
{ #category : 'instance creation' }
13
Added:
MFTNavbarComponent class >> newFrom: anOrderedDictionary [
14
Added:
15
Added:
^ self new
16
Added:
mainNavLinks: anOrderedDictionary;
17
Added:
yourself
18
Added:
]
19
Added:
12
20
{ #category : 'initialization' }
13
21
MFTNavbarComponent >> initialize [
14
22
@@ -17,51 +25,9 @@
17
25
]
18
26
19
27
{ #category : 'initialization' }
20
Removed:
MFTNavbarComponent >> mainNavLinks [
28
Added:
MFTNavbarComponent >> mainNavLinks: anOrderedDictionary [
21
29
22
Removed:
^ mainNavLinks
23
Removed:
]
24
Removed:
25
Removed:
{ #category : 'initialization' }
26
Removed:
MFTNavbarComponent >> mainNavPages [
27
Removed:
28
Removed:
^ { #home. #plan. #profile }
29
Removed:
]
30
Removed:
31
Removed:
{ #category : 'accessing' }
32
Removed:
MFTNavbarComponent >> onHome [
33
Removed:
34
Removed:
^ mainNavLinks at: #home
35
Removed:
]
36
Removed:
37
Removed:
{ #category : 'accessing' }
38
Removed:
MFTNavbarComponent >> onHome: aBlock [
39
Removed:
40
Removed:
mainNavLinks at: #home put: aBlock
41
Removed:
]
42
Removed:
43
Removed:
{ #category : 'accessing' }
44
Removed:
MFTNavbarComponent >> onPlan [
45
Removed:
46
Removed:
^ mainNavLinks at: #plan
47
Removed:
]
48
Removed:
49
Removed:
{ #category : 'accessing' }
50
Removed:
MFTNavbarComponent >> onPlan: aBlock [
51
Removed:
52
Removed:
mainNavLinks at: #plan put: aBlock
53
Removed:
]
54
Removed:
55
Removed:
{ #category : 'accessing' }
56
Removed:
MFTNavbarComponent >> onProfile [
57
Removed:
58
Removed:
^ mainNavLinks at: #profile
59
Removed:
]
60
Removed:
61
Removed:
{ #category : 'initialization' }
62
Removed:
MFTNavbarComponent >> onProfile: aBlock [
63
Removed:
64
Removed:
mainNavLinks at: #profile put: aBlock
30
Added:
mainNavLinks := anOrderedDictionary
65
31
]
66
32
67
33
{ #category : 'rendering' }
src/MyFitnessTracker-Web/MFTScreenComponent.class.st
@@ -43,23 +43,17 @@
43
43
MFTScreenComponent >> initialize [
44
44
45
45
super initialize.
46
Removed:
self initializeMainPages.
47
Removed:
activePage := mainPages at: #home.
48
Removed:
navbar := MFTNavbarComponent new
49
Removed:
onHome: [ activePage := mainPages at: #home ];
50
Removed:
onPlan: [ activePage := mainPages at: #plan ];
51
Removed:
onProfile: [ activePage := mainPages at: #profile ];
52
Removed:
yourself.
53
Removed:
footer := MFTFooterComponent new
54
Removed:
]
55
Removed:
56
Removed:
{ #category : 'initialization' }
57
Removed:
MFTScreenComponent >> initializeMainPages [
58
Removed:
59
46
mainPages := OrderedDictionary newFrom: {
60
47
(#home -> MFTHomePage new).
61
48
(#plan -> MFTPlanPage new).
62
Removed:
(#profile -> MFTProfilePage new) }
49
Added:
(#profile -> MFTProfilePage new) }.
50
Added:
activePage := mainPages at: #home.
51
Added:
navbar := MFTNavbarComponent newFrom: {
52
Added:
(#home -> [ self setActivePage: #home ]).
53
Added:
(#plan -> [ self setActivePage: #plan ]).
54
Added:
(#profile -> [ self setActivePage: #profile ]) }
55
Added:
asOrderedDictionary.
56
Added:
footer := MFTFooterComponent new
63
57
]
64
58
65
59
{ #category : 'accessing' }
@@ -83,4 +77,10 @@
83
77
id: 'content';
84
78
with: activePage.
85
79
html render: footer
80
Added:
]
81
Added:
82
Added:
{ #category : 'initialization' }
83
Added:
MFTScreenComponent >> setActivePage: aByteSymbol [
84
Added:
85
Added:
activePage := mainPages at: aByteSymbol
86
86
]