Skip to content

Commit

Permalink
Merge branch 'main' into fix_statistics_page
Browse files Browse the repository at this point in the history
  • Loading branch information
winged authored Jan 20, 2025
2 parents 77eb5fb + fbb8d19 commit f27d80a
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 13 deletions.
2 changes: 1 addition & 1 deletion frontend/app/analysis/edit/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
{{/unless}}
{{#if
(and
f.model.change.task
f.model.change.task.id
(not (eq f.model.change.task.id model.task.id))
)
}}
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/durationpicker-day.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class DurationpickerDayComponent extends DurationpickerComponent
}

get pattern() {
return "^(?:[01]?\\d|2[0-3]):?(?:00|15|30|45)?$";
return "^(?:[01]?\\d|2[0-3])?:?(?:00|15|30|45)?$";
}

@action
Expand Down
6 changes: 5 additions & 1 deletion frontend/app/components/modal.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{{#if @visible}}
{{#in-element this.target insertBefore=null}}
<Modal::Overlay @visible={{@visible}} @onClose={{optional @onClose}}>
<Modal::Overlay
@visible={{@visible}}
@onClose={{optional @onClose}}
{{focus-trap additionalElements=(array this.target)}}
>
<div
class="modal-dialog bg-background z-50 max-h-[100%] w-full rounded border"
...attributes
Expand Down
1 change: 1 addition & 0 deletions frontend/app/components/modal/overlay.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
id={{this.id}}
{{! template-lint-disable no-invalid-interactive }}
{{on "click" this.handleClick}}
...attributes
>
{{yield}}
</div>
8 changes: 6 additions & 2 deletions frontend/app/styles/components/power-calendar.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,19 @@
}

.ember-power-calendar-day--current-month {
@apply bg-background-muted;
@apply bg-secondary/20;
}

.ember-power-calendar-day--today {
@apply bg-secondary/50;
}

.ember-power-calendar-day--selected {
@apply bg-primary text-foreground-primary;
}

.ember-power-calendar-day--current-month:not([disabled]) {
@apply hover:bg-background-secondary/50;
@apply hover:bg-secondary-light/55;
}

.ember-power-calendar-day--other-month:not([disabled]):hover {
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/utils/parse-daytime.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @public
*/

const DAY_TIME_REGEX = /^(?<hours>[01]?\d|2[0-3]):?(?<minutes>00|15|30|45)?$/;
const DAY_TIME_REGEX = /^(?<hours>[01]?\d|2[0-3])?:?(?<minutes>00|15|30|45)?$/;

/**
* Converts a django duration string to a moment duration
Expand All @@ -23,5 +23,5 @@ export default function parseDayTime(str) {
if (!matches) return null;
const { hours, minutes } = matches.groups;

return [parseInt(hours), parseInt(minutes ?? "0")];
return [parseInt(hours ?? "0"), parseInt(minutes ?? "0")];
}
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"ember-decorators": "6.1.1",
"ember-event-helpers": "^0.1.1",
"ember-fetch": "8.1.2",
"ember-focus-trap": "^1.1.1",
"ember-in-viewport": "4.1.0",
"ember-keyboard": "^9.0.1",
"ember-load-initializers": "2.1.2",
Expand Down
41 changes: 35 additions & 6 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions frontend/tests/unit/utils/parse-daytime-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ module("Unit | Utility | parse day time", function () {
assert.deepEqual([2, 0], result);
});

test("single numbers over 23 will be minutes if valid", function (assert) {
assert.deepEqual([0, 30], parseDayTime("30"));
assert.deepEqual([0, 45], parseDayTime("45"));
});

test("anything after : will be minutes", function (assert) {
assert.deepEqual([0, 15], parseDayTime(":15"));
assert.deepEqual([0, 30], parseDayTime(":30"));
});

test("works without :", function (assert) {
const result = parseDayTime("230");

Expand Down

0 comments on commit f27d80a

Please sign in to comment.