Skip to content

Commit

Permalink
Merge pull request #831 from PRX/fix/audio-segmentor-ad-breaks-change
Browse files Browse the repository at this point in the history
830: Audio Segmenter Ad Breaks Change
  • Loading branch information
rpeterman-gp authored Oct 2, 2023
2 parents cb2144c + 0dbbffd commit 18b2213
Show file tree
Hide file tree
Showing 9 changed files with 225 additions and 73 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@
}
}

:is(tr) {
&:first-of-type {
&::before {
content: "";
display: block;
grid-column: 1 / -1;
height: $table-border-width * 2;
background-color: var(--#{$prefix}table-border-color);
}
:is(thead > tr) {
&::before,
&::after {
content: "";
display: block;
grid-column: 1 / -1;
height: $table-border-width * 2;
background-color: var(--#{$prefix}table-border-color);
}
}

Expand Down
8 changes: 8 additions & 0 deletions app/assets/stylesheets/shared/form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
box-shadow: $input-focus-box-shadow;
}

&.is-changed {
border-color: $orange;

&:focus-within {
box-shadow: 0 0 $input-btn-focus-blur $input-btn-focus-width rgba($orange, $input-btn-focus-color-opacity);
}
}

& > :is(.form-control, .input-group-text, .btn) {
border: none;

Expand Down
44 changes: 26 additions & 18 deletions app/javascript/controllers/audio_breakpoint_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ export default class extends Controller {
static classes = ["completed"]

static values = {
initialMarker: Object,
id: String,
label: String,
startTime: String,
endTime: String,
startTime: Number,
endTime: Number,
}

connect() {
Expand All @@ -30,10 +31,29 @@ export default class extends Controller {
}

startTimeValueChanged() {
if (this.hasInitialMarkerValue) {
const isChanged = this.startTimeValue !== (this.initialMarkerValue.startTime || 0)

this.startTimeTarget.parentNode.classList.toggle("is-changed", isChanged)
} else {
this.startTimeTarget.parentNode.classList.add("is-changed")
}

this.startTimeTarget.placeholder = convertSecondsToDuration(this.startTimeValue)
}

endTimeValueChanged() {
if (this.hasInitialMarkerValue) {
const isChanged = this.endTimeValue !== (this.initialMarkerValue.endTime || 0)
const isStartTimeChanged =
this.startTimeTarget.parentNode.classList.contains("is-changed") || (isChanged && !this.hasEndTimeValue)

this.endTimeTarget.parentNode.classList.toggle("is-changed", isChanged)
this.startTimeTarget.parentNode.classList.toggle("is-changed", isStartTimeChanged)
} else {
this.endTimeTarget.parentNode.classList.add("is-changed")
}

this.endTimeTarget.placeholder = convertSecondsToDuration(this.endTimeValue)
}

Expand All @@ -48,19 +68,13 @@ export default class extends Controller {
}

updateStartTimeToPlayhead() {
const playheadTime = this.getPlayheadTime()

if (playheadTime) {
this.updateStartTime(playheadTime)
}
this.dispatch("marker.update-start-time-to-playhead", { detail: { id: this.idValue, endTime: this.endTimeValue } })
}

updateEndTimeToPlayhead() {
const playheadTime = this.getPlayheadTime()

if (playheadTime) {
this.updateEndTime(playheadTime)
}
this.dispatch("marker.update-end-time-to-playhead", {
detail: { id: this.idValue, startTime: this.startTimeValue },
})
}

changeStartTime() {
Expand All @@ -81,12 +95,6 @@ export default class extends Controller {
this.updateEndTime(null)
}

getPlayheadTime() {
const playerContainer = this.element.closest("[data-playhead-time]")

return playerContainer ? playerContainer.dataset.playheadTime : 0
}

play() {
this.dispatch("play", { detail: { id: this.idValue } })
}
Expand Down
Loading

0 comments on commit 18b2213

Please sign in to comment.