iway1 / trpc-panel

MIT License
627 stars 43 forks source link

feature request: toggle viewing sidebar/minimap #57

Closed SeanCassiere closed 1 year ago

SeanCassiere commented 1 year ago

Nothing too crazy, just want to toggle the sidebar/minimap shown on the left for two reasons:

  1. I don't really use it.
  2. When procedure names are long the layout tends to shift drastically. (please see screenshots below)

image image

iway1 commented 1 year ago

This would be cool, open to PRs

SeanCassiere commented 1 year ago

@iway1 Sounds good.

Got any preferences as to the design and where you'd want the toggle button to go? Because looking at the code, you've clearly thought about this functionality in your existing implementation and simply just added it in yet.

SeanCassiere commented 1 year ago

Currently, in dev, I'm simply reusing the Chevron in the TopBar to toggle the state of the sidebar.

image image

Note:

Branch: https://github.com/SeanCassiere/trpc-panel/tree/SeanCassiere/feat-add-sidebar-toggle-func

iway1 commented 1 year ago

@SeanCassiere Nice yeah I think that looks good.

Persistence would be nice to have I think but not totally necessary. I'm wondering whether people are going to want to open and close it frequently, do you think you would or just leave it closed all the time?

SeanCassiere commented 1 year ago

@iway1 Personally for me (regarding persistence), as I like having descriptive procedure names in my routers, I'd probably always close the minimap on launch.

If you are fine with it, I could add a stripped-down version of this useLocalStorage hook for persistence, using a key like trpc-panel.show-minimap. Therefore, default is still open, but once you click it starts using the persisted value.