Skip to content

Commit

Permalink
Merge pull request #1 from gotjoshua/master
Browse files Browse the repository at this point in the history
gitpod and upstream
  • Loading branch information
gotjoshua authored Jul 11, 2021
2 parents 5e28833 + ce9b404 commit ecbc81a
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 19 deletions.
20 changes: 20 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
vscode:
extensions:
- coenraads.bracket-pair-colorizer-2
- pustelto.bracketeer
- formulahendry.auto-close-tag
- dbaeumer.vscode-eslint
- mhutchie.git-graph

tasks:
- name: config, build, dev
before: |
export ANY_CONST_ENVS="can be defined here" &&
export LIKE_THIS=*
init: yarn
command: yarn ng serve

# Ports to expose on workspace startup
ports:
- port: 4200
onOpen: open-preview
1 change: 1 addition & 0 deletions src/app/features/reminder/reminder.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export class ReminderService {
}

private async _saveModel(reminders: Reminder[]) {
console.log('saveReminders', reminders);
await this._persistenceService.reminders.saveState(reminders, {
isSyncModelChange: true,
});
Expand Down
12 changes: 7 additions & 5 deletions src/app/features/work-view/work-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,24 @@ export class WorkViewComponent implements OnInit, OnDestroy, AfterContentInit {
this.planningModeService.leavePlanningMode();
}

// NOTE: there is a duplicate of this in plan-tasks-tomorrow.component
addAllPlannedToToday(plannedTasks: TaskPlanned[]) {
plannedTasks.forEach((t) => {
if (t.parentId) {
this.taskService.moveToProjectTodayList(t.parentId);
this._subs.add(
this.taskService.getByIdOnce$(t.parentId).subscribe((parentTask) => {
this.taskService.addTodayTag(parentTask);
}),
);
// NOTE: no unsubscribe on purpose as we always want this to run until done

this.taskService.getByIdOnce$(t.parentId).subscribe((parentTask) => {
this.taskService.addTodayTag(parentTask);
});
} else {
this.taskService.moveToProjectTodayList(t.id);
this.taskService.addTodayTag(t);
}
});
}

// NOTE: there is a duplicate of this in plan-tasks-tomorrow.component
addAllPlannedToDayAndCreateRepeatable(
plannedTasks: TaskPlanned[],
repeatableScheduledForTomorrow: TaskRepeatCfg[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,24 @@
</button>

<ng-container
*ngIf="plannedForToday.length === 0 &&(taskService.allPlannedForTomorrowNotOnToday$|async) as plannedForTomorrow"
*ngIf="plannedForToday.length === 0 && (taskService.allPlannedForTomorrowNotOnToday$|async) as plannedForTomorrow"
>
<button
*ngIf="plannedForTomorrow?.length"
(click)="addAllPlannedToToday(plannedForTomorrow)"
class="add-scheduled"
color=""
mat-stroked-button
tabindex="1"
<ng-container
*ngIf="(repeatableScheduledForTomorrow$|async) as repeatableScheduledForTomorrow"
>
<mat-icon>playlist_add</mat-icon>
{{T.WW.ADD_SCHEDULED_FOR_TOMORROW|translate:{nr: plannedForTomorrow.length} }}
</button>
<button
*ngIf="plannedForTomorrow.length || repeatableScheduledForTomorrow.length"
(click)="addAllPlannedToDayAndCreateRepeatable(plannedForTomorrow, repeatableScheduledForTomorrow)"
class="add-scheduled"
color=""
mat-stroked-button
tabindex="1"
>
<mat-icon>playlist_add</mat-icon>
{{T.WW.ADD_SCHEDULED_FOR_TOMORROW|translate:{ nr: plannedForTomorrow.length +
repeatableScheduledForTomorrow.length } }}
</button>
</ng-container>
</ng-container>
</div>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { WorkContextService } from '../../../features/work-context/work-context.
import { TaskService } from '../../../features/tasks/task.service';
import { T } from 'src/app/t.const';
import { TaskPlanned } from '../../../features/tasks/task.model';
import { TODAY_TAG } from '../../../features/tag/tag.const';
import { Observable } from 'rxjs';
import { TaskRepeatCfg } from '../../../features/task-repeat-cfg/task-repeat-cfg.model';
import { TaskRepeatCfgService } from '../../../features/task-repeat-cfg/task-repeat-cfg.service';

@Component({
selector: 'plan-tasks-tomorrow',
Expand All @@ -13,16 +15,49 @@ import { TODAY_TAG } from '../../../features/tag/tag.const';
})
export class PlanTasksTomorrowComponent {
T: typeof T = T;
// eslint-disable-next-line no-mixed-operators
private _tomorrow: number = Date.now() + 24 * 60 * 60 * 1000;
repeatableScheduledForTomorrow$: Observable<TaskRepeatCfg[]> =
this._taskRepeatCfgService.getRepeatTableTasksDueForDay$(this._tomorrow);

constructor(
public workContextService: WorkContextService,
public taskService: TaskService,
private _taskRepeatCfgService: TaskRepeatCfgService,
) {}

// NOTE: there is a duplicate of this in plan-tasks-tomorrow.component
addAllPlannedToToday(plannedTasks: TaskPlanned[]) {
plannedTasks.forEach((t) => {
this.taskService.moveToProjectTodayList(t.id);
this.taskService.updateTags(t, [...t.tagIds, TODAY_TAG.id], t.tagIds);
if (t.parentId) {
this.taskService.moveToProjectTodayList(t.parentId);
// NOTE: no unsubscribe on purpose as we always want this to run until done
this.taskService.getByIdOnce$(t.parentId).subscribe((parentTask) => {
this.taskService.addTodayTag(parentTask);
});
} else {
this.taskService.moveToProjectTodayList(t.id);
this.taskService.addTodayTag(t);
}
});
}

// NOTE: there is a duplicate of this in plan-tasks-tomorrow.component
addAllPlannedToDayAndCreateRepeatable(
plannedTasks: TaskPlanned[],
repeatableScheduledForTomorrow: TaskRepeatCfg[],
) {
if (plannedTasks.length) {
this.addAllPlannedToToday(plannedTasks);
}
if (repeatableScheduledForTomorrow.length) {
repeatableScheduledForTomorrow.forEach((repeatCfg) => {
this._taskRepeatCfgService.createRepeatableTask(
repeatCfg,
this._tomorrow,
this.taskService.currentTaskId,
);
});
}
}
}

0 comments on commit ecbc81a

Please sign in to comment.