Skip to content

Commit b418f83

Browse files
committed
topbar up and running
1 parent e34d0da commit b418f83

File tree

7 files changed

+98
-10
lines changed

7 files changed

+98
-10
lines changed

apps/remix-ide/src/app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ class AppComponent {
526526
const landingPage = new LandingPage(appManager, this.menuicons, fileManager, filePanel, contentImport)
527527
this.settings = new SettingsTab(Registry.getInstance().get('config').api, editor)//, appManager)
528528

529-
this.engine.register([this.menuicons, landingPage, this.hiddenPanel, this.sidePanel, this.statusBar, filePanel, pluginManagerComponent, this.settings, this.pinnedPanel, this.popupPanel])
529+
this.engine.register([this.menuicons, landingPage, this.hiddenPanel, this.sidePanel, this.statusBar, this.topBar, filePanel, pluginManagerComponent, this.settings, this.pinnedPanel, this.popupPanel])
530530

531531
// CONTENT VIEWS & DEFAULT PLUGINS
532532
const openZeppelinProxy = new OpenZeppelinProxy(blockchain)
@@ -603,7 +603,9 @@ class AppComponent {
603603
'pluginStateLogger',
604604
'matomo'
605605
])
606+
606607
await this.appManager.activatePlugin(['mainPanel', 'menuicons', 'tabs'])
608+
await this.appManager.activatePlugin(['topbar'])
607609
await this.appManager.activatePlugin(['statusBar'])
608610
await this.appManager.activatePlugin(['sidePanel']) // activating host plugin separately
609611
await this.appManager.activatePlugin(['pinnedPanel'])

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,10 @@ const RemixApp = (props: IRemixAppUi) => {
249249
{showEnterDialog && <EnterDialog handleUserChoice={(type) => handleUserChosenType(type)}></EnterDialog>}
250250
{showManagePreferencesDialog && <ManagePreferencesDialog savePreferencesFn={() => setShowEnterDialog(true)}></ManagePreferencesDialog>}
251251
<div className='d-flex flex-column'>
252+
<div className='top-bar'>
253+
{props.app.topBar.render()}
254+
</div>
252255
<div className={`remixIDE ${appReady ? '' : 'd-none'}`} data-id="remixIDE">
253-
<div className='top-bar'>
254-
{props.app.topBar.render()}
255-
<h1>Top Bar</h1>
256-
</div>
257256
<div id="icon-panel" data-id="remixIdeIconPanel" className="custom_icon_panel iconpanel bg-light">
258257
{props.app.menuicons.render()}
259258
</div>

libs/remix-ui/app/src/lib/remix-app/style/remix-app.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pre {
99
}
1010
.remixIDE {
1111
width : 100%;
12-
height : 100vh;
12+
height : 95vh;
1313
overflow : hidden;
1414
flex-direction : row;
1515
display : flex;
@@ -42,7 +42,7 @@ pre {
4242
}
4343

4444
.top-bar {
45-
45+
4646
}
4747
.pinnedpanel {
4848
width : 320px;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react'
2+
3+
interface BasicLogoProps {
4+
classList?: string
5+
solid?: boolean
6+
}
7+
8+
function BasicLogo({ classList = '', solid = true }: BasicLogoProps) {
9+
if (solid) {
10+
return (
11+
<svg id="Ebene_2" className={classList} data-name="Ebene 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 100">
12+
<path d="M91.84,35a.09.09,0,0,1-.1-.07,41,41,0,0,0-79.48,0,.09.09,0,0,1-.1.07C9.45,35,1,35.35,1,42.53c0,8.56,1,16,6,20.32,2.16,1.85,5.81,2.3,9.27,2.22a44.4,44.4,0,0,0,6.45-.68.09.09,0,0,0,.06-.15A34.81,34.81,0,0,1,17,45c0-.1,0-.21,0-.31a35,35,0,0,1,70,0c0,.1,0,.21,0,.31a34.81,34.81,0,0,1-5.78,19.24.09.09,0,0,0,.06.15,44.4,44.4,0,0,0,6.45.68c3.46.08,7.11-.37,9.27-2.22,5-4.27,6-11.76,6-20.32C103,35.35,94.55,35,91.84,35Z" />
13+
<path d="M52,74,25.4,65.13a.1.1,0,0,0-.1.17L51.93,91.93a.1.1,0,0,0,.14,0L78.7,65.3a.1.1,0,0,0-.1-.17L52,74A.06.06,0,0,1,52,74Z" />
14+
<path d="M75.68,46.9,82,45a.09.09,0,0,0,.08-.09,29.91,29.91,0,0,0-.87-6.94.11.11,0,0,0-.09-.08l-6.43-.58a.1.1,0,0,1-.06-.18l4.78-4.18a.13.13,0,0,0,0-.12,30.19,30.19,0,0,0-3.65-6.07.09.09,0,0,0-.11,0l-5.91,2a.1.1,0,0,1-.12-.14L72.19,23a.11.11,0,0,0,0-.12,29.86,29.86,0,0,0-5.84-4.13.09.09,0,0,0-.11,0l-4.47,4.13a.1.1,0,0,1-.17-.07l.09-6a.1.1,0,0,0-.07-.1,30.54,30.54,0,0,0-7-1.47.1.1,0,0,0-.1.07l-2.38,5.54a.1.1,0,0,1-.18,0l-2.37-5.54a.11.11,0,0,0-.11-.06,30,30,0,0,0-7,1.48.12.12,0,0,0-.07.1l.08,6.05a.09.09,0,0,1-.16.07L37.8,18.76a.11.11,0,0,0-.12,0,29.75,29.75,0,0,0-5.83,4.13.11.11,0,0,0,0,.12l2.59,5.6a.11.11,0,0,1-.13.14l-5.9-2a.11.11,0,0,0-.12,0,30.23,30.23,0,0,0-3.62,6.08.11.11,0,0,0,0,.12l4.79,4.19a.1.1,0,0,1-.06.17L23,37.91a.1.1,0,0,0-.09.07A29.9,29.9,0,0,0,22,44.92a.1.1,0,0,0,.07.1L28.4,47a.1.1,0,0,1,0,.18l-5.84,3.26a.16.16,0,0,0,0,.11,30.17,30.17,0,0,0,2.1,6.76c.32.71.67,1.4,1,2.08a.1.1,0,0,0,.06,0L52,68.16H52l26.34-8.78a.1.1,0,0,0,.06-.05,30.48,30.48,0,0,0,3.11-8.88.1.1,0,0,0-.05-.11l-5.83-3.26A.1.1,0,0,1,75.68,46.9Z" />
15+
</svg>
16+
)
17+
} else {
18+
return <img className="" src="assets/img/remix_logo_light.webp" style={{ height: '3rem' }} alt=""></img>
19+
}
20+
}
21+
22+
export default BasicLogo
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.remixui_homeIcon svg path {
2+
fill: var(--primary);
3+
}
4+
.remixui_homeIcon svg polygon {
5+
fill: var(--primary);
6+
}
Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,64 @@
1-
import React from 'react'
1+
/* eslint-disable @nrwl/nx/enforce-module-boundaries */
2+
import React, { useContext, useState } from 'react'
3+
import BasicLogo from '../components/BasicLogo'
4+
import '../css/topbar.css'
5+
import { Dropdown } from 'react-bootstrap'
6+
import { CustomToggle } from 'libs/remix-ui/helper/src/lib/components/custom-dropdown'
7+
import { WorkspaceMetadata } from 'libs/remix-ui/workspace/src/lib/types'
8+
import { platformContext } from 'libs/remix-ui/app/src/lib/remix-app/context/context'
9+
import { useIntl } from 'react-intl'
10+
import { FileSystemContext } from 'libs/remix-ui/workspace/src/lib/contexts'
211

312
export const RemixUiTopbar = () => {
4-
return <div className="display-1 text-danger">RemixUiTopbar</div>
13+
const intl = useIntl()
14+
const global = useContext(FileSystemContext)
15+
const [showDropdown, setShowDropdown] = useState(false)
16+
const [selectedWorkspace, setSelectedWorkspace] = useState<WorkspaceMetadata>(null)
17+
const platform = useContext(platformContext)
18+
const LOCALHOST = ' - connect to localhost - '
19+
const NO_WORKSPACE = ' - none - '
20+
const [currentWorkspace, setCurrentWorkspace] = useState<string>(NO_WORKSPACE)
21+
const [togglerText, setTogglerText] = useState<'Connecting' | 'Connected to Local FileSystem'>('Connecting')
22+
23+
const toggleDropdown = (isOpen: boolean) => {
24+
setShowDropdown(isOpen)
25+
}
26+
const formatNameForReadonly = (name: string) => {
27+
return global.fs.readonly ? name + ` (${intl.formatMessage({ id: 'filePanel.readOnly' })})` : name
28+
}
29+
30+
return (
31+
<section className="h-100 p-2 d-flex flex-row align-items-center justify-content-between bg-light border">
32+
<div className="d-flex flex-row align-items-center justify-content-between">
33+
<span className="d-flex align-items-center justify-content-between mr-3">
34+
<span style={{ width: '35px', height: '35px' }} className="remixui_homeIcon"><BasicLogo /></span>
35+
<span className="text-primary ml-2 font-weight-light text-uppercase" style={{ fontSize: '1.2rem' }}>Remix</span>
36+
</span>
37+
<span className="btn btn-sm border border-secondary text-secondary">v0.57.0</span>
38+
</div>
39+
<div>
40+
<Dropdown id="workspacesSelect" data-id="workspacesSelect" onToggle={toggleDropdown} show={showDropdown}>
41+
<Dropdown.Toggle
42+
as={CustomToggle}
43+
id="dropdown-custom-components"
44+
className="btn btn-light btn-block w-100 d-inline-block border border-dark form-control"
45+
icon={selectedWorkspace && selectedWorkspace.isGitRepo && !(currentWorkspace === LOCALHOST) ? 'far fa-code-branch' : null}
46+
>
47+
{selectedWorkspace ? selectedWorkspace.name === LOCALHOST ? togglerText : selectedWorkspace.name : currentWorkspace === LOCALHOST ? formatNameForReadonly('localhost') : NO_WORKSPACE}
48+
</Dropdown.Toggle>
49+
</Dropdown>
50+
</div>
51+
<div>
52+
<span>
53+
Connect to Github
54+
</span>
55+
<span>
56+
Theme
57+
</span>
58+
<span>
59+
Settings
60+
</span>
61+
</div>
62+
</section>
63+
)
564
}

libs/remix-ui/vertical-icons-panel/src/lib/remix-ui-vertical-icons-panel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const RemixUiVerticalIconsPanel = ({ verticalIconsPlugin, icons }: RemixUiVertic
8484
return (
8585
<div id="iconsP" className="h-100">
8686
<div className="remixui_icons d-flex flex-column remixui_icons_height" ref={iconPanelRef}>
87-
<Home verticalIconPlugin={verticalIconsPlugin} />
87+
{/* <Home verticalIconPlugin={verticalIconsPlugin} /> */}
8888
<div className={scrollableRef.current && scrollableRef.current.scrollHeight > scrollableRef.current.clientHeight ? 'remixui_default-icons-container remixui_requiredSection' : activateScroll && activateScroll.scrollState ? 'remixui_default-icons-container remixui_requiredSection' : 'remixui_requiredSection'}>
8989
<IconList theme={theme} icons={icons.filter((p) => p.isRequired && p.profile.name !== 'pluginManager')} verticalIconsPlugin={verticalIconsPlugin} itemContextAction={itemContextAction} />
9090
{scrollableRef.current && scrollableRef.current.scrollHeight > scrollableRef.current.clientHeight ? <Chevron direction="up" divElementRef={scrollableRef} cssRule={'fa fa-chevron-up remixui_icon-chevron my-0'} /> : null}

0 commit comments

Comments
 (0)