import React, { useCallback, useContext, useEffect, useState } from 'react'; import { ClientContext } from './contexts/clientProvider'; import { Container, Row, Col, ListGroup, Alert, Card } from 'react-bootstrap'; import { Project } from './core/project'; //Pages import ProjectDashboard from './components/dashboard/ProjectCenter'; import Ganache from './components/dashboard/Ganache'; import Scripts from './components/dashboard/Scripts'; import Imports from './components/dashboard/Imports'; //Background Pages import ViewPath from './components/dashboard/path/View'; import PathEditor from './components/dashboard/path/Editor'; //utils import { cutLongString, isProduction } from './utils/helpers'; /** * Just add below */ const Pages = { Project: ProjectDashboard, Ganache, Scripts, Imports, }; const BackgroundPages = { ViewPath, PathEditor, }; function Dashboard({ onHide }) { const client = useContext(ClientContext); const [selectedTab, setSelectedTab] = useState< keyof typeof Pages | keyof typeof BackgroundPages >('Project'); const [selectedProject, setSelectedProject] = useState( client.project ); const [Component, setComponent] = useState(null); const selectTab = useCallback( ( tab: keyof typeof Pages | keyof typeof BackgroundPages, props?: any ) => { //goto top of page window.scrollTo(0, 0); setComponent( React.createElement(Pages[tab] || BackgroundPages[tab], { project: selectedProject, selectTab: selectTab, ...(props || {}), }) ); setSelectedTab(tab as any); }, [selectedProject] ); useEffect(() => { selectTab('Project'); }, [selectTab]); return ( <> {client.loaded ? ( <>

Mint{' '} 1.18.0 4.0.0 (client)

Welcome to the InfinityMint Admin Dashboard!
You can click on a project to select it. You can load more projects by using the button below.
You can press Control-Q{' '} to hide/show this dashboard.
{Object.keys(client.projects).map( (key) => ( { await client.controller.loadProject( key ); setSelectedProject( client.projects[ key ] ); }} style={{ cursor: 'pointer', }} variant={ key.split( '@' )[0] === selectedProject.name ? 'success' : '' } > {cutLongString(key, 32)}{' '} { client.projects[ key ].source } ) )}


{client?.controller?.getCurrentAddress()}
{client?.controller ?.currentNetwork ?.name || 'Unknown Network'}
{client?.controller ?.currentNetwork ?.url || 'Unkown Network URL'}
Default Network{' '} { client?.controller ?.defaultNetwork } Default Project{' '} { client?.controller ?.defaultProject ?.projectFullName }
{Component && client.loaded ? ( <>{Component} ) : ( <> Component not found

The component {selectedTab} was not found.

)}
logo

0x0zAgency


This software is a work in progress! {' '}


Top Of Page
{ e.preventDefault(); window.open( 'https://github.com/0x0zAgency' ); }} > Github Org
{ e.preventDefault(); window.open( 'https://docs.infinitymint.app' ); }} > Documentation (InfinityConsole)
{ e.preventDefault(); window.open( 'https://0x0zagency.github.io/infinitymint-client/' ); }} > Documentation (Client)

) : null} ); } export default Dashboard;