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

Add intro video #786

Merged
merged 2 commits into from
Aug 22, 2024
Merged
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
87 changes: 87 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"dependencies": {
"@fortawesome/free-regular-svg-icons": "^6.5.2",
"@fortawesome/free-solid-svg-icons": "^6.5.2",
"@mux/mux-player-react": "^2.9.1",
"@react-google-maps/api": "^2.19.3",
"@stripe/stripe-js": "^3.4.1",
"aframe-atlas-uvs-component": "^3.0.0",
Expand Down
17 changes: 16 additions & 1 deletion src/editor/components/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ScenesModal } from './modals/ScenesModal';
import { PaymentModal } from './modals/PaymentModal';
import { SceneEditTitle } from './components/SceneEditTitle';
import { AddLayerPanel } from './components/AddLayerPanel';
import { IntroModal } from './modals/IntroModal';
import posthog from 'posthog-js';

THREE.ImageUtils.crossOrigin = '';
Expand All @@ -36,6 +37,7 @@ export default class Main extends Component {
isProfileModalOpened: false,
isAddLayerPanelOpen: false,
isGeoModalOpened: false,
isIntroModalOpened: false,
isScenesModalOpened: !isStreetLoaded,
isPaymentModalOpened: isPaymentModalOpened,
sceneEl: AFRAME.scenes[0],
Expand Down Expand Up @@ -83,6 +85,10 @@ export default class Main extends Component {
handleStreetMixURL() {
const isStreetMix = window.location.hash.includes('streetmix');
if (isStreetMix) {
const shownIntro = localStorage.getItem('shownIntro');
if (!shownIntro) {
this.setState({ isIntroModalOpened: true });
}
STREET.notify.warningMessage(
'Hit save if you want to save changes to the scene. Otherwise changes will be lost'
);
Expand All @@ -96,7 +102,7 @@ export default class Main extends Component {
htmlEditorButton && htmlEditorButton.remove();

this.handleStreetMixURL();
window.addEventListener('hashchange', this.handleStreetMixURL);
window.addEventListener('hashchange', () => this.handleStreetMixURL());
Events.on(
'opentexturesmodal',
function (selectedTexture, textureOnClose) {
Expand Down Expand Up @@ -177,6 +183,11 @@ export default class Main extends Component {
this.setState({ isGeoModalOpened: false });
};

onCloseIntroModal = () => {
this.setState({ isIntroModalOpened: false });
localStorage.setItem('shownIntro', true);
};

onClosePaymentModal = () => {
window.location.hash = '#';
this.setState({ isPaymentModalOpened: false });
Expand Down Expand Up @@ -280,6 +291,10 @@ export default class Main extends Component {
isOpen={this.state.isProfileModalOpened}
onClose={this.onCloseProfileModal}
/>
<IntroModal
isOpen={this.state.isIntroModalOpened}
onClose={this.onCloseIntroModal}
/>
<LoadScript
googleMapsApiKey={firebaseConfig.apiKey}
libraries={['places']}
Expand Down
18 changes: 18 additions & 0 deletions src/editor/components/modals/IntroModal/IntroModal.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Modal from '../Modal.jsx';
import MuxPlayer from '@mux/mux-player-react';

const IntroModal = ({ isOpen, onClose }) => {
return (
<Modal isOpen={isOpen} onClose={onClose} title="Welcome to 3DStreet">
<MuxPlayer
streamType="on-demand"
playbackId="TSxTjFBKoeTnspoQo02BFBPZXel6Pqtoo"
primaryColor="#FFFFFF"
secondaryColor="#000000"
accentColor="#653CB0"
/>
</Modal>
);
};

export { IntroModal };
1 change: 1 addition & 0 deletions src/editor/components/modals/IntroModal/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { IntroModal } from './IntroModal.component.jsx';
4 changes: 2 additions & 2 deletions webpack.prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const DEPLOY_ENV = process.env.DEPLOY_ENV ?? 'production';

module.exports = {
performance: {
maxAssetSize: 1777722, // 1.7 MiB
maxEntrypointSize: 1777722, // 1.7 MiB
maxAssetSize: 2777777, // 2.4 MiB
maxEntrypointSize: 2777777, // 2.4 MiB
hints: 'error'
},
mode: 'production',
Expand Down