Skip to content

Commit 1b64019

Browse files
authored
Fix tutorial video modal centering and Vimeo completion events (#1523)
1 parent 7429e05 commit 1b64019

2 files changed

Lines changed: 17 additions & 13 deletions

File tree

app/assets/stylesheets/components/_kitchen_tutorial_steps.scss

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,24 @@
190190

191191
.tutorial-video-modal {
192192
position: fixed;
193-
top: 50%;
194-
left: 50%;
195-
transform: translate(-50%, -50%);
193+
inset: 0;
194+
z-index: 100;
195+
display: none;
196+
align-items: center;
197+
justify-content: center;
198+
width: 100%;
199+
height: 100%;
196200
margin: 0;
197-
padding: 0;
198-
padding-top: 50px;
201+
padding: 40px;
199202
border: none;
200-
border-radius: var(--border-radius);
201-
width: calc(100vw - 80px);
202-
max-width: 1200px;
203-
max-height: calc(100vh - 80px);
204203
background: transparent;
205204
box-shadow: none;
206205
overflow: visible;
207206

207+
&[open] {
208+
display: flex;
209+
}
210+
208211
&::backdrop {
209212
background: rgb(0 0 0 / 0.8);
210213
}
@@ -213,8 +216,8 @@
213216
position: relative;
214217
display: flex;
215218
flex-direction: column;
216-
width: 100%;
217-
height: 100%;
219+
width: min(1200px, 100%);
220+
max-height: 100%;
218221
}
219222

220223
&__close {

app/javascript/controllers/tutorial_video_modal_controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default class extends Controller {
1313

1414
const videoUrl = event.params.videoUrl;
1515
if (videoUrl) {
16-
this.iframeTarget.onload = () => this.subscribeToVimeoEvents();
1716
this.iframeTarget.src = videoUrl;
1817
}
1918

@@ -60,7 +59,9 @@ export default class extends Controller {
6059
try {
6160
const data =
6261
typeof event.data === "string" ? JSON.parse(event.data) : event.data;
63-
if (data.event === "play") {
62+
if (data.event === "ready") {
63+
this.subscribeToVimeoEvents();
64+
} else if (data.event === "play") {
6465
this.markComplete();
6566
}
6667
} catch (e) {

0 commit comments

Comments
 (0)