[Pharo] Personal fitness tracker web app.
Slowly reintroduce very simple components.
First principles, baby!
Changed files
- src/MyFitnessTracker-Web/MFTActionsComponent.class.st
- src/MyFitnessTracker-Web/MFTHomePage.class.st
- src/MyFitnessTracker-Web/MFTLogWorkoutPage.class.st
- src/MyFitnessTracker-Web/MFTPageManager.class.st
- src/MyFitnessTracker-Web/MFTStatusComponent.class.st
- src/MyFitnessTracker-Web/MFTWorkoutComponent.class.st
- src/MyFitnessTracker-Web/MFTWorkoutPrescriptionComponent.class.st
src/MyFitnessTracker-Web/MFTActionsComponent.class.st
@@ -12,7 +12,7 @@
12
12
| nextWorkout |
13
13
nextWorkout := self session user nextWorkoutPrescription.
14
14
15
Removed:
html div: [
15
Added:
html section: [
16
16
html button
17
17
callback: [
18
18
self session pageManager setActivePage:
src/MyFitnessTracker-Web/MFTHomePage.class.st
@@ -26,7 +26,8 @@
26
26
super initialize.
27
27
statusComponent := MFTStatusComponent new.
28
28
mainActionsComponent := MFTActionsComponent new.
29
Removed:
nextWorkoutComponent := MFTWorkoutComponent new
29
Added:
nextWorkoutComponent := MFTWorkoutPrescriptionComponent new heading:
30
Added:
'Next workout'
30
31
]
31
32
32
33
{ #category : 'rendering' }
@@ -34,10 +35,9 @@
34
35
35
36
| trainee |
36
37
trainee := self session user.
38
Added:
nextWorkoutComponent workoutPrescription:
39
Added:
trainee nextWorkoutPrescription.
37
40
38
Removed:
nextWorkoutComponent workoutLog:
39
Removed:
(MFTWorkoutLog forPrescription: trainee nextWorkoutPrescription).
40
Removed:
41
41
self renderPageOn: html with: [
42
42
html heading
43
43
level: 1;
@@ -47,13 +47,10 @@
47
47
level: 2;
48
48
with: 'Plan started '
49
49
, trainee logBook workoutLogs first start asDate asString ].
50
Added:
50
51
html render: statusComponent.
51
52
html render: mainActionsComponent.
52
Removed:
html heading
53
Removed:
level: 2;
54
Removed:
with: 'Next workout'.
55
Removed:
html
56
Removed:
render: nextWorkoutComponent ]
53
Added:
html render: nextWorkoutComponent ]
57
54
]
58
55
59
56
{ #category : 'accessing' }
src/MyFitnessTracker-Web/MFTLogWorkoutPage.class.st
@@ -37,7 +37,7 @@
37
37
MFTLogWorkoutPage >> initialize [
38
38
39
39
super initialize.
40
Removed:
logWorkoutComponent := MFTWorkoutComponent new
40
Added:
logWorkoutComponent := MFTWorkoutPrescriptionComponent new
41
41
]
42
42
43
43
{ #category : 'rendering' }
src/MyFitnessTracker-Web/MFTPageManager.class.st
@@ -46,9 +46,7 @@
46
46
{ #category : 'accessing' }
47
47
MFTPageManager >> mainPages [
48
48
49
Removed:
^ {
50
Removed:
MFTHomePage new.
51
Removed:
MFTPlanPage new }
49
Added:
^ { MFTHomePage new }
52
50
]
53
51
54
52
{ #category : 'accessing' }
src/MyFitnessTracker-Web/MFTStatusComponent.class.st
@@ -12,13 +12,10 @@
12
12
| trainee |
13
13
trainee := self session user.
14
14
15
Removed:
html section
16
Removed:
class: 'mft-card mft-status';
17
Removed:
with: [
18
Removed:
html heading
19
Removed:
level: 2;
20
Removed:
with: 'Recovery status'.
21
Removed:
trainee isRecovered
22
Removed:
ifTrue: [ html paragraph: 'Ready to train again.' ]
23
Removed:
ifFalse: [ html paragraph: 'Not recovered yet. Rest more.' ] ]
15
Added:
html section: [
16
Added:
html definitionList: [
17
Added:
html definitionTerm: 'Recovery status'.
18
Added:
html definitionData: (trainee isRecovered
19
Added:
ifTrue: [ 'Ready to train again' ]
20
Added:
ifFalse: [ 'Not recovered yet, rest more' ]) ] ]
24
21
]
src/MyFitnessTracker-Web/MFTWorkoutComponent.class.st
@@ -1,31 +0,0 @@
1
Removed:
Class {
2
Removed:
#name : 'MFTWorkoutComponent',
3
Removed:
#superclass : 'WAComponent',
4
Removed:
#category : 'MyFitnessTracker-Web-Components',
5
Removed:
#package : 'MyFitnessTracker-Web',
6
Removed:
#tag : 'Components'
7
Removed:
}
8
Removed:
9
Removed:
{ #category : 'rendering' }
10
Removed:
MFTWorkoutComponent >> renderContentOn: html [
11
Removed:
12
Removed:
| workout |
13
Removed:
workout := self session user nextWorkoutPrescription.
14
Removed:
15
Removed:
html section
16
Removed:
class: 'mft-card mft-next-workout';
17
Removed:
with: [
18
Removed:
html heading
19
Removed:
level: 2;
20
Removed:
with: 'Next workout'.
21
Removed:
22
Removed:
workout
23
Removed:
ifNil: [ html paragraph: 'No workout planned.' ]
24
Removed:
ifNotNil: [
25
Removed:
html heading
26
Removed:
level: 3;
27
Removed:
with: workout canonicalName.
28
Removed:
html unorderedList: [
29
Removed:
workout sets do: [ :set |
30
Removed:
html listItem: set exercise canonicalName ] ] ] ]
31
Removed:
]
src/MyFitnessTracker-Web/MFTWorkoutPrescriptionComponent.class.st
@@ -0,0 +1,39 @@
1
Added:
Class {
2
Added:
#name : 'MFTWorkoutPrescriptionComponent',
3
Added:
#superclass : 'WAComponent',
4
Added:
#instVars : [
5
Added:
'heading',
6
Added:
'workoutPrescription'
7
Added:
],
8
Added:
#category : 'MyFitnessTracker-Web-Components',
9
Added:
#package : 'MyFitnessTracker-Web',
10
Added:
#tag : 'Components'
11
Added:
}
12
Added:
13
Added:
{ #category : 'accessing' }
14
Added:
MFTWorkoutPrescriptionComponent >> heading: aString [
15
Added:
16
Added:
heading := aString
17
Added:
]
18
Added:
19
Added:
{ #category : 'rendering' }
20
Added:
MFTWorkoutPrescriptionComponent >> renderContentOn: html [
21
Added:
22
Added:
html section: [
23
Added:
html heading
24
Added:
level: 2;
25
Added:
with: heading.
26
Added:
html heading
27
Added:
level: 3;
28
Added:
with: workoutPrescription canonicalName.
29
Added:
html orderedList: [
30
Added:
workoutPrescription setGroups do: [ :setGroup |
31
Added:
html listItem:
32
Added:
((setGroup sets collect: #exercise) joinUsing: ', ') ] ] ]
33
Added:
]
34
Added:
35
Added:
{ #category : 'accessing' }
36
Added:
MFTWorkoutPrescriptionComponent >> workoutPrescription: aMFTWorkoutPrescription [
37
Added:
38
Added:
workoutPrescription := aMFTWorkoutPrescription
39
Added:
]