Skip to content

Commit b976769

Browse files
author
ci-bot
committed
contract file changes
1 parent ef98b46 commit b976769

File tree

7 files changed

+48
-15
lines changed

7 files changed

+48
-15
lines changed

apps/remix-ide/src/app.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ class AppComponent {
464464
scriptRunnerUI,
465465
remixAI,
466466
remixAiAssistant,
467-
templateExplorerModal,
467+
// templateExplorerModal,
468468
walletConnect
469469
])
470470

@@ -577,6 +577,7 @@ class AppComponent {
577577
openZeppelinProxy,
578578
run.recorder
579579
])
580+
this.engine.register([templateExplorerModal])
580581

581582
this.layout.panels = {
582583
tabs: { plugin: tabProxy, active: true },

apps/remix-ide/src/app/components/status-bar.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,17 @@ export class StatusBar extends Plugin<any, CustomRemixApi> implements StatusBarI
8181
this.on('settings', 'copilotChoiceChanged', (isAiActive: boolean) => {
8282
this.isAiActive = isAiActive
8383
})
84+
85+
this.checkTemplateExplorerModal()
8486
this.renderComponent()
8587
}
8688

89+
async checkTemplateExplorerModal() {
90+
const check = await this.call('manager', 'isActive', 'templateexplorermodal')
91+
if (!check) await this.call('manager', 'activatePlugin', 'templateexplorermodal')
92+
console.log('check complete and template explorer modal is active')
93+
}
94+
8795
setDispatch(dispatch: React.Dispatch<any>) {
8896
this.dispatch = dispatch
8997
}

apps/remix-ide/src/app/components/top-bar.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@ import { UpdateInfo } from 'libs/remix-ui/home-tab/src/lib/components/types/caro
1515
import { GitPlugin } from '../plugins/git'
1616
import { createWorkspace, deleteWorkspace, getWorkspaces, renameWorkspace, WorkspaceType } from 'libs/remix-ui/workspace/src/lib/actions'
1717
import { Registry } from '@remix-project/remix-lib'
18+
import { ViewPlugin } from '@remixproject/engine-web'
1819

1920
const TopBarProfile = {
2021
name: 'topbar',
2122
displayName: 'Top Bar',
2223
description: '',
2324
version: packageJson.version,
2425
icon: '',
26+
location: 'mainPanel',
2527
methods: ['getWorkspaces', 'createWorkspace', 'renameWorkspace', 'deleteWorkspace', 'getCurrentWorkspace', 'setWorkspace'],
2628
events: ['setWorkspace', 'workspaceRenamed', 'workspaceDeleted', 'workspaceCreated'],
2729
}
2830

29-
export class Topbar extends Plugin {
31+
export class Topbar extends ViewPlugin {
3032
dispatch: React.Dispatch<any> = () => { }
3133
appStateDispatch: React.Dispatch<AppAction> = () => { }
3234
htmlElement: HTMLDivElement

apps/remix-ide/src/app/plugins/remix-template-explorer-modal.tsx

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,25 @@ import { PluginViewWrapper } from '@remix-ui/helper'
55
import { Plugin } from '@remixproject/engine'
66
import { EventEmitter } from 'events'
77
import { ThemeModule } from '../tabs/theme-module'
8+
import * as packageJson from '../../../../../package.json'
89
import { TemplateExplorerProvider } from 'libs/remix-ui/template-explorer-modal/context/template-explorer-context'
10+
import { ViewPlugin } from '@remixproject/engine-web'
911

1012
const pluginProfile = {
11-
name: 'remix-template-explorer-modal',
12-
displayName: 'Remix Generic Modal',
13-
description: 'Remix Generic Modal for every type of content meant for a modal',
14-
methods: ['openModal']
13+
name: 'templateexplorermodal',
14+
displayName: 'Template Explorer Modal',
15+
description: 'Template Explorer Modal',
16+
methods: ['openModal'],
17+
events: [],
18+
maintainedBy: 'Remix',
19+
kind: 'templateexplorermodal',
20+
location: 'mainPanel',
21+
version: packageJson.version,
22+
permission: true,
23+
documentation: 'https://remix-ide.readthedocs.io/en/latest/template-explorer-modal.html'
1524
}
1625

17-
export class TemplateExplorerModalPlugin extends Plugin {
26+
export class TemplateExplorerModalPlugin extends ViewPlugin {
1827
element: HTMLDivElement
1928
dispatch: React.Dispatch<any> = () => { }
2029
event: any
@@ -30,13 +39,18 @@ export class TemplateExplorerModalPlugin extends Plugin {
3039
}
3140

3241
async onActivation(): Promise<void> {
42+
console.trace()
3343
this.on('theme', 'themeChanged', (theme: any) => {
3444
this.theme = theme
3545
})
3646
}
3747

48+
openModal() {
49+
console.log('This is openModal')
50+
}
51+
3852
onDeactivation(): void {
39-
this.element.remove()
53+
4054
}
4155

4256
setDispatch(dispatch: React.Dispatch<any>) {
@@ -58,13 +72,14 @@ export class TemplateExplorerModalPlugin extends Plugin {
5872

5973
renderComponent(): void {
6074
this.dispatch({
61-
plugins: this,
75+
...this
6276
})
6377
}
6478

65-
updateComponent() {
79+
updateComponent(state: any) {
80+
console.log('what is state', state)
6681
return (
67-
<TemplateExplorerProvider plugin={this} />
82+
<TemplateExplorerProvider plugin={state} />
6883
)
6984
}
7085
}

libs/remix-ui/app/src/lib/remix-app/remix-app.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const RemixApp = (props: IRemixAppUi) => {
5555
cancelFn: () => { },
5656
width: '720px',
5757
height: '720px',
58-
showModal: true
58+
showModal: false
5959
}
6060
})
6161

@@ -228,7 +228,8 @@ const RemixApp = (props: IRemixAppUi) => {
228228
<AppDialogs></AppDialogs>
229229
<DialogViewPlugin></DialogViewPlugin>
230230
{appState.genericModalState.showModal &&
231-
<TemplateExplorerProvider plugin={props.app.templateExplorerModal}></TemplateExplorerProvider>
231+
// <TemplateExplorerProvider plugin={props.app.templateExplorerModal}></TemplateExplorerProvider>
232+
props.app.templateExplorerModal.render()
232233
}
233234
</AppProvider>
234235
</onLineContext.Provider>

libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
8383
})
8484
}
8585

86-
function openGenericModal(event): void {
86+
async function openGenericModal(event): Promise<void> {
8787
appContext.appStateDispatch({
8888
type: appActionTypes.showGenericModal,
8989
payload: true

libs/remix-ui/template-explorer-modal/src/lib/remix-ui-template-explorer-modal.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function RemixUiTemplateExplorerModal (props: RemixUiTemplateExplorerModa
2525
<section className="template-explorer-modal-background" style={{ zIndex: 8888 }}>
2626
<div className="template-explorer-modal-container border bg-dark p-2" style={{ width: props.appState.genericModalState.width, height: props.appState.genericModalState.height }}>
2727
<div className="template-explorer-modal-close-container bg-dark mb-3 w-100 d-flex flex-row justify-content-between align-items-center">
28-
{state.wizardStep === 'template' ? <div className="d-flex flex-row gap-2 w-100 mx-3 my-2">
28+
{state.wizardStep === 'template' || state.wizardStep === 'reset' ? <div className="d-flex flex-row gap-2 w-100 mx-3 my-2">
2929
<input
3030
type="text"
3131
placeholder="Search"
@@ -49,6 +49,12 @@ export function RemixUiTemplateExplorerModal (props: RemixUiTemplateExplorerModa
4949
<button className="template-explorer-modal-close-button" onClick={() => props.dispatch({ type: appActionTypes.showGenericModal, payload: false })}>
5050
<i className="fa-solid fa-xmark text-dark"></i>
5151
</button>
52+
<button className="template-explorer-modal-close-button" onClick={async () => {
53+
const result = await props.plugin.call('remix-templates', 'getTemplate', 'remixDefault')
54+
console.log('what is result', result)
55+
}}>
56+
<i className="fa-solid fa-plus text-dark"></i>
57+
</button>
5258
</div>
5359
{state.wizardStep === 'template' || state.wizardStep === 'reset' ? <TemplateExplorerBody plugin={props.plugin} /> : null}
5460
{state.wizardStep === 'generic' ? <GenericWorkspaceTemplate /> : null}

0 commit comments

Comments
 (0)