Skip to content

Commit

Permalink
feat: set first day of the week #528
Browse files Browse the repository at this point in the history
  • Loading branch information
phkorn committed Oct 2, 2020
1 parent 5144d3a commit b83bfea
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/app/features/config/default-global-config.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export const DEFAULT_GLOBAL_CONFIG: GlobalConfigState = {
isTurnOffMarkdown: false,
isAutoAddWorkedOnToToday: false,
isDisableInitialDialog: false,
defaultProjectId: null
defaultProjectId: null,
firstDayOfWeek: 0,
},
evaluation: {
isHideEvaluationSheet: false,
Expand Down
17 changes: 17 additions & 0 deletions src/app/features/config/form-cfgs/misc-settings-form.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,22 @@ export const MISC_SETTINGS_FORM_CFG: ConfigFormSection<MiscConfig> = {
label: T.GCF.MISC.DEFAULT_PROJECT,
},
},
{
key: 'firstDayOfWeek',
type: 'select',
templateOptions: {
label: T.GCF.MISC.FIRST_DAY_OF_WEEK,
required: true,
options: [
{label: T.F.TASK_REPEAT.F.SUNDAY, value: 0},
{label: T.F.TASK_REPEAT.F.MONDAY, value: 1},
{label: T.F.TASK_REPEAT.F.TUESDAY, value: 2},
{label: T.F.TASK_REPEAT.F.WEDNESDAY, value: 3},
{label: T.F.TASK_REPEAT.F.THURSDAY, value: 4},
{label: T.F.TASK_REPEAT.F.FRIDAY, value: 5},
{label: T.F.TASK_REPEAT.F.SATURDAY, value: 6},
],
},
},
]
};
1 change: 1 addition & 0 deletions src/app/features/config/global-config.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export type MiscConfig = Readonly<{
isAutoAddWorkedOnToToday: boolean;
isDisableInitialDialog: boolean;
defaultProjectId: string | null;
firstDayOfWeek: number;
}>;

export type EvaluationConfig = Readonly<{
Expand Down
3 changes: 2 additions & 1 deletion src/app/t.const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,8 @@ export const T = {
'IS_HIDE_NAV': 'GCF.MISC.IS_HIDE_NAV',
'IS_NOTIFY_WHEN_TIME_ESTIMATE_EXCEEDED': 'GCF.MISC.IS_NOTIFY_WHEN_TIME_ESTIMATE_EXCEEDED',
'IS_TURN_OFF_MARKDOWN': 'GCF.MISC.IS_TURN_OFF_MARKDOWN',
'TITLE': 'GCF.MISC.TITLE'
'TITLE': 'GCF.MISC.TITLE',
"FIRST_DAY_OF_WEEK": 'GCF.MISC.FIRST_DAY_OF_WEEK',
},
'POMODORO': {
'BREAK_DURATION': 'GCF.POMODORO.BREAK_DURATION',
Expand Down
1 change: 1 addition & 0 deletions src/app/ui/owl-wrapper/owl-wrapper.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
[sPlaceholder]="T.DATETIME_SCHEDULE.PLACEHOLDER|translate"
[sPressEnterToSubmit]="T.DATETIME_SCHEDULE.PRESS_ENTER_AGAIN|translate"
[sTomorrow]="T.DATETIME_SCHEDULE.TOMORROW|translate"
[firstDayOfWeek]="(firstDayOfWeek$|async)"
name="owlDate"
ngDefaultControl></owl-date-time-inline>
10 changes: 9 additions & 1 deletion src/app/ui/owl-wrapper/owl-wrapper.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { Observable } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { GlobalConfigService } from 'src/app/features/config/global-config.service';
import { T } from 'src/app/t.const';

@Component({
Expand Down Expand Up @@ -31,7 +34,12 @@ export class OwlWrapperComponent {
'23:30',
];

constructor() {
firstDayOfWeek$: Observable<number> = this._globalConfigService.misc$.pipe(
map(cfg => cfg.firstDayOfWeek),
startWith(0),
);

constructor(private _globalConfigService: GlobalConfigService) {
}

@Input('dateTime')
Expand Down
3 changes: 2 additions & 1 deletion src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,8 @@
"IS_HIDE_NAV": "Navigation verbergen, bis die Hauptüberschrift angezeigt wird (nur Desktop)",
"IS_NOTIFY_WHEN_TIME_ESTIMATE_EXCEEDED": "Benachrichtigen, wenn die geschätzte Zeit überschritten wurde",
"IS_TURN_OFF_MARKDOWN": "Deaktivieren Sie das Markdown-Parsing für Notizen",
"TITLE": "Verschiedene Einstellungen"
"TITLE": "Verschiedene Einstellungen",
"FIRST_DAY_OF_WEEK": "Erster Tag der Woche"
},
"POMODORO": {
"BREAK_DURATION": "Dauer der kurzen Pausen",
Expand Down
3 changes: 2 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,8 @@
"IS_HIDE_NAV": "Hide navigation until main header is hovered (desktop only)",
"IS_NOTIFY_WHEN_TIME_ESTIMATE_EXCEEDED": "Notify when time estimate was exceeded",
"IS_TURN_OFF_MARKDOWN": "Turn off markdown parsing for notes",
"TITLE": "Misc Settings"
"TITLE": "Misc Settings",
"FIRST_DAY_OF_WEEK": "First day of the week"
},
"POMODORO": {
"BREAK_DURATION": "Duration of short breaks",
Expand Down

0 comments on commit b83bfea

Please sign in to comment.