File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
apps/remix-ide/src/app/components
libs/remix-ui/app/src/lib/remix-app Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,19 @@ export class RightSidePanel extends AbstractPanel {
3939 }
4040 } )
4141
42+ // Initialize isHidden state from localStorage
4243 const rightSidePanelState = window . localStorage . getItem ( 'rightSidePanelState' )
43- if ( ! rightSidePanelState ) window . localStorage . setItem ( 'rightSidePanelState' , JSON . stringify ( { } ) )
44+ if ( rightSidePanelState ) {
45+ try {
46+ const state = JSON . parse ( rightSidePanelState )
47+ this . isHidden = state . isHidden || false
48+ } catch ( e ) {
49+ this . isHidden = false
50+ }
51+ } else {
52+ this . isHidden = false
53+ window . localStorage . setItem ( 'rightSidePanelState' , JSON . stringify ( { } ) )
54+ }
4455 }
4556
4657 async pinView ( profile , view ) {
@@ -114,6 +125,14 @@ export class RightSidePanel extends AbstractPanel {
114125 this . emit ( 'rightSidePanelHidden' )
115126 this . events . emit ( 'rightSidePanelHidden' )
116127 }
128+ // Persist the hidden state to localStorage
129+ const activePlugin = this . currentFocus ( )
130+ if ( activePlugin && this . plugins [ activePlugin ] ) {
131+ const profile = this . plugins [ activePlugin ] . profile
132+ window . localStorage . setItem ( 'rightSidePanelState' , JSON . stringify ( { pluginProfile : profile , isHidden : this . isHidden } ) )
133+ }
134+ // Re-render to update the toggle icon
135+ this . renderComponent ( )
117136 }
118137
119138 isPanelHidden ( ) {
Original file line number Diff line number Diff line change @@ -152,6 +152,14 @@ const RemixApp = (props: IRemixAppUi) => {
152152 props . app . rightSidePanel . events . on ( 'pinnedPlugin' , ( profile , isHidden ) => {
153153 if ( ! isHidden ) setHidePinnedPanel ( false )
154154 } )
155+
156+ props . app . rightSidePanel . events . on ( 'rightSidePanelShown' , ( ) => {
157+ setHidePinnedPanel ( false )
158+ } )
159+
160+ props . app . rightSidePanel . events . on ( 'rightSidePanelHidden' , ( ) => {
161+ setHidePinnedPanel ( true )
162+ } )
155163 }
156164
157165 setInterval ( ( ) => {
You can’t perform that action at this time.
0 commit comments