Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] setup-cloud-page: add youtube video #54

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion src/pages/panel/setup-cloud/SetupCloudPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Trans } from '@lingui/macro'
import { useLingui } from '@lingui/react'
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
import { Accordion, AccordionDetails, AccordionSummary, Box, Button, Divider, Skeleton, Typography } from '@mui/material'
import { Suspense, useEffect } from 'react'
import { Suspense, useEffect, useRef } from 'react'
import { useEvents } from 'src/core/events'
import { useAbsoluteNavigate } from 'src/shared/absolute-navigate'
import { ErrorBoundaryFallback, NetworkErrorBoundary } from 'src/shared/error-boundary-fallback'
Expand All @@ -15,10 +16,19 @@ import { TenantId } from './TenantId'

export default function SetupCloud() {
const { addListener } = useEvents()
const {
i18n: { locale },
} = useLingui()
const navigate = useAbsoluteNavigate()
const methodToRemove = useRef<(() => void) | null>(null)

useEffect(() => {
setInitiated(true)
return () => {
if (methodToRemove.current) {
window.removeEventListener('resize', methodToRemove.current)
}
}
}, [])

useEffect(() => {
Expand All @@ -40,6 +50,30 @@ export default function SetupCloud() {
<Typography variant="h6" color="warning.main" mt={1}>
<Trans>Make sure that you are already logged into the correct AWS account, before pressing the DEPLOY STACK button.</Trans>
</Typography>
<Box mt={3} display="flex" justifyContent="start">
<iframe
height={0}
width="100%"
onLoad={(e) => {
const target = e.currentTarget
if (methodToRemove.current) {
window.removeEventListener('resize', methodToRemove.current)
}

methodToRemove.current = () => {
target.style.height = `${(target.clientWidth * 9) / 16}px`
}
methodToRemove.current()
window.addEventListener('resize', methodToRemove.current)
}}
onResize={() => methodToRemove.current?.()}
src={`https://www.youtube-nocookie.com/embed/yWdOBEnAytM?modestbranding=1&rel=0&iv_load_policy=3&hl=${locale}&color=white`}
title="FIX AWS Account Setup"
style={{ border: 0, maxWidth: 720, maxHeight: 405 }}
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowFullScreen
/>
</Box>
<Box py={3}>
<NetworkErrorBoundary FallbackComponent={ErrorBoundaryFallback}>
<Suspense
Expand Down