Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug to maximise plugin side panel #5012

Merged
merged 4 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions apps/remix-ide/src/app/panels/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class Layout extends Plugin {
maximised: { [key: string]: boolean }
constructor () {
super(profile)
this.maximised = {}
this.maximised = {
'dgit': true
}
this.event = new EventEmitter()
}

Expand Down Expand Up @@ -65,7 +67,6 @@ export class Layout extends Plugin {
this.event.emit('change', null)
})
this.on('tabs', 'openDiff', () => {
console.log('openDiff')
this.panels.editor.active = true
this.panels.main.active = false
this.event.emit('change', null)
Expand Down Expand Up @@ -126,15 +127,15 @@ export class Layout extends Plugin {
}

async maximiseSidePanel () {
this.event.emit('maximisesidepanel')
const current = await this.call('sidePanel', 'currentFocus')
this.maximised[current] = true
this.event.emit('maximisesidepanel')
}

async maximisePinnedPanel () {
this.event.emit('maximisepinnedpanel')
const current = await this.call('pinnedPanel', 'currentFocus')
this.maximised[current] = true
this.event.emit('maximisepinnedpanel')
}

async maximizeTerminal() {
Expand All @@ -144,14 +145,14 @@ export class Layout extends Plugin {
}

async resetSidePanel () {
this.event.emit('resetsidepanel')
const current = await this.call('sidePanel', 'currentFocus')
this.maximised[current] = false
this.event.emit('resetsidepanel')
}

async resetPinnedPanel () {
this.event.emit('resetpinnedpanel')
const current = await this.call('pinnedPanel', 'currentFocus')
this.maximised[current] = false
this.event.emit('resetpinnedpanel')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const DragBar = (props: IRemixDragBarUi) => {
}, [props.hidden, offset])

useEffect(() => {
initialWidth.current = props.refObject.current.clientWidth
if (props.maximiseTrigger > 0) {
if (props.layoutPosition === 'left') {
const width = 0.4 * window.innerWidth
Expand Down Expand Up @@ -106,6 +105,7 @@ const DragBar = (props: IRemixDragBarUi) => {
setTimeout(() => {
props.setHideStatus(false)
setDragBarPosX(offset + props.refObject.current.offsetWidth)
initialWidth.current = props.refObject.current.clientWidth
}, 300)
}
} else if (props.layoutPosition === 'right') {
Expand All @@ -117,9 +117,11 @@ const DragBar = (props: IRemixDragBarUi) => {
setTimeout(() => {
props.setHideStatus(false)
setDragBarPosX(props.refObject.current.offsetLeft)
initialWidth.current = props.refObject.current.clientWidth
}, 300)
}
}

}

function startDrag() {
Expand Down
1 change: 0 additions & 1 deletion libs/remix-ui/git/src/lib/gitactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,5 @@ export const clearGitLog = async () => {
}

export const setStorage = async (storage: storage) => {
console.log(storage)
dispatch(setStoragePayload(storage))
}
17 changes: 0 additions & 17 deletions libs/remix-ui/git/src/lib/listeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,6 @@ export const setCallBacks = (viewPlugin: Plugin, gitDispatcher: React.Dispatch<g
setAtivePanel(panelNumber)
})

plugin.on('sidePanel', 'focusChanged', async (name: string) => {
const pinnedPlugin = await plugin.call('pinnedPanel', 'currentFocus')
if (name == 'dgit') {
if (pinnedPlugin === 'dgit') {
plugin.call('layout', 'maximisePinnedPanel')
} else {
plugin.call('layout', 'maximiseSidePanel')
}
} else {
if (pinnedPlugin === 'dgit') {
plugin.call('layout', 'resetPinnedPanel')
} else {
plugin.call('layout', 'resetSidePanel')
}
}
})

callBackEnabled = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export function RemixUIStatusBar({ statusBarPlugin }: RemixUIStatusBarProps) {
mainAxis: true, padding: 10
}), size({
apply({ availableWidth, availableHeight, elements, ...state }) {
console.log(state)
Object.assign(elements.floating.style, {
maxWidth: `${availableWidth}`,
maxHeight: `auto`
Expand Down
Loading