incyclist-services 1.7.78 → 1.7.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -74,8 +74,8 @@ let WorkoutListPageService = (() => {
|
|
|
74
74
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
75
75
|
}
|
|
76
76
|
groupFilter = (__runInitializers(this, _instanceExtraInitializers), null);
|
|
77
|
+
detailWorkoutId = null;
|
|
77
78
|
importPhase;
|
|
78
|
-
importGroup;
|
|
79
79
|
importingFileName;
|
|
80
80
|
importResult;
|
|
81
81
|
importError;
|
|
@@ -132,7 +132,7 @@ let WorkoutListPageService = (() => {
|
|
|
132
132
|
const workouts = groups.selected ? allWorkouts.filter(w => w.group === groups.selected) : allWorkouts;
|
|
133
133
|
const selectedId = service.getSelected()?.id ?? null;
|
|
134
134
|
const isEmpty = allWorkouts.length === 0;
|
|
135
|
-
return { pageType: 'list', loading, upcoming, groups, workouts, selectedId, isEmpty };
|
|
135
|
+
return { pageType: 'list', loading, upcoming, groups, workouts, selectedId, isEmpty, detailWorkoutId: this.detailWorkoutId };
|
|
136
136
|
}
|
|
137
137
|
catch (err) {
|
|
138
138
|
this.logError(err, 'getPageDisplayProps');
|
|
@@ -174,8 +174,7 @@ let WorkoutListPageService = (() => {
|
|
|
174
174
|
try {
|
|
175
175
|
const phase = this.importPhase ?? 'landing';
|
|
176
176
|
const knownGroups = this.getKnownGroups();
|
|
177
|
-
const
|
|
178
|
-
const props = { phase, group, knownGroups };
|
|
177
|
+
const props = { phase, knownGroups };
|
|
179
178
|
if (phase === 'importing')
|
|
180
179
|
props.importing = { fileName: this.importingFileName };
|
|
181
180
|
if (phase === 'result')
|
|
@@ -186,7 +185,7 @@ let WorkoutListPageService = (() => {
|
|
|
186
185
|
}
|
|
187
186
|
catch (err) {
|
|
188
187
|
this.logError(err, 'getImportDisplayProps');
|
|
189
|
-
return { phase: 'landing',
|
|
188
|
+
return { phase: 'landing', knownGroups: [] };
|
|
190
189
|
}
|
|
191
190
|
}
|
|
192
191
|
onSelectGroup(group) {
|
|
@@ -199,10 +198,24 @@ let WorkoutListPageService = (() => {
|
|
|
199
198
|
}
|
|
200
199
|
}
|
|
201
200
|
onOpenDetails(id) {
|
|
202
|
-
|
|
201
|
+
try {
|
|
202
|
+
this.detailWorkoutId = id;
|
|
203
|
+
this.logEvent({ message: 'details opened', id });
|
|
204
|
+
this.emitPageUpdate();
|
|
205
|
+
}
|
|
206
|
+
catch (err) {
|
|
207
|
+
this.logError(err, 'onOpenDetails');
|
|
208
|
+
}
|
|
203
209
|
}
|
|
204
210
|
onCloseDetails() {
|
|
205
|
-
|
|
211
|
+
try {
|
|
212
|
+
this.detailWorkoutId = null;
|
|
213
|
+
this.logEvent({ message: 'details closed' });
|
|
214
|
+
this.emitPageUpdate();
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
this.logError(err, 'onCloseDetails');
|
|
218
|
+
}
|
|
206
219
|
}
|
|
207
220
|
onSetFtp(ftp) {
|
|
208
221
|
try {
|
|
@@ -284,7 +297,6 @@ let WorkoutListPageService = (() => {
|
|
|
284
297
|
onImportOpen() {
|
|
285
298
|
try {
|
|
286
299
|
this.importPhase = 'landing';
|
|
287
|
-
this.importGroup = this.getLastUsedImportGroup();
|
|
288
300
|
delete this.importError;
|
|
289
301
|
delete this.importResult;
|
|
290
302
|
this.emitImportUpdate();
|
|
@@ -293,29 +305,17 @@ let WorkoutListPageService = (() => {
|
|
|
293
305
|
this.logError(err, 'onImportOpen');
|
|
294
306
|
}
|
|
295
307
|
}
|
|
296
|
-
onImportGroupChange(name) {
|
|
297
|
-
try {
|
|
298
|
-
this.importGroup = name;
|
|
299
|
-
this.emitImportUpdate();
|
|
300
|
-
}
|
|
301
|
-
catch (err) {
|
|
302
|
-
this.logError(err, 'onImportGroupChange');
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
308
|
onImportFile(file) {
|
|
306
309
|
const observer = new observer_1.Observer();
|
|
307
310
|
try {
|
|
308
|
-
const group = this.importGroup;
|
|
309
311
|
this.importPhase = 'importing';
|
|
310
312
|
this.importingFileName = file?.name;
|
|
311
313
|
this.emitImportUpdate();
|
|
312
314
|
this.getWorkoutList().import(file, { showImportCards: false })
|
|
313
315
|
.then(([card]) => {
|
|
314
|
-
|
|
315
|
-
card.move(group);
|
|
316
|
-
this.persistLastUsedImportGroup(group);
|
|
316
|
+
const group = this.getLastUsedImportGroup();
|
|
317
317
|
this.importPhase = 'result';
|
|
318
|
-
this.importResult = { workoutName: card.getTitle(), group };
|
|
318
|
+
this.importResult = { id: card.getId(), workoutName: card.getTitle(), group };
|
|
319
319
|
observer.emit('success');
|
|
320
320
|
this.emitImportUpdate();
|
|
321
321
|
})
|
|
@@ -331,6 +331,19 @@ let WorkoutListPageService = (() => {
|
|
|
331
331
|
}
|
|
332
332
|
return observer;
|
|
333
333
|
}
|
|
334
|
+
onImportSetGroup(id, group) {
|
|
335
|
+
try {
|
|
336
|
+
const card = this.findWorkoutCard(id);
|
|
337
|
+
card?.move(group);
|
|
338
|
+
this.persistLastUsedImportGroup(group);
|
|
339
|
+
if (this.importResult)
|
|
340
|
+
this.importResult = { ...this.importResult, group };
|
|
341
|
+
this.emitImportUpdate();
|
|
342
|
+
}
|
|
343
|
+
catch (err) {
|
|
344
|
+
this.logError(err, 'onImportSetGroup');
|
|
345
|
+
}
|
|
346
|
+
}
|
|
334
347
|
onImportClose() {
|
|
335
348
|
try {
|
|
336
349
|
delete this.importPhase;
|
|
@@ -71,8 +71,8 @@ let WorkoutListPageService = (() => {
|
|
|
71
71
|
__runInitializers(_classThis, _classExtraInitializers);
|
|
72
72
|
}
|
|
73
73
|
groupFilter = (__runInitializers(this, _instanceExtraInitializers), null);
|
|
74
|
+
detailWorkoutId = null;
|
|
74
75
|
importPhase;
|
|
75
|
-
importGroup;
|
|
76
76
|
importingFileName;
|
|
77
77
|
importResult;
|
|
78
78
|
importError;
|
|
@@ -129,7 +129,7 @@ let WorkoutListPageService = (() => {
|
|
|
129
129
|
const workouts = groups.selected ? allWorkouts.filter(w => w.group === groups.selected) : allWorkouts;
|
|
130
130
|
const selectedId = service.getSelected()?.id ?? null;
|
|
131
131
|
const isEmpty = allWorkouts.length === 0;
|
|
132
|
-
return { pageType: 'list', loading, upcoming, groups, workouts, selectedId, isEmpty };
|
|
132
|
+
return { pageType: 'list', loading, upcoming, groups, workouts, selectedId, isEmpty, detailWorkoutId: this.detailWorkoutId };
|
|
133
133
|
}
|
|
134
134
|
catch (err) {
|
|
135
135
|
this.logError(err, 'getPageDisplayProps');
|
|
@@ -171,8 +171,7 @@ let WorkoutListPageService = (() => {
|
|
|
171
171
|
try {
|
|
172
172
|
const phase = this.importPhase ?? 'landing';
|
|
173
173
|
const knownGroups = this.getKnownGroups();
|
|
174
|
-
const
|
|
175
|
-
const props = { phase, group, knownGroups };
|
|
174
|
+
const props = { phase, knownGroups };
|
|
176
175
|
if (phase === 'importing')
|
|
177
176
|
props.importing = { fileName: this.importingFileName };
|
|
178
177
|
if (phase === 'result')
|
|
@@ -183,7 +182,7 @@ let WorkoutListPageService = (() => {
|
|
|
183
182
|
}
|
|
184
183
|
catch (err) {
|
|
185
184
|
this.logError(err, 'getImportDisplayProps');
|
|
186
|
-
return { phase: 'landing',
|
|
185
|
+
return { phase: 'landing', knownGroups: [] };
|
|
187
186
|
}
|
|
188
187
|
}
|
|
189
188
|
onSelectGroup(group) {
|
|
@@ -196,10 +195,24 @@ let WorkoutListPageService = (() => {
|
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
197
|
onOpenDetails(id) {
|
|
199
|
-
|
|
198
|
+
try {
|
|
199
|
+
this.detailWorkoutId = id;
|
|
200
|
+
this.logEvent({ message: 'details opened', id });
|
|
201
|
+
this.emitPageUpdate();
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
this.logError(err, 'onOpenDetails');
|
|
205
|
+
}
|
|
200
206
|
}
|
|
201
207
|
onCloseDetails() {
|
|
202
|
-
|
|
208
|
+
try {
|
|
209
|
+
this.detailWorkoutId = null;
|
|
210
|
+
this.logEvent({ message: 'details closed' });
|
|
211
|
+
this.emitPageUpdate();
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
this.logError(err, 'onCloseDetails');
|
|
215
|
+
}
|
|
203
216
|
}
|
|
204
217
|
onSetFtp(ftp) {
|
|
205
218
|
try {
|
|
@@ -281,7 +294,6 @@ let WorkoutListPageService = (() => {
|
|
|
281
294
|
onImportOpen() {
|
|
282
295
|
try {
|
|
283
296
|
this.importPhase = 'landing';
|
|
284
|
-
this.importGroup = this.getLastUsedImportGroup();
|
|
285
297
|
delete this.importError;
|
|
286
298
|
delete this.importResult;
|
|
287
299
|
this.emitImportUpdate();
|
|
@@ -290,29 +302,17 @@ let WorkoutListPageService = (() => {
|
|
|
290
302
|
this.logError(err, 'onImportOpen');
|
|
291
303
|
}
|
|
292
304
|
}
|
|
293
|
-
onImportGroupChange(name) {
|
|
294
|
-
try {
|
|
295
|
-
this.importGroup = name;
|
|
296
|
-
this.emitImportUpdate();
|
|
297
|
-
}
|
|
298
|
-
catch (err) {
|
|
299
|
-
this.logError(err, 'onImportGroupChange');
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
305
|
onImportFile(file) {
|
|
303
306
|
const observer = new Observer();
|
|
304
307
|
try {
|
|
305
|
-
const group = this.importGroup;
|
|
306
308
|
this.importPhase = 'importing';
|
|
307
309
|
this.importingFileName = file?.name;
|
|
308
310
|
this.emitImportUpdate();
|
|
309
311
|
this.getWorkoutList().import(file, { showImportCards: false })
|
|
310
312
|
.then(([card]) => {
|
|
311
|
-
|
|
312
|
-
card.move(group);
|
|
313
|
-
this.persistLastUsedImportGroup(group);
|
|
313
|
+
const group = this.getLastUsedImportGroup();
|
|
314
314
|
this.importPhase = 'result';
|
|
315
|
-
this.importResult = { workoutName: card.getTitle(), group };
|
|
315
|
+
this.importResult = { id: card.getId(), workoutName: card.getTitle(), group };
|
|
316
316
|
observer.emit('success');
|
|
317
317
|
this.emitImportUpdate();
|
|
318
318
|
})
|
|
@@ -328,6 +328,19 @@ let WorkoutListPageService = (() => {
|
|
|
328
328
|
}
|
|
329
329
|
return observer;
|
|
330
330
|
}
|
|
331
|
+
onImportSetGroup(id, group) {
|
|
332
|
+
try {
|
|
333
|
+
const card = this.findWorkoutCard(id);
|
|
334
|
+
card?.move(group);
|
|
335
|
+
this.persistLastUsedImportGroup(group);
|
|
336
|
+
if (this.importResult)
|
|
337
|
+
this.importResult = { ...this.importResult, group };
|
|
338
|
+
this.emitImportUpdate();
|
|
339
|
+
}
|
|
340
|
+
catch (err) {
|
|
341
|
+
this.logError(err, 'onImportSetGroup');
|
|
342
|
+
}
|
|
343
|
+
}
|
|
331
344
|
onImportClose() {
|
|
332
345
|
try {
|
|
333
346
|
delete this.importPhase;
|
|
@@ -6,10 +6,11 @@ import { WorkoutListService } from "../list/service";
|
|
|
6
6
|
import { GroupFilterProps, IWorkoutListPageService, UpcomingTrainingProps, WorkoutDetailsProps, WorkoutImportDisplayProps, WorkoutListItemProps, WorkoutListPageDisplayProps } from "./types";
|
|
7
7
|
export declare class WorkoutListPageService extends IncyclistPageService implements IWorkoutListPageService {
|
|
8
8
|
protected groupFilter: string | null;
|
|
9
|
+
protected detailWorkoutId: string | null;
|
|
9
10
|
protected importPhase: 'landing' | 'importing' | 'result' | 'error' | undefined;
|
|
10
|
-
protected importGroup: string;
|
|
11
11
|
protected importingFileName: string;
|
|
12
12
|
protected importResult: {
|
|
13
|
+
id: string;
|
|
13
14
|
workoutName: string;
|
|
14
15
|
group: string;
|
|
15
16
|
};
|
|
@@ -36,8 +37,8 @@ export declare class WorkoutListPageService extends IncyclistPageService impleme
|
|
|
36
37
|
onMarkForRoute(id: string): void;
|
|
37
38
|
onClearSelection(): void;
|
|
38
39
|
onImportOpen(): void;
|
|
39
|
-
onImportGroupChange(name: string): void;
|
|
40
40
|
onImportFile(file: FileInfo): IObserver;
|
|
41
|
+
onImportSetGroup(id: string, group: string): void;
|
|
41
42
|
onImportClose(): void;
|
|
42
43
|
protected getUpcomingTrainingProps(): UpcomingTrainingProps | null;
|
|
43
44
|
protected getGroupFilterProps(): GroupFilterProps;
|
|
@@ -12,6 +12,7 @@ export interface WorkoutListContentProps {
|
|
|
12
12
|
workouts: WorkoutListItemProps[];
|
|
13
13
|
selectedId: string | null;
|
|
14
14
|
isEmpty: boolean;
|
|
15
|
+
detailWorkoutId: string | null;
|
|
15
16
|
}
|
|
16
17
|
export interface UpcomingTrainingProps {
|
|
17
18
|
items: ScheduledWorkoutItemProps[];
|
|
@@ -59,12 +60,12 @@ export interface WorkoutDetailsProps {
|
|
|
59
60
|
}
|
|
60
61
|
export interface WorkoutImportDisplayProps {
|
|
61
62
|
phase: 'landing' | 'importing' | 'result' | 'error';
|
|
62
|
-
group: string;
|
|
63
63
|
knownGroups: string[];
|
|
64
64
|
importing?: {
|
|
65
65
|
fileName: string;
|
|
66
66
|
};
|
|
67
67
|
result?: {
|
|
68
|
+
id: string;
|
|
68
69
|
workoutName: string;
|
|
69
70
|
group: string;
|
|
70
71
|
};
|
|
@@ -84,8 +85,8 @@ export interface WorkoutListPageCallbacks {
|
|
|
84
85
|
onMarkForRoute?: (id: string) => void;
|
|
85
86
|
onClearSelection: () => void;
|
|
86
87
|
onImportOpen: () => void;
|
|
87
|
-
onImportGroupChange: (name: string) => void;
|
|
88
88
|
onImportFile: (file: FileInfo) => IObserver;
|
|
89
|
+
onImportSetGroup: (id: string, group: string) => void;
|
|
89
90
|
onImportClose: () => void;
|
|
90
91
|
}
|
|
91
92
|
export interface IWorkoutListPageService extends WorkoutListPageCallbacks {
|