-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
DataViews: add initial "Side by side" prototype #55343
Conversation
/> | ||
</div> | ||
</Page> | ||
) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this is part of the view component. Maybe a slot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a slot? Why it's not bundled in the view from the start ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it needs to be rendered into a separate Page component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so for me, it's either too early for this particular view to be implemented or we need to redesign it a bit. In the sense that instead of it being a separate page/frame, I think it should be within the same frame and just separated from the list with a light border: most applications that use this pattern do this (Mac OS notes app is the simplest example).
If it needs to breakout of the "Page" component, I think it introduces too much complexity that we don't need at this stage of development for a small outcome. It starts to raise the question of whether it's a "layout" or something else more global. (The layout being just the left sidebar)
cc @SaxonF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with it being a small outcome
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The space in between is just styling at the end of the day. The bigger reason it's separate is because there should be no "Pages" heading at the top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand Riad's concern. I too was looking at the whole picture in terms of:
- A consumer, like PagePages, provides view settings, actions, and a bunch of entity records.
- The rest is mostly left to DataViews: mostly rendering lists, but potentially rendering some details (for now) and doing other handling on the entity records.
- The consumer mostly reacts to changes in the high-level data (e.g. change query args for the entities).
I think the line between what is abstracted by DataViews and what is up for the consumer to handle is a line likely to change as we progress, but for now I also feel we should intentionally restrict our model. Ella, do you feel it's incompatible to have the Editor inside ViewSideBySide?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcsf I don't know how you see that work? This is the view component area? How do you fit in a preview?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than a slot, not sure what solutions you all have in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm not sure now. And Slot might be overkill.
Size Change: +253 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
I wanted to share my current mental modal for this one here:
So in pseudo code something like this: count [ selection, setSelection ] = useState( [ 1, 2 ] ); // Holds the currently selected items.
<Page>
<DataViews {...regularProps} selection={selection} onChangeSelection={setSelection} />
</Page>
{ selection.lenght === 1 && view.type = "list-v2" && ( <Page>
<Preview selection={selection} />
</Page> ) } |
b42a56e
to
5fcec1c
Compare
|
||
// To do: convert to view type registry. | ||
export const viewTypeSupportsMap = { | ||
list: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel we should rename this one "table" and the new one "list"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what you mean here. You named it list and grid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that makes some sense
- rename "list" to "table": totally on board; as we expand on the feature set of ViewList it will work and more more like a table
- rename "side-by-side" to "list": not as clear, but functionally the left-hand side is a list
@@ -117,6 +120,15 @@ export default function PagePages() { | |||
postType: page.type, | |||
canvas: 'edit', | |||
} } | |||
onClick={ ( event ) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be in the "fields" config IMO and also "fields" config shouldn't depend on local state here, it should only use things passed as props. This of this "render" function as the "edit" function of blocks. It might be defined in a very different file/package...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 😊
808a214
to
d95e570
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go :)
import Editor from '../editor'; | ||
import { useInitEditedEntity } from '../sync-state-with-url/use-init-edited-entity-from-url'; | ||
|
||
export default ( { postType, postId } ) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What can we name this component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed it to SideEditor
d95e570
to
3518722
Compare
3518722
to
c45bc91
Compare
Part of #55083
What?
Adds another view type called side by side, allowing you to preview the page.
To do:
Not sure about the naming btw. Side by side sounds like a comparison.
Why?
Mock up by @SaxonF
How?
We can reuse the
Editor
component.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast