writer-framework icon indicating copy to clipboard operation
writer-framework copied to clipboard

Custom Sidebar is not put in the sidebarContainer slot

Open ZBMO opened this issue 1 year ago • 5 comments

functions for :component-filter check if the c.type == 'sidebar' or c.type != 'sidebar'.
The result is that a custom sidebar isn't placed in the appropriate slot (having its type prepended with 'custom_') and is arranged on the page the other layout components.

a fix would be to change the equality checks on lines 6 and 19 of CorePage.vue to use .includes() instead of ==. I would like to make a PR for this

image

ZBMO avatar Feb 01 '24 04:02 ZBMO

Good find, thanks for sharing! I didn't contemplate people might want to develop their own sidebars. This is a limitation that shouldn't exist.

To be honest, the mechanism is a bit hacky as it is, and I think partially matching the string "sidebar" would be even hackier.

I'd prefer having something that tells the Page where to put it, whether it's the core Sidebar or a custom component. I'm thinking an additional attribute in the StreamsyncComponentDefinition (in streamsyncTypes.ts)...

export type StreamsyncComponentDefinition = {
	[...]
	insertionArea?: "default" | "sidebar";
};

I believe this is cleaner and would allow us to develop e.g. "footer" or "topbar" in the future, without breaking anything.

Feel free to send a PR; it'd be appreciated. Should still be quite straightforward I believe. Apart from that change in type as shown above, I think it'd just be checking whether the component is c.insertionArea == "sidebar" or not in CorePage.vue. Please let me know your thoughts.

ramedina86 avatar Feb 02 '24 20:02 ramedina86

Hi @ZBMO , can you please confirm whether you want to work on this PR? Otherwise we're happy to take it ourselves

ramedina86 avatar Feb 05 '24 16:02 ramedina86

@ramedina86 sorry for the delay, I'd like to but I won't be able to work on it till next week. I understand if you need it done sooner.

ZBMO avatar Feb 07 '24 15:02 ZBMO

@ZBMO no worries at all, next week is fine. And of course no pressure, just want to avoid two people working on it at the same time.

ramedina86 avatar Feb 07 '24 15:02 ramedina86

@raaymax please take care of this which will also help address the complexities around reusing positionless components

ramedina86 avatar Mar 12 '24 16:03 ramedina86