Skip to content

Commit

Permalink
fix: publish flow (#299)
Browse files Browse the repository at this point in the history
* fix: show native link instead of web

* fix: remove back button on success screen

* chore: linted
  • Loading branch information
cazala authored Nov 11, 2024
1 parent 67f5c45 commit d1591ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { styled } from 'decentraland-ui2';
import { Modal as BaseModal } from 'decentraland-ui2/dist/components/Modal/Modal';
import { type ModalProps } from 'decentraland-ui2/dist/components/Modal/Modal.types';

function noop() {}
export function onBackNoop() {}

const Modal = styled(BaseModal)(props => ({
'& > .MuiPaper-root .MuiBox-root:first-child': {
Expand All @@ -23,7 +23,7 @@ const Modal = styled(BaseModal)(props => ({
backgroundImage: 'none',
},
'& [aria-label="back"]':
props.onBack !== noop
props.onBack !== onBackNoop
? {}
: {
opacity: 0,
Expand All @@ -37,7 +37,7 @@ export function PublishModal(props: React.PropsWithChildren<ModalProps>) {
<Modal
size="small"
{...rest}
onBack={onBack || noop}
onBack={onBack || onBackNoop}
>
{props.children}
</Modal>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { PublishModal } from './component';
export { PublishModal, onBackNoop } from './component';
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useEditor } from '/@/hooks/useEditor';
import { useIsMounted } from '/@/hooks/useIsMounted';
import { useAuth } from '/@/hooks/useAuth';
import { addBase64ImagePrefix } from '/@/modules/image';
import { PublishModal } from '../../PublishModal';
import { PublishModal, onBackNoop } from '../../PublishModal';
import { Button } from '../../../../Button';
import { type Props } from '../../types';
import type { File, Info } from './types';
Expand Down Expand Up @@ -160,26 +160,20 @@ export function Deploy(props: Props) {
if (info && project) {
if (info.isWorld) {
if (project.worldConfiguration) {
return `http://decentraland.org/play/world/${project.worldConfiguration.name}`;
return `decentraland://?realm=${project.worldConfiguration.name}`;
}
} else {
return `http://decentraland.org/play?position=${project.scene.base}`;
return `decentraland://?position=${project.scene.base}`;
}
}
return null;
}, [info, project]);

const handleJumpIn = useCallback(() => {
if (info && project) {
if (info.isWorld) {
if (project.worldConfiguration) {
void misc.openExternal(`decentraland://?realm=${project.worldConfiguration.name}`);
}
} else {
void misc.openExternal(`decentraland://?position=${project.scene.base}`);
}
if (jumpInUrl) {
void misc.openExternal(jumpInUrl);
}
}, [info, project]);
}, [jumpInUrl]);

return (
<PublishModal
Expand All @@ -196,6 +190,7 @@ export function Deploy(props: Props) {
}
size="large"
{...props}
onBack={isSuccessful ? onBackNoop : props.onBack}
>
<div className="Deploy">
{showWarning ? (
Expand Down

0 comments on commit d1591ae

Please sign in to comment.