Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface JourneyStep {
content: React.ReactNode;
image?: string;
videoSrc?: string;
video?: boolean;
video?: string;
embed?: boolean;
previousButton?: boolean;
isFullScreenModeAllowed?: boolean;
Expand Down
43 changes: 33 additions & 10 deletions src/custom/DashboardWidgets/GettingStartedWidget/JourneyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import MesheryDesignEmbedUmd from '@layer5/meshery-design-embed';
import _ from 'lodash';
import { useEffect, useState } from 'react';
import { Link, Box } from '@mui/material';
import { styled } from '../../../theme';
import { JourneyStep, ProfileData, StepData } from './GetStartedModal';
import ReusableModal from './ReusableModal';
Expand Down Expand Up @@ -38,6 +39,23 @@ export const ModalVideo = styled('video')(() => ({
paddingBlock: '1rem'
}));

const FallbackLink: React.FC<{ video: string }> = ({ video }) => {
const watchLink = video.replace('/embed/', '/watch?v=');
return (
<Box sx={{ textAlign: 'center', my: 2 }}>
<Link
href={watchLink}
target="_blank"
rel="noopener noreferrer"
underline="hover"
sx={{ fontWeight: 'bold' }}
>
▶ Having trouble viewing? Watch on YouTube
</Link>
</Box>
);
};

const JourneyModal: React.FC<JourneyModalProps> = ({
open,
handleClose,
Expand Down Expand Up @@ -147,16 +165,21 @@ const JourneyModal: React.FC<JourneyModalProps> = ({
''
)}
{data.video !== undefined ? (
<iframe
style={{
aspectRatio: '16/9',
width: '100%'
}}
src="https://www.youtube.com/embed/Do7htKrRzDA?si=5iMQ5a1JUf3qpIiH"
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowFullScreen={true}
></iframe>
<div>
<iframe
style={{
aspectRatio: '16/9',
width: '100%'
}}
src={data.video}
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowFullScreen={true}
referrerPolicy="strict-origin-when-cross-origin"
loading="lazy"
></iframe>
<FallbackLink video={data.video} />
</div>
) : (
''
)}
Expand Down
Loading