Skip to content

Commit

Permalink
fix display order
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Dec 7, 2023
1 parent 784420c commit 9f204de
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 31 deletions.
8 changes: 5 additions & 3 deletions apps/remix-ide/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ class AppComponent {
'remix.ethereum.org': 23,
'6fd22d6fe5549ad4c4d8fd3ca0b7816b.mod': 35 // remix desktop
}
this.showMatamo = true /*matomoDomains[window.location.hostname]*/ && !Registry.getInstance().get('config').api.exists('settings/matomo-analytics')
this.showEnter = !this.showMatamo && !localStorage.getItem('hadUsageTypeAsked')

this.walkthroughService = new WalkthroughService(appManager, !this.showMatamo || !this.showEnter)
this.matomoConfAlreadySet = Registry.getInstance().get('config').api.exists('settings/matomo-analytics')
this.matomoCurrentSetting = Registry.getInstance().get('config').api.get('settings/matomo-analytics')
this.showMatamo = matomoDomains[window.location.hostname] && !this.matomoConfAlreadySet

this.walkthroughService = new WalkthroughService(appManager)

const hosts = ['127.0.0.1:8080', '192.168.0.101:8080', 'localhost:8080']
// workaround for Electron support
Expand Down
15 changes: 1 addition & 14 deletions apps/remix-ide/src/walkthroughService.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,8 @@ const profile = {
}

export class WalkthroughService extends Plugin {
constructor (appManager, showWalkthrough) {
constructor (appManager) {
super(profile)
/*let readyToStart = 0;
appManager.event.on('activate', (plugin) => {
if (plugin.name === 'udapp') readyToStart++
if (readyToStart == 2 && showWalkthrough) {
this.start()
}
})
appManager.event.on('activate', (plugin) => {
if (plugin.name === 'solidity') readyToStart++
if (readyToStart == 2 && showWalkthrough) {
this.start()
}
})*/
}

startRecorderW () {
Expand Down
12 changes: 2 additions & 10 deletions libs/remix-ui/app/src/lib/remix-app/components/modals/enter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,17 @@ import {UsageTypes} from '../../types'
import { type } from 'os'

interface EnterDialogProps {
show: boolean,
handleUserChoice: (userChoice: UsageTypes) => void,
}

const EnterDialog = (props: EnterDialogProps) => {
const [visibility, setVisibility] = useState<boolean>(false)
const {showEnter} = useContext(AppContext)

useEffect(() => {
setVisibility(props.show)
console.log("useeff vis in enter", props.show, " showEnter ", showEnter)
}, [props.show])
const [visibility, setVisibility] = useState<boolean>(true)

const enterAs = async (uType) => {
props.handleUserChoice(uType)
}

const modalClass = (visibility && showEnter) ? "d-flex" : "d-none"
console.log("enterDialog class ", modalClass)
const modalClass = visibility ? "d-flex" : "d-none"
return (
<div
data-id={`EnterModalDialogContainer-react`}
Expand Down
18 changes: 14 additions & 4 deletions libs/remix-ui/app/src/lib/remix-app/remix-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,18 @@ const RemixApp = (props: IRemixAppUi) => {
activateApp()
}
const hadUsageTypeAsked = localStorage.getItem('hadUsageTypeAsked')
setShowEnterDialog(!hadUsageTypeAsked)
if (props.app.showMatamo) {
// if matomo dialog is displayed, it will take care of calling "setShowEnterDialog",
// if the user approves matomo tracking.
// so "showEnterDialog" stays false
} else {
// if matomo dialog isn't displayed, we show the "enter dialog" only if:
// - it wasn't already set
// - (and) if user has given consent
if (!hadUsageTypeAsked && props.app.matomoCurrentSetting) {
setShowEnterDialog(true)
}
}
}, [])

function setListeners() {
Expand Down Expand Up @@ -87,7 +98,6 @@ const RemixApp = (props: IRemixAppUi) => {
const value = {
settings: props.app.settings,
showMatamo: props.app.showMatamo,
showEnter: props.app.showEnter,
appManager: props.app.appManager,
modal: props.app.notification,
layout: props.app.layout
Expand Down Expand Up @@ -135,8 +145,8 @@ const RemixApp = (props: IRemixAppUi) => {
<IntlProvider locale={locale.code} messages={locale.messages}>
<AppProvider value={value}>
<OriginWarning></OriginWarning>
<MatomoDialog hide={!appReady} okFn={() => {console.log("ok"); setShowEnterDialog(true)}}></MatomoDialog>
<EnterDialog show={showEnterDialog} handleUserChoice={(type) => handleUserChosenType(type)}></EnterDialog>
<MatomoDialog hide={!appReady} okFn={() => setShowEnterDialog(true)}></MatomoDialog>
{showEnterDialog && <EnterDialog handleUserChoice={(type) => handleUserChosenType(type)}></EnterDialog>}
<div className={`remixIDE ${appReady ? '' : 'd-none'}`} data-id="remixIDE">
<div id="icon-panel" data-id="remixIdeIconPanel" className="custom_icon_panel iconpanel bg-light">
{props.app.menuicons.render()}
Expand Down

0 comments on commit 9f204de

Please sign in to comment.