incyclist-services 1.7.79 → 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.
@@ -76,7 +76,6 @@ let WorkoutListPageService = (() => {
76
76
  groupFilter = (__runInitializers(this, _instanceExtraInitializers), null);
77
77
  detailWorkoutId = null;
78
78
  importPhase;
79
- importGroup;
80
79
  importingFileName;
81
80
  importResult;
82
81
  importError;
@@ -175,8 +174,7 @@ let WorkoutListPageService = (() => {
175
174
  try {
176
175
  const phase = this.importPhase ?? 'landing';
177
176
  const knownGroups = this.getKnownGroups();
178
- const group = this.importGroup ?? this.getLastUsedImportGroup();
179
- const props = { phase, group, knownGroups };
177
+ const props = { phase, knownGroups };
180
178
  if (phase === 'importing')
181
179
  props.importing = { fileName: this.importingFileName };
182
180
  if (phase === 'result')
@@ -187,7 +185,7 @@ let WorkoutListPageService = (() => {
187
185
  }
188
186
  catch (err) {
189
187
  this.logError(err, 'getImportDisplayProps');
190
- return { phase: 'landing', group: DEFAULT_IMPORT_GROUP, knownGroups: [] };
188
+ return { phase: 'landing', knownGroups: [] };
191
189
  }
192
190
  }
193
191
  onSelectGroup(group) {
@@ -299,7 +297,6 @@ let WorkoutListPageService = (() => {
299
297
  onImportOpen() {
300
298
  try {
301
299
  this.importPhase = 'landing';
302
- this.importGroup = this.getLastUsedImportGroup();
303
300
  delete this.importError;
304
301
  delete this.importResult;
305
302
  this.emitImportUpdate();
@@ -308,29 +305,17 @@ let WorkoutListPageService = (() => {
308
305
  this.logError(err, 'onImportOpen');
309
306
  }
310
307
  }
311
- onImportGroupChange(name) {
312
- try {
313
- this.importGroup = name;
314
- this.emitImportUpdate();
315
- }
316
- catch (err) {
317
- this.logError(err, 'onImportGroupChange');
318
- }
319
- }
320
308
  onImportFile(file) {
321
309
  const observer = new observer_1.Observer();
322
310
  try {
323
- const group = this.importGroup;
324
311
  this.importPhase = 'importing';
325
312
  this.importingFileName = file?.name;
326
313
  this.emitImportUpdate();
327
314
  this.getWorkoutList().import(file, { showImportCards: false })
328
315
  .then(([card]) => {
329
- if (group && group !== DEFAULT_IMPORT_GROUP)
330
- card.move(group);
331
- this.persistLastUsedImportGroup(group);
316
+ const group = this.getLastUsedImportGroup();
332
317
  this.importPhase = 'result';
333
- this.importResult = { workoutName: card.getTitle(), group };
318
+ this.importResult = { id: card.getId(), workoutName: card.getTitle(), group };
334
319
  observer.emit('success');
335
320
  this.emitImportUpdate();
336
321
  })
@@ -346,6 +331,19 @@ let WorkoutListPageService = (() => {
346
331
  }
347
332
  return observer;
348
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
+ }
349
347
  onImportClose() {
350
348
  try {
351
349
  delete this.importPhase;
@@ -73,7 +73,6 @@ let WorkoutListPageService = (() => {
73
73
  groupFilter = (__runInitializers(this, _instanceExtraInitializers), null);
74
74
  detailWorkoutId = null;
75
75
  importPhase;
76
- importGroup;
77
76
  importingFileName;
78
77
  importResult;
79
78
  importError;
@@ -172,8 +171,7 @@ let WorkoutListPageService = (() => {
172
171
  try {
173
172
  const phase = this.importPhase ?? 'landing';
174
173
  const knownGroups = this.getKnownGroups();
175
- const group = this.importGroup ?? this.getLastUsedImportGroup();
176
- const props = { phase, group, knownGroups };
174
+ const props = { phase, knownGroups };
177
175
  if (phase === 'importing')
178
176
  props.importing = { fileName: this.importingFileName };
179
177
  if (phase === 'result')
@@ -184,7 +182,7 @@ let WorkoutListPageService = (() => {
184
182
  }
185
183
  catch (err) {
186
184
  this.logError(err, 'getImportDisplayProps');
187
- return { phase: 'landing', group: DEFAULT_IMPORT_GROUP, knownGroups: [] };
185
+ return { phase: 'landing', knownGroups: [] };
188
186
  }
189
187
  }
190
188
  onSelectGroup(group) {
@@ -296,7 +294,6 @@ let WorkoutListPageService = (() => {
296
294
  onImportOpen() {
297
295
  try {
298
296
  this.importPhase = 'landing';
299
- this.importGroup = this.getLastUsedImportGroup();
300
297
  delete this.importError;
301
298
  delete this.importResult;
302
299
  this.emitImportUpdate();
@@ -305,29 +302,17 @@ let WorkoutListPageService = (() => {
305
302
  this.logError(err, 'onImportOpen');
306
303
  }
307
304
  }
308
- onImportGroupChange(name) {
309
- try {
310
- this.importGroup = name;
311
- this.emitImportUpdate();
312
- }
313
- catch (err) {
314
- this.logError(err, 'onImportGroupChange');
315
- }
316
- }
317
305
  onImportFile(file) {
318
306
  const observer = new Observer();
319
307
  try {
320
- const group = this.importGroup;
321
308
  this.importPhase = 'importing';
322
309
  this.importingFileName = file?.name;
323
310
  this.emitImportUpdate();
324
311
  this.getWorkoutList().import(file, { showImportCards: false })
325
312
  .then(([card]) => {
326
- if (group && group !== DEFAULT_IMPORT_GROUP)
327
- card.move(group);
328
- this.persistLastUsedImportGroup(group);
313
+ const group = this.getLastUsedImportGroup();
329
314
  this.importPhase = 'result';
330
- this.importResult = { workoutName: card.getTitle(), group };
315
+ this.importResult = { id: card.getId(), workoutName: card.getTitle(), group };
331
316
  observer.emit('success');
332
317
  this.emitImportUpdate();
333
318
  })
@@ -343,6 +328,19 @@ let WorkoutListPageService = (() => {
343
328
  }
344
329
  return observer;
345
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
+ }
346
344
  onImportClose() {
347
345
  try {
348
346
  delete this.importPhase;
@@ -8,9 +8,9 @@ export declare class WorkoutListPageService extends IncyclistPageService impleme
8
8
  protected groupFilter: string | null;
9
9
  protected detailWorkoutId: string | null;
10
10
  protected importPhase: 'landing' | 'importing' | 'result' | 'error' | undefined;
11
- protected importGroup: string;
12
11
  protected importingFileName: string;
13
12
  protected importResult: {
13
+ id: string;
14
14
  workoutName: string;
15
15
  group: string;
16
16
  };
@@ -37,8 +37,8 @@ export declare class WorkoutListPageService extends IncyclistPageService impleme
37
37
  onMarkForRoute(id: string): void;
38
38
  onClearSelection(): void;
39
39
  onImportOpen(): void;
40
- onImportGroupChange(name: string): void;
41
40
  onImportFile(file: FileInfo): IObserver;
41
+ onImportSetGroup(id: string, group: string): void;
42
42
  onImportClose(): void;
43
43
  protected getUpcomingTrainingProps(): UpcomingTrainingProps | null;
44
44
  protected getGroupFilterProps(): GroupFilterProps;
@@ -60,12 +60,12 @@ export interface WorkoutDetailsProps {
60
60
  }
61
61
  export interface WorkoutImportDisplayProps {
62
62
  phase: 'landing' | 'importing' | 'result' | 'error';
63
- group: string;
64
63
  knownGroups: string[];
65
64
  importing?: {
66
65
  fileName: string;
67
66
  };
68
67
  result?: {
68
+ id: string;
69
69
  workoutName: string;
70
70
  group: string;
71
71
  };
@@ -85,8 +85,8 @@ export interface WorkoutListPageCallbacks {
85
85
  onMarkForRoute?: (id: string) => void;
86
86
  onClearSelection: () => void;
87
87
  onImportOpen: () => void;
88
- onImportGroupChange: (name: string) => void;
89
88
  onImportFile: (file: FileInfo) => IObserver;
89
+ onImportSetGroup: (id: string, group: string) => void;
90
90
  onImportClose: () => void;
91
91
  }
92
92
  export interface IWorkoutListPageService extends WorkoutListPageCallbacks {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incyclist-services",
3
- "version": "1.7.79",
3
+ "version": "1.7.80",
4
4
  "peerDependencies": {
5
5
  "gd-eventlog": "^0.1.27"
6
6
  },