-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
225 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
packages/renderer/src/components/Modals/PublishProject/AlternativeServers/component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { type ChangeEvent, useCallback, useState } from 'react'; | ||
import { Button, MenuItem, Select, type SelectChangeEvent } from 'decentraland-ui2'; | ||
import { t } from '/@/modules/store/translation/utils'; | ||
import GenesisPlazaPng from '/assets/images/genesis_plaza.png'; | ||
import type { AlternativeTarget, TargetProps, TargetValue } from '../types'; | ||
|
||
import './styles.css'; | ||
import { isUrl } from '/shared/utils'; | ||
import { misc } from '#preload'; | ||
|
||
export function AlternativeServers({ onTarget: onClick }: TargetProps) { | ||
const [option, setOption] = useState<AlternativeTarget>('test'); | ||
const [customUrl, setCustomUrl] = useState(''); | ||
const [error, setError] = useState(''); | ||
|
||
const handleClick = useCallback(() => { | ||
if (option === 'custom' && !isUrl(customUrl)) { | ||
return setError(t('modal.publish_project.alternative_servers.errors.url')); | ||
} | ||
const value: TargetValue = { target: option, value: customUrl }; | ||
onClick(value); | ||
}, [option, customUrl]); | ||
|
||
const handleChangeSelect = useCallback((e: SelectChangeEvent<AlternativeTarget>) => { | ||
setOption(e.target.value as AlternativeTarget); | ||
}, []); | ||
|
||
const handleChangeCustom = useCallback( | ||
(e: ChangeEvent<HTMLInputElement>) => { | ||
if (error) setError(''); | ||
setCustomUrl(e.target.value); | ||
}, | ||
[error], | ||
); | ||
|
||
const handleClickLearnMore = useCallback(() => { | ||
if (option === 'custom') { | ||
return misc.openExternal( | ||
'https://docs.decentraland.org/creator/development-guide/sdk7/publishing/#custom-servers', | ||
); | ||
} | ||
misc.openExternal( | ||
'https://docs.decentraland.org/creator/development-guide/sdk7/publishing/#the-test-server', | ||
); | ||
}, [option]); | ||
|
||
return ( | ||
<div className="AlternativeServers"> | ||
<span className="select">{t('modal.publish_project.select')}</span> | ||
<div className="box"> | ||
<div className="selection"> | ||
<div> | ||
<h3>{t('modal.publish_project.alternative_servers.list')}</h3> | ||
<Select | ||
variant="standard" | ||
value={option} | ||
onChange={handleChangeSelect} | ||
> | ||
<MenuItem value="test"> | ||
{t('modal.publish_project.alternative_servers.options.test_server')} | ||
</MenuItem> | ||
<MenuItem value="custom"> | ||
{t('modal.publish_project.alternative_servers.options.custom_server')} | ||
</MenuItem> | ||
</Select> | ||
{option === 'custom' && ( | ||
<div className="custom_input"> | ||
<span className="title"> | ||
{t('modal.publish_project.alternative_servers.custom_server_url')} | ||
</span> | ||
<input | ||
value={customUrl} | ||
onChange={handleChangeCustom} | ||
/> | ||
<span className="error">{error}</span> | ||
</div> | ||
)} | ||
</div> | ||
<img | ||
className="thumbnail" | ||
src={GenesisPlazaPng} | ||
/> | ||
</div> | ||
<div className="actions"> | ||
<span | ||
className="learn-more" | ||
onClick={handleClickLearnMore} | ||
> | ||
{t('option_box.learn_more')} | ||
</span> | ||
<Button onClick={handleClick}> | ||
{t(`modal.publish_project.alternative_servers.action.${option}_server`)} | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
1 change: 1 addition & 0 deletions
1
packages/renderer/src/components/Modals/PublishProject/AlternativeServers/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { AlternativeServers } from './component'; |
26 changes: 0 additions & 26 deletions
26
...mponents/Modals/PublishProject/styles.css → ...lishProject/AlternativeServers/styles.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/renderer/src/components/Modals/PublishProject/Deploy/component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Loader } from '/@/components/Loader'; | ||
import { useEditor } from '/@/hooks/useEditor'; | ||
import './styles.css'; | ||
|
||
export function Deploy() { | ||
const { loadingPublish } = useEditor(); | ||
return <div className="Deploy">{loadingPublish ? <Loader /> : 'Deploy'}</div>; | ||
} |
1 change: 1 addition & 0 deletions
1
packages/renderer/src/components/Modals/PublishProject/Deploy/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Deploy } from './component'; |
3 changes: 3 additions & 0 deletions
3
packages/renderer/src/components/Modals/PublishProject/Deploy/styles.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.Deploy { | ||
color: red; | ||
} |
39 changes: 39 additions & 0 deletions
39
packages/renderer/src/components/Modals/PublishProject/Initial/component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { OptionBox } from '/@/components/EditorPage/OptionBox'; | ||
import { t } from '/@/modules/store/translation/utils'; | ||
import LandPng from '/assets/images/land.png'; | ||
import WorldsPng from '/assets/images/worlds.png'; | ||
import type { Step } from '../types'; | ||
|
||
import './styles.css'; | ||
|
||
export function Initial({ onStepChange }: { onStepChange: (step: Step) => () => void }) { | ||
return ( | ||
<div className="Initial"> | ||
<span className="select">{t('modal.publish_project.select')}</span> | ||
<div className="options"> | ||
<OptionBox | ||
thumbnailSrc={WorldsPng} | ||
title={t('modal.publish_project.worlds.title')} | ||
description={t('modal.publish_project.worlds.description')} | ||
buttonText={t('modal.publish_project.worlds.action')} | ||
onClickPublish={onStepChange('publish-to-world')} | ||
learnMoreUrl="https://docs.decentraland.org/creator/worlds/about/#publish-a-world" | ||
/> | ||
<OptionBox | ||
thumbnailSrc={LandPng} | ||
title={t('modal.publish_project.land.title')} | ||
description={t('modal.publish_project.land.description')} | ||
buttonText={t('modal.publish_project.land.action')} | ||
onClickPublish={onStepChange('publish-to-land')} | ||
learnMoreUrl="https://docs.decentraland.org/creator/development-guide/sdk7/publishing-permissions/#land-permission-options" | ||
/> | ||
</div> | ||
<span | ||
className="alternative_servers" | ||
onClick={onStepChange('alternative-servers')} | ||
> | ||
{t('modal.publish_project.alternative_servers.title')} | ||
</span> | ||
</div> | ||
); | ||
} |
1 change: 1 addition & 0 deletions
1
packages/renderer/src/components/Modals/PublishProject/Initial/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Initial } from './component'; |
27 changes: 27 additions & 0 deletions
27
packages/renderer/src/components/Modals/PublishProject/Initial/styles.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* TODO: update the Modal component in ui2 to allow providing a className to the Material Modal...*/ | ||
|
||
/* Initial Modal */ | ||
.MuiModal-root .Initial { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.MuiModal-root .Initial .select, | ||
.MuiModal-root .Initial .alternative_servers { | ||
text-align: center; | ||
} | ||
|
||
.MuiModal-root .Initial .options { | ||
display: flex; | ||
margin: 20px 0; | ||
} | ||
|
||
.MuiModal-root .Initial .options .OptionBox + .OptionBox { | ||
margin-left: 20px; | ||
} | ||
|
||
.MuiModal-root .Initial .alternative_servers { | ||
text-decoration: underline; | ||
text-transform: uppercase; | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.