|
|
@ -16,8 +16,11 @@ export function Workspace () { |
|
|
|
const [selectedWorkspace, setSelectedWorkspace] = useState<{ name: string, isGitRepo: boolean}>(null) |
|
|
|
const [selectedWorkspace, setSelectedWorkspace] = useState<{ name: string, isGitRepo: boolean}>(null) |
|
|
|
const [showDropdown, setShowDropdown] = useState<boolean>(false) |
|
|
|
const [showDropdown, setShowDropdown] = useState<boolean>(false) |
|
|
|
const displayOzCustomRef = useRef<HTMLDivElement>() |
|
|
|
const displayOzCustomRef = useRef<HTMLDivElement>() |
|
|
|
const ozFeatures = useRef({mintable: false, burnable: false, pausable: false}) |
|
|
|
const mintableCheckboxRef = useRef() |
|
|
|
const upgradeable = useRef() |
|
|
|
const burnableCheckboxRef = useRef() |
|
|
|
|
|
|
|
const pausableCheckboxRef = useRef() |
|
|
|
|
|
|
|
const transparentRadioRef = useRef() |
|
|
|
|
|
|
|
const uupsRadioRef = useRef() |
|
|
|
const global = useContext(FileSystemContext) |
|
|
|
const global = useContext(FileSystemContext) |
|
|
|
const workspaceRenameInput = useRef() |
|
|
|
const workspaceRenameInput = useRef() |
|
|
|
const workspaceCreateInput = useRef() |
|
|
|
const workspaceCreateInput = useRef() |
|
|
@ -113,10 +116,15 @@ export function Workspace () { |
|
|
|
// @ts-ignore: Object is possibly 'null'.
|
|
|
|
// @ts-ignore: Object is possibly 'null'.
|
|
|
|
const workspaceTemplateName = workspaceCreateTemplateInput.current.value || 'remixDefault' |
|
|
|
const workspaceTemplateName = workspaceCreateTemplateInput.current.value || 'remixDefault' |
|
|
|
const initGitRepo = initGitRepoRef.current.checked |
|
|
|
const initGitRepo = initGitRepoRef.current.checked |
|
|
|
const features = ozFeatures.current |
|
|
|
|
|
|
|
const opts = { |
|
|
|
const opts = { |
|
|
|
upgradeable: upgradeable.current, |
|
|
|
// @ts-ignore: Object is possibly 'null'.
|
|
|
|
features |
|
|
|
mintable: mintableCheckboxRef.current.checked, |
|
|
|
|
|
|
|
// @ts-ignore: Object is possibly 'null'.
|
|
|
|
|
|
|
|
burnable: burnableCheckboxRef.current.checked, |
|
|
|
|
|
|
|
// @ts-ignore: Object is possibly 'null'.
|
|
|
|
|
|
|
|
pausable: pausableCheckboxRef.current.checked, |
|
|
|
|
|
|
|
// @ts-ignore: Object is possibly 'null'.
|
|
|
|
|
|
|
|
upgradeable: transparentRadioRef.current.checked ? transparentRadioRef.current.value : ( uupsRadioRef.current.checked ? uupsRadioRef.current.value : false ) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
@ -155,8 +163,16 @@ export function Workspace () { |
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
if (workspaceCreateTemplateInput.current.value.startsWith('oz') && displayOzCustomRef && displayOzCustomRef.current) { |
|
|
|
if (workspaceCreateTemplateInput.current.value.startsWith('oz') && displayOzCustomRef && displayOzCustomRef.current) { |
|
|
|
displayOzCustomRef.current.style.display = 'block' |
|
|
|
displayOzCustomRef.current.style.display = 'block' |
|
|
|
upgradeable.current = undefined |
|
|
|
// @ts-ignore
|
|
|
|
ozFeatures.current = {mintable: false, burnable: false, pausable: false} |
|
|
|
mintableCheckboxRef.current.checked = false |
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
burnableCheckboxRef.current.checked = false |
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
pausableCheckboxRef.current.checked = false |
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
transparentRadioRef.current.checked = false |
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
uupsRadioRef.current.checked = false |
|
|
|
} else displayOzCustomRef.current.style.display = 'none' |
|
|
|
} else displayOzCustomRef.current.style.display = 'none' |
|
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
@ -177,18 +193,11 @@ export function Workspace () { |
|
|
|
setShowDropdown(isOpen) |
|
|
|
setShowDropdown(isOpen) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const handleUpgradeability = (e) => { |
|
|
|
const handleUpgradeability = () => { |
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
upgradeable.current = e.target.value |
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
|
workspaceCreateInput.current.value = `${workspaceCreateTemplateInput.current.value + '_upgradeable'}_${Date.now()}` |
|
|
|
workspaceCreateInput.current.value = `${workspaceCreateTemplateInput.current.value + '_upgradeable'}_${Date.now()}` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const handleFeatures = (e) => { |
|
|
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
|
|
|
ozFeatures.current[e.target.value] = e.target.checked |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const createModalMessage = () => { |
|
|
|
const createModalMessage = () => { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
@ -212,29 +221,29 @@ export function Workspace () { |
|
|
|
<label className="form-check-label d-block mb-2" style={{fontWeight: "bolder"}}>Customize template</label> |
|
|
|
<label className="form-check-label d-block mb-2" style={{fontWeight: "bolder"}}>Customize template</label> |
|
|
|
|
|
|
|
|
|
|
|
<label id="wsName" className="form-check-label d-block mb-1">Features</label> |
|
|
|
<label id="wsName" className="form-check-label d-block mb-1">Features</label> |
|
|
|
<div className="mb-2" onChange={(e) => handleFeatures(e)}> |
|
|
|
<div className="mb-2"> |
|
|
|
<div className="d-flex ml-2 custom-control custom-checkbox"> |
|
|
|
<div className="d-flex ml-2 custom-control custom-checkbox"> |
|
|
|
<input className="custom-control-input" type="checkbox" name="feature" value="mintable" id="mintable" /> |
|
|
|
<input className="custom-control-input" type="checkbox" name="feature" value="mintable" id="mintable" ref={mintableCheckboxRef} /> |
|
|
|
<label className="form-check-label custom-control-label" htmlFor="mintable" data-id="featureTypeMintable" >Mintable</label> |
|
|
|
<label className="form-check-label custom-control-label" htmlFor="mintable" data-id="featureTypeMintable" >Mintable</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="d-flex ml-2 custom-control custom-checkbox"> |
|
|
|
<div className="d-flex ml-2 custom-control custom-checkbox"> |
|
|
|
<input className="custom-control-input" type="checkbox" name="feature" value="burnable" id="burnable" /> |
|
|
|
<input className="custom-control-input" type="checkbox" name="feature" value="burnable" id="burnable" ref={burnableCheckboxRef} /> |
|
|
|
<label className="form-check-label custom-control-label" htmlFor="burnable" data-id="featureTypeBurnable" >Burnable</label> |
|
|
|
<label className="form-check-label custom-control-label" htmlFor="burnable" data-id="featureTypeBurnable" >Burnable</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="d-flex ml-2 custom-control custom-checkbox"> |
|
|
|
<div className="d-flex ml-2 custom-control custom-checkbox"> |
|
|
|
<input className="custom-control-input" type="checkbox" name="feature" value="pausable" id="pausable" /> |
|
|
|
<input className="custom-control-input" type="checkbox" name="feature" value="pausable" id="pausable" ref={pausableCheckboxRef} /> |
|
|
|
<label className="form-check-label custom-control-label" htmlFor="pausable" data-id="featureTypePausable" >Pausable</label> |
|
|
|
<label className="form-check-label custom-control-label" htmlFor="pausable" data-id="featureTypePausable" >Pausable</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<label id="wsName" className="form-check-label d-block mb-1">Upgradeability</label> |
|
|
|
<label id="wsName" className="form-check-label d-block mb-1">Upgradeability</label> |
|
|
|
<div onChange={(e) => handleUpgradeability(e)}> |
|
|
|
<div onChange={handleUpgradeability}> |
|
|
|
<div className="d-flex ml-2 custom-control custom-radio"> |
|
|
|
<div className="d-flex ml-2 custom-control custom-radio"> |
|
|
|
<input className="custom-control-input" type="radio" name="upgradeability" value="transparent" id="transparent" /> |
|
|
|
<input className="custom-control-input" type="radio" name="upgradeability" value="transparent" id="transparent" ref={transparentRadioRef} /> |
|
|
|
<label className="form-check-label custom-control-label" htmlFor="transparent" data-id="upgradeTypeTransparent" >Transparent</label> |
|
|
|
<label className="form-check-label custom-control-label" htmlFor="transparent" data-id="upgradeTypeTransparent" >Transparent</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="d-flex ml-2 custom-control custom-radio"> |
|
|
|
<div className="d-flex ml-2 custom-control custom-radio"> |
|
|
|
<input className="custom-control-input" type="radio" name="upgradeability" value="uups" id="uups" /> |
|
|
|
<input className="custom-control-input" type="radio" name="upgradeability" value="uups" id="uups" ref={uupsRadioRef} /> |
|
|
|
<label className="form-check-label custom-control-label" htmlFor="uups" data-id="upgradeTypeUups" >UUPS</label> |
|
|
|
<label className="form-check-label custom-control-label" htmlFor="uups" data-id="upgradeTypeUups" >UUPS</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|