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

Add: Site editor template mosaic view #33770

Closed
wants to merge 16 commits into from

Conversation

jorgefilipecosta
Copy link
Member

@jorgefilipecosta jorgefilipecosta commented Jul 29, 2021

Fixes: #20477

This PR implements the site editor mosaic view.
It implements most of the functionality described in the mockups shared by @jameskoster and tries to follow the design proposal.

Functionality:

  • View a grid of templates.
  • Clear customization of a template and revert to the theme default.
  • Delete a user template.
  • Batch select multiple templates and delete/revert them all.

I did not add yet all the functionality in mockups because in this PR because it is already big. Missing functionality is the following:

  • Add a new template.
  • Search.
  • Resize the size of the preview.

This PR adds the following high-level changes:

  • Implements an editor modes mechanism that is similar to edit post. The all templates view is just a mode. The code editor view will be another mode.
  • Extends the template REST endpoint to include the template author so we can show this information in the UI.
  • Implements a set of non-exposed UI components to accomplish the required UI.
  • Implements a custom slot that filters the available actions to just show the global styles toggle (the only sidebar that is allowed on the mosaic view).

How has this been tested?

Although the preview component itself is not working in the trunk and I'm debugging the issue/regression in parallel this PR itself could be reviewed, and I did the following tests :

  • I verified I can open the mosaic view of templates by pressing the "All templates" button on the site editor menu.
  • I verified a grid of templates appears (but the previews are empty because of an existing bug with the preview mechanism).
  • I verified I could see the theme as the author of templates coming from the team and the user name of the author for user-created templates (by using the three dots menu).
  • I verified I could delete user-created templates and revert back to theme templates with user changes (by using the three dots menu).
  • I verified that for templates coming from the theme without any user customization the checkbox is not enabled and the three dots menu is not available because no action is possible on these templates.
  • I verified I could select multiple templates using the checkbox and delete or revert them all.

@jorgefilipecosta jorgefilipecosta added [Feature] Full Site Editing [Type] Feature New feature to highlight in changelogs. [Package] Edit Site /packages/edit-site [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Jul 29, 2021
@github-actions
Copy link

github-actions bot commented Jul 29, 2021

Size Change: +3 kB (0%)

Total Size: 1.04 MB

Filename Size Change
build/block-editor/index.min.js 119 kB +134 B (0%)
build/block-library/blocks/button/style-rtl.css 600 B -5 B (-1%)
build/block-library/blocks/button/style.css 600 B -4 B (-1%)
build/block-library/blocks/embed/style-rtl.css 417 B +17 B (+4%)
build/block-library/blocks/embed/style.css 417 B +17 B (+4%)
build/block-library/blocks/heading/style-rtl.css 114 B +38 B (+50%) 🆘
build/block-library/blocks/heading/style.css 114 B +38 B (+50%) 🆘
build/block-library/blocks/list/style-rtl.css 94 B +31 B (+49%) 🚨
build/block-library/blocks/list/style.css 94 B +31 B (+49%) 🚨
build/block-library/blocks/navigation/editor-rtl.css 1.72 kB +18 B (+1%)
build/block-library/blocks/navigation/editor.css 1.72 kB +17 B (+1%)
build/block-library/blocks/navigation/style-rtl.css 1.42 kB -48 B (-3%)
build/block-library/blocks/navigation/style.css 1.41 kB -47 B (-3%)
build/block-library/blocks/paragraph/style-rtl.css 261 B +13 B (+5%) 🔍
build/block-library/blocks/paragraph/style.css 261 B +13 B (+5%) 🔍
build/block-library/blocks/pullquote/style-rtl.css 378 B +17 B (+5%) 🔍
build/block-library/blocks/pullquote/style.css 378 B +18 B (+5%) 🔍
build/block-library/blocks/quote/style-rtl.css 187 B +18 B (+11%) ⚠️
build/block-library/blocks/quote/style.css 187 B +18 B (+11%) ⚠️
build/block-library/editor-rtl.css 9.93 kB +16 B (0%)
build/block-library/editor.css 9.92 kB +15 B (0%)
build/block-library/index.min.js 150 kB -55 B (0%)
build/block-library/style-rtl.css 10.6 kB -13 B (0%)
build/block-library/style.css 10.6 kB -8 B (0%)
build/blocks/index.min.js 46.9 kB +55 B (0%)
build/components/index.min.js 209 kB +3 B (0%)
build/edit-navigation/index.min.js 13.6 kB +2 B (0%)
build/edit-post/index.min.js 28.9 kB +8 B (0%)
build/edit-site/index.min.js 28.3 kB +2.02 kB (+8%) 🔍
build/edit-site/style-rtl.css 5.38 kB +312 B (+6%) 🔍
build/edit-site/style.css 5.38 kB +311 B (+6%) 🔍
build/edit-widgets/index.min.js 16 kB -1 B (0%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 931 B
build/admin-manifest/index.min.js 1.09 kB
build/annotations/index.min.js 2.7 kB
build/api-fetch/index.min.js 2.19 kB
build/autop/index.min.js 2.08 kB
build/blob/index.min.js 459 B
build/block-directory/index.min.js 6.2 kB
build/block-directory/style-rtl.css 1.01 kB
build/block-directory/style.css 1.01 kB
build/block-editor/style-rtl.css 13.8 kB
build/block-editor/style.css 13.8 kB
build/block-library/blocks/archives/editor-rtl.css 61 B
build/block-library/blocks/archives/editor.css 60 B
build/block-library/blocks/archives/style-rtl.css 65 B
build/block-library/blocks/archives/style.css 65 B
build/block-library/blocks/audio/editor-rtl.css 58 B
build/block-library/blocks/audio/editor.css 58 B
build/block-library/blocks/audio/style-rtl.css 111 B
build/block-library/blocks/audio/style.css 111 B
build/block-library/blocks/audio/theme-rtl.css 125 B
build/block-library/blocks/audio/theme.css 125 B
build/block-library/blocks/block/editor-rtl.css 161 B
build/block-library/blocks/block/editor.css 161 B
build/block-library/blocks/button/editor-rtl.css 474 B
build/block-library/blocks/button/editor.css 474 B
build/block-library/blocks/buttons/editor-rtl.css 315 B
build/block-library/blocks/buttons/editor.css 315 B
build/block-library/blocks/buttons/style-rtl.css 370 B
build/block-library/blocks/buttons/style.css 370 B
build/block-library/blocks/calendar/style-rtl.css 207 B
build/block-library/blocks/calendar/style.css 207 B
build/block-library/blocks/categories/editor-rtl.css 84 B
build/block-library/blocks/categories/editor.css 83 B
build/block-library/blocks/categories/style-rtl.css 79 B
build/block-library/blocks/categories/style.css 79 B
build/block-library/blocks/code/style-rtl.css 90 B
build/block-library/blocks/code/style.css 90 B
build/block-library/blocks/code/theme-rtl.css 131 B
build/block-library/blocks/code/theme.css 131 B
build/block-library/blocks/columns/editor-rtl.css 194 B
build/block-library/blocks/columns/editor.css 193 B
build/block-library/blocks/columns/style-rtl.css 474 B
build/block-library/blocks/columns/style.css 475 B
build/block-library/blocks/cover/editor-rtl.css 666 B
build/block-library/blocks/cover/editor.css 670 B
build/block-library/blocks/cover/style-rtl.css 1.23 kB
build/block-library/blocks/cover/style.css 1.23 kB
build/block-library/blocks/embed/editor-rtl.css 488 B
build/block-library/blocks/embed/editor.css 488 B
build/block-library/blocks/embed/theme-rtl.css 124 B
build/block-library/blocks/embed/theme.css 124 B
build/block-library/blocks/file/editor-rtl.css 300 B
build/block-library/blocks/file/editor.css 300 B
build/block-library/blocks/file/style-rtl.css 255 B
build/block-library/blocks/file/style.css 255 B
build/block-library/blocks/file/view.min.js 322 B
build/block-library/blocks/freeform/editor-rtl.css 2.44 kB
build/block-library/blocks/freeform/editor.css 2.44 kB
build/block-library/blocks/gallery/editor-rtl.css 879 B
build/block-library/blocks/gallery/editor.css 876 B
build/block-library/blocks/gallery/style-rtl.css 1.61 kB
build/block-library/blocks/gallery/style.css 1.61 kB
build/block-library/blocks/gallery/theme-rtl.css 122 B
build/block-library/blocks/gallery/theme.css 122 B
build/block-library/blocks/group/editor-rtl.css 159 B
build/block-library/blocks/group/editor.css 159 B
build/block-library/blocks/group/style-rtl.css 57 B
build/block-library/blocks/group/style.css 57 B
build/block-library/blocks/group/theme-rtl.css 70 B
build/block-library/blocks/group/theme.css 70 B
build/block-library/blocks/home-link/style-rtl.css 247 B
build/block-library/blocks/home-link/style.css 247 B
build/block-library/blocks/html/editor-rtl.css 283 B
build/block-library/blocks/html/editor.css 284 B
build/block-library/blocks/image/editor-rtl.css 728 B
build/block-library/blocks/image/editor.css 728 B
build/block-library/blocks/image/style-rtl.css 482 B
build/block-library/blocks/image/style.css 487 B
build/block-library/blocks/image/theme-rtl.css 124 B
build/block-library/blocks/image/theme.css 124 B
build/block-library/blocks/latest-comments/style-rtl.css 284 B
build/block-library/blocks/latest-comments/style.css 284 B
build/block-library/blocks/latest-posts/editor-rtl.css 137 B
build/block-library/blocks/latest-posts/editor.css 137 B
build/block-library/blocks/latest-posts/style-rtl.css 528 B
build/block-library/blocks/latest-posts/style.css 527 B
build/block-library/blocks/media-text/editor-rtl.css 266 B
build/block-library/blocks/media-text/editor.css 263 B
build/block-library/blocks/media-text/style-rtl.css 488 B
build/block-library/blocks/media-text/style.css 485 B
build/block-library/blocks/more/editor-rtl.css 431 B
build/block-library/blocks/more/editor.css 431 B
build/block-library/blocks/navigation-link/editor-rtl.css 489 B
build/block-library/blocks/navigation-link/editor.css 488 B
build/block-library/blocks/navigation-link/style-rtl.css 94 B
build/block-library/blocks/navigation-link/style.css 94 B
build/block-library/blocks/navigation/view.min.js 2.52 kB
build/block-library/blocks/nextpage/editor-rtl.css 395 B
build/block-library/blocks/nextpage/editor.css 395 B
build/block-library/blocks/page-list/editor-rtl.css 310 B
build/block-library/blocks/page-list/editor.css 310 B
build/block-library/blocks/page-list/style-rtl.css 241 B
build/block-library/blocks/page-list/style.css 241 B
build/block-library/blocks/paragraph/editor-rtl.css 157 B
build/block-library/blocks/paragraph/editor.css 157 B
build/block-library/blocks/post-author/editor-rtl.css 210 B
build/block-library/blocks/post-author/editor.css 210 B
build/block-library/blocks/post-author/style-rtl.css 182 B
build/block-library/blocks/post-author/style.css 181 B
build/block-library/blocks/post-comments-form/style-rtl.css 140 B
build/block-library/blocks/post-comments-form/style.css 140 B
build/block-library/blocks/post-comments/style-rtl.css 360 B
build/block-library/blocks/post-comments/style.css 359 B
build/block-library/blocks/post-content/editor-rtl.css 138 B
build/block-library/blocks/post-content/editor.css 138 B
build/block-library/blocks/post-excerpt/editor-rtl.css 73 B
build/block-library/blocks/post-excerpt/editor.css 73 B
build/block-library/blocks/post-excerpt/style-rtl.css 69 B
build/block-library/blocks/post-excerpt/style.css 69 B
build/block-library/blocks/post-featured-image/editor-rtl.css 398 B
build/block-library/blocks/post-featured-image/editor.css 398 B
build/block-library/blocks/post-featured-image/style-rtl.css 143 B
build/block-library/blocks/post-featured-image/style.css 143 B
build/block-library/blocks/post-template/editor-rtl.css 99 B
build/block-library/blocks/post-template/editor.css 98 B
build/block-library/blocks/post-template/style-rtl.css 378 B
build/block-library/blocks/post-template/style.css 379 B
build/block-library/blocks/post-terms/style-rtl.css 73 B
build/block-library/blocks/post-terms/style.css 73 B
build/block-library/blocks/post-title/style-rtl.css 60 B
build/block-library/blocks/post-title/style.css 60 B
build/block-library/blocks/preformatted/style-rtl.css 103 B
build/block-library/blocks/preformatted/style.css 103 B
build/block-library/blocks/pullquote/editor-rtl.css 198 B
build/block-library/blocks/pullquote/editor.css 198 B
build/block-library/blocks/pullquote/theme-rtl.css 167 B
build/block-library/blocks/pullquote/theme.css 167 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B
build/block-library/blocks/query-pagination/editor-rtl.css 270 B
build/block-library/blocks/query-pagination/editor.css 262 B
build/block-library/blocks/query-pagination/style-rtl.css 168 B
build/block-library/blocks/query-pagination/style.css 168 B
build/block-library/blocks/query-title/editor-rtl.css 85 B
build/block-library/blocks/query-title/editor.css 85 B
build/block-library/blocks/query/editor-rtl.css 131 B
build/block-library/blocks/query/editor.css 132 B
build/block-library/blocks/quote/theme-rtl.css 220 B
build/block-library/blocks/quote/theme.css 222 B
build/block-library/blocks/rss/editor-rtl.css 202 B
build/block-library/blocks/rss/editor.css 204 B
build/block-library/blocks/rss/style-rtl.css 289 B
build/block-library/blocks/rss/style.css 288 B
build/block-library/blocks/search/editor-rtl.css 165 B
build/block-library/blocks/search/editor.css 165 B
build/block-library/blocks/search/style-rtl.css 374 B
build/block-library/blocks/search/style.css 375 B
build/block-library/blocks/search/theme-rtl.css 64 B
build/block-library/blocks/search/theme.css 64 B
build/block-library/blocks/separator/editor-rtl.css 99 B
build/block-library/blocks/separator/editor.css 99 B
build/block-library/blocks/separator/style-rtl.css 250 B
build/block-library/blocks/separator/style.css 250 B
build/block-library/blocks/separator/theme-rtl.css 172 B
build/block-library/blocks/separator/theme.css 172 B
build/block-library/blocks/shortcode/editor-rtl.css 474 B
build/block-library/blocks/shortcode/editor.css 474 B
build/block-library/blocks/site-logo/editor-rtl.css 462 B
build/block-library/blocks/site-logo/editor.css 464 B
build/block-library/blocks/site-logo/style-rtl.css 153 B
build/block-library/blocks/site-logo/style.css 153 B
build/block-library/blocks/site-tagline/editor-rtl.css 86 B
build/block-library/blocks/site-tagline/editor.css 86 B
build/block-library/blocks/site-title/editor-rtl.css 84 B
build/block-library/blocks/site-title/editor.css 84 B
build/block-library/blocks/social-link/editor-rtl.css 165 B
build/block-library/blocks/social-link/editor.css 165 B
build/block-library/blocks/social-links/editor-rtl.css 812 B
build/block-library/blocks/social-links/editor.css 811 B
build/block-library/blocks/social-links/style-rtl.css 1.33 kB
build/block-library/blocks/social-links/style.css 1.33 kB
build/block-library/blocks/spacer/editor-rtl.css 307 B
build/block-library/blocks/spacer/editor.css 307 B
build/block-library/blocks/spacer/style-rtl.css 48 B
build/block-library/blocks/spacer/style.css 48 B
build/block-library/blocks/table/editor-rtl.css 471 B
build/block-library/blocks/table/editor.css 472 B
build/block-library/blocks/table/style-rtl.css 481 B
build/block-library/blocks/table/style.css 481 B
build/block-library/blocks/table/theme-rtl.css 188 B
build/block-library/blocks/table/theme.css 188 B
build/block-library/blocks/tag-cloud/style-rtl.css 146 B
build/block-library/blocks/tag-cloud/style.css 146 B
build/block-library/blocks/template-part/editor-rtl.css 636 B
build/block-library/blocks/template-part/editor.css 635 B
build/block-library/blocks/template-part/theme-rtl.css 101 B
build/block-library/blocks/template-part/theme.css 101 B
build/block-library/blocks/term-description/editor-rtl.css 90 B
build/block-library/blocks/term-description/editor.css 90 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B
build/block-library/blocks/text-columns/editor.css 95 B
build/block-library/blocks/text-columns/style-rtl.css 166 B
build/block-library/blocks/text-columns/style.css 166 B
build/block-library/blocks/verse/style-rtl.css 87 B
build/block-library/blocks/verse/style.css 87 B
build/block-library/blocks/video/editor-rtl.css 571 B
build/block-library/blocks/video/editor.css 572 B
build/block-library/blocks/video/style-rtl.css 173 B
build/block-library/blocks/video/style.css 173 B
build/block-library/blocks/video/theme-rtl.css 124 B
build/block-library/blocks/video/theme.css 124 B
build/block-library/common-rtl.css 1.29 kB
build/block-library/common.css 1.29 kB
build/block-library/reset-rtl.css 527 B
build/block-library/reset.css 527 B
build/block-library/theme-rtl.css 658 B
build/block-library/theme.css 663 B
build/block-serialization-default-parser/index.min.js 1.09 kB
build/block-serialization-spec-parser/index.min.js 2.79 kB
build/components/style-rtl.css 15.8 kB
build/components/style.css 15.8 kB
build/compose/index.min.js 10.2 kB
build/core-data/index.min.js 12.4 kB
build/customize-widgets/index.min.js 11.1 kB
build/customize-widgets/style-rtl.css 1.5 kB
build/customize-widgets/style.css 1.49 kB
build/data-controls/index.min.js 614 B
build/data/index.min.js 7.1 kB
build/date/index.min.js 31.5 kB
build/deprecated/index.min.js 428 B
build/dom-ready/index.min.js 304 B
build/dom/index.min.js 4.53 kB
build/edit-navigation/style-rtl.css 3.14 kB
build/edit-navigation/style.css 3.14 kB
build/edit-post/classic-rtl.css 492 B
build/edit-post/classic.css 494 B
build/edit-post/style-rtl.css 7.2 kB
build/edit-post/style.css 7.19 kB
build/edit-widgets/style-rtl.css 4.06 kB
build/edit-widgets/style.css 4.06 kB
build/editor/index.min.js 37.6 kB
build/editor/style-rtl.css 3.74 kB
build/editor/style.css 3.73 kB
build/element/index.min.js 3.17 kB
build/escape-html/index.min.js 517 B
build/format-library/index.min.js 5.36 kB
build/format-library/style-rtl.css 668 B
build/format-library/style.css 669 B
build/hooks/index.min.js 1.55 kB
build/html-entities/index.min.js 424 B
build/i18n/index.min.js 3.6 kB
build/is-shallow-equal/index.min.js 501 B
build/keyboard-shortcuts/index.min.js 1.49 kB
build/keycodes/index.min.js 1.25 kB
build/list-reusable-blocks/index.min.js 1.85 kB
build/list-reusable-blocks/style-rtl.css 838 B
build/list-reusable-blocks/style.css 838 B
build/media-utils/index.min.js 2.88 kB
build/notices/index.min.js 845 B
build/nux/index.min.js 2.03 kB
build/nux/style-rtl.css 747 B
build/nux/style.css 743 B
build/plugins/index.min.js 1.83 kB
build/primitives/index.min.js 921 B
build/priority-queue/index.min.js 582 B
build/react-i18n/index.min.js 671 B
build/redux-routine/index.min.js 2.63 kB
build/reusable-blocks/index.min.js 2.28 kB
build/reusable-blocks/style-rtl.css 256 B
build/reusable-blocks/style.css 256 B
build/rich-text/index.min.js 10.6 kB
build/server-side-render/index.min.js 1.32 kB
build/shortcode/index.min.js 1.48 kB
build/token-list/index.min.js 562 B
build/url/index.min.js 1.74 kB
build/viewport/index.min.js 1.02 kB
build/warning/index.min.js 248 B
build/widgets/index.min.js 6.37 kB
build/widgets/style-rtl.css 1.05 kB
build/widgets/style.css 1.05 kB
build/wordcount/index.min.js 1.04 kB

compressed-size-action

@jorgefilipecosta jorgefilipecosta force-pushed the add/template-mosaic-view branch 2 times, most recently from baceed9 to 4bffa01 Compare July 30, 2021 18:36
@youknowriad
Copy link
Contributor

I verified a grid of templates appears (but the previews are empty because of an existing bug with the preview mechanism).

The previews are working for me, I guess you should update the description.

@youknowriad
Copy link
Contributor

Tries playing with this quickly and I have a few questions here:

  • When clicking "browse templates" (from the template title dropdown menu), the sidebar is opened first, should we go do mosaic directly?
  • I also wonder whether this view should replace the sidebar entirely. I understand that they work differently but they have the same goal: select a template to edit it (in addition to less important actions). For me, it's not great to have multiple UIs for the same thing, each has its pros and cons but having multiple UIs is more confusing in terms of flows. What's the current thinking there?

@youknowriad
Copy link
Contributor

Also, so we want a mosaic view for template parts as well?

@youknowriad
Copy link
Contributor

Some potential bugs:

  • I can't load the page in Firefox, I see a JS error
  • I can't click the "checkbox" (I'm testing on safari), so not sure if it's intended or not.

@jorgefilipecosta
Copy link
Member Author

The previews are working for me, I guess you should update the description.

Description updated 👍

@jorgefilipecosta
Copy link
Member Author

jorgefilipecosta commented Aug 13, 2021

When clicking "browse templates" (from the template title dropdown menu), the sidebar is opened first, should we go do mosaic directly?

I guess it makes sense that browse templates opens the mosaic view. I'm working on an update to do that.

Edited: It is implemented.

@jorgefilipecosta
Copy link
Member Author

jorgefilipecosta commented Aug 13, 2021

I can't click the "checkbox" (I'm testing on safari), so not sure if it's intended or not.

Hi @youknowriad,
The checkbox allows selecting a template to delete or revert it if the templates you are seeing don't have customizations the checkbox is disabled and the three dots menu is not available. I understand it may be confusing I will do an update where the checkbox does not appear at all.

Edited: It is implemented.

@jorgefilipecosta
Copy link
Member Author

I also wonder whether this view should replace the sidebar entirely. I understand that they work differently but they have the same goal: select a template to edit it (in addition to less important actions). For me, it's not great to have multiple UIs for the same thing, each has its pros and cons but having multiple UIs is more confusing in terms of flows. What's the current thinking there?

I think the plan was to have the sidebar and the mosaic view. But, this is a good UX question, maybe @jasmussen or @mtias have some insights on what we should do.

@jorgefilipecosta
Copy link
Member Author

Also, so we want a mosaic view for template parts as well?

It was not part of the mockups so I assume it is not something we want for now.

@jorgefilipecosta
Copy link
Member Author

I can't load the page in Firefox, I see a JS error

Hi @youknowriad, I tested this on Firefox and everything works without any error. What version of firefox are you using? Would you be able to share the stacktrace of the error?

@jorgefilipecosta jorgefilipecosta force-pushed the add/template-mosaic-view branch 2 times, most recently from 6187740 to ef1ed8e Compare August 13, 2021 16:37
@youknowriad
Copy link
Contributor

Hi @youknowriad, I tested this on Firefox and everything works without any error. What version of firefox are you using? Would you be able to share the stacktrace of the error?

This was independent of this PR and was already fixed in trunk.

@jorgefilipecosta jorgefilipecosta force-pushed the add/template-mosaic-view branch 2 times, most recently from 6ab9bb5 to 20b196f Compare August 13, 2021 18:54
@@ -79,6 +90,8 @@ export default function Header( {
listViewShortcut: getShortcutRepresentation(
'core/edit-site/toggle-list-view'
),
editorMode: getEditorMode(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm interested in whether it makes sense to conceptualize this as a "zoom" level that could range from focusing on a content to template to full template to mosaic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mtias, to me it seems a zoom concept makes sense. For the mosaic view, it seems a good fit but we would need to know how the zoom is going to be used for example to focus the content.
On the side editor, we can edit the content of a specific post but it seems we can not focus on the content and we always see the full site. Do you think we should implement a feature to focus the content of a post on the site editor (making it look almost equal to the post editor)?

@youknowriad
Copy link
Contributor

@jorgefilipecosta What do you need to move forward here? What is the MVP to land this (as I'm sure this will require iterations).

Maybe we could get some reviews from folks that worked on the site editor before @Copons @Addison-Stavlo @Mamaduka

Copy link
Contributor

@Addison-Stavlo Addison-Stavlo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really cool, thanks for working on this! The code looks good from a high level.

A few notes/Qs below in comments, beyond those a couple other things on my mind:

  • I would expect to be able to 'dismiss' the mosaic view and be back to where I left off in the editor, but I cannot find any way to go back/dismiss. If I open this and then determine it is not where I want to be, it seems that the only way to get back to the state I was previously at is to select the template I was previously editing from the mosaic view. However, there is also no indication of which template the editor was set to, therefore being able to 'go back' depends on me knowing the specific template I was on which may be a tall order for some users that find their way to this view.

  • I have no indications that clicking the preview will result in any action. I think the previews themselves need some hover styles for the pointer and border, to help indicate that a click will trigger some sort of action (loading that template in the editor and dismissing mosaic view).

  • It feels odd and bit fragmented that we have 2 systems for browsing templates, but the different entry points for browsing templates take us to different systems by default. I feel that "browse all templates" from the document dropdown in the header and "templates >" from the navigation sidebar should bring the user to the same place to create a cohesive experience. Whether that landing point is the nav sidebar view with a clear option to open mosaic view or the mosaic view itself if it serves to replace these bottom levels of the drill-down menu.

  • Somewhat related to the above (and you already noted this as a missing functionality in the description). Since these different entry points to browse all templates take us to different interfaces for doing so, those interfaces should really offer the same functionality. As it stands now, the nav sidebar is the only place where we can create a new template that does not yet exist via the "+" button at the templates level. If the "browse all templates" button isn't taking us to the nav panel and instead opens mosaic view, I would think mosaic view should also allow this functionality.

@jorgefilipecosta
Copy link
Member Author

Speaking of, global style changes don't appear to work, but I suppose that's an aspect to improve in the thumbnail component?

Hi @jasmussen, that was a bug and it is fixed 👍

@jorgefilipecosta
Copy link
Member Author

Do you think having a close button at the side of the global styles button would be enough?

Yeah, I think that would serve the purpose and seems like the standard place to look to dismiss this. 👍

The close button to exit the mosaic view was implemented.

@jorgefilipecosta
Copy link
Member Author

Hi @paaljoachim, thank you for your tests, and for sharing a video 👍

@shaunandrews is exploring ways to preview styles. #33933

Should we merge the exploration happening in this PR with the exploration that Shaun is doing? As they seem to have some parallel lines going on.

Yes, I think we can merge both PR's, the way to preview styles does not need to match the way we preview templates.

@jorgefilipecosta
Copy link
Member Author

Hi @jasmussen,
The proposed mockups have icons (e.g: for home etc). So I guess we should have icons for the home template, page, single post, 404, font page, archive, search, and then an icon that is used by all the general templates?
Are all these icons already decided and part of the WordPress icons package? If not I guess we can for now implement the icons for 2-3 cases where we already have icons available and then we iterate and add the remaining icons?

@jasmussen
Copy link
Contributor

Lots of good points, I'll dive in as best I can tomorrow my time. Just wanted to note that for any icons we need and that are missing from the library, I'm always happy to help. Though at this time my instinct is that we won't need an icon for every type, and that we can have a more generic "template" icon that applies to most of them. Home and blog pages are likely going to be the most important ones there.

@jasmussen
Copy link
Contributor

Good progress! This is what I see (and yes, it appears I need to fix some of my templates! 🙈 ):

hey

A few small things. Can we apply an overflow: hidden; inside the thumbnail preview so I don't see the tiny vertical scrollbar?

The focus style should have a 2px border radius ($radius-block-ui), and be 1.5px thick. This is what we've done for focus styles elsewhere:

	border-radius: $radius-block-ui;
	&:focus {
		box-shadow: inset 0 0 0 1px $white, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);

		// Windows High Contrast mode will show this outline, but not the box-shadow.
		outline: 2px solid transparent;
	}

the border close to the checkbox does not look good. But when we are not hoovering I think the checkbox looks good aligned with the preview. What do you think is the best way to address this issue?

Two things, I don't actually think we need any hover style at all on these. And if need be, we can make the focus style be outset a bit from the main item.

How does that sound?

@Addison-Stavlo
Copy link
Contributor

Addison-Stavlo commented Sep 3, 2021

I don't actually think we need any hover style at all on these.

Maybe I am mis-interpereting, but why would we not at least have a pointer cursor style on the actual preview with the click action? Every other clickable interface in the editor has a pointer cursor, from blocks in the inserters, to the buttons in the toolbar, the inline inserter button, input dropdowns, etc.

@jasmussen
Copy link
Contributor

Maybe I am mis-interpereting, but why would we not at least have a pointer cursor style on the actual preview with the click action?

Sorry, I was imprecise. Definitely need a pointer cursor — I just don't know that we need the blue border on hover.

@jameskoster
Copy link
Contributor

I've pushed some style adjustments.

Screenshot 2021-10-04 at 16 35 13

There are few changes I think we can consider in terms of functionality for this PR:

  1. When 'short' and 'tall' templates appear on the same row there is an awkward gap between the template and its name / description (see the Page template in the screenshot above). Could we somehow apply the background color from global styles to .block-editor-block-preview__container? Or just ensure all previews are the same height?
  2. The bulk actions can be a little confusing if for example you select a template that can be reverted and a template that can be deleted, then click delete. In this case only one template is deleted. It may take a little design exploration to get this UX right, so I'd propose leaving the bulk actions out of this PR for now.
  3. It's not obvious what the cross in the top right corner is for. If we're certain that we need a way to go back (I'm not 100% convinced), could we use the <- Back button from the template editor and the isolated template part view? At least that way we're being consistent.

There are a number of other things to get right such as providing a way to create a template from this view, searching, and enabling folks to personalise the number of columns on display. But since this PR already feels pretty big, we can probably do those separately?

@Addison-Stavlo
Copy link
Contributor

But since this PR already feels pretty big, we can probably do those separately?

Yeah, I think the idea was to leave those as a follow-up since this has already gotten so large.

If we're certain that we need a way to go back (I'm not 100% convinced)

Suppose you are user that opens this interface for the first time or by accident. Once it loads, you immediately know that you don't want to do anything here and want to go back to where you were previously. However, you also don't remember exactly which template you were editing, so selecting it out of the list is not an option. Without some sort of back button/dismissal, how do you propose the user gets back to their normal flow in a reasonable manner?

@shaunandrews
Copy link
Contributor

I wonder if it would be possible to align the bottom of the templates and avoid having a background color in a forced-height preview?

image

@jameskoster
Copy link
Contributor

@Addison-Stavlo In flows that are primarily two-way having an escape hatch like this makes a lot of sense (the "<- Back to notifications" button on github is a good example :D). But I'm not sure that our design should account for accidental / uncommon flows. Otherwise we'd need back buttons on every unique view 🙈

Thinking about it this way, perhaps it makes more sense to support a native navigational pattern than 100% of users will be familiar with: the browser back button. So if you're editing template A, then view all templates, clicking the back button will take you back to editing template A.

I wonder if it would be possible to align the bottom of the templates and avoid having a background color in a forced-height preview?

I'll see if I can figure out how to do that with css grid and push an update.

@jameskoster
Copy link
Contributor

I think this feels a bit better. It may still be worth seeing an iteration with same-height templates though.

I moved the description to the popover which tidies things up a bit and will stop templates with long descriptions disrupting the layout too much.

Screenshot 2021-10-05 at 12 30 42

Obviously some styling polish is still required, as is the removal the bulk action functionality.

@Addison-Stavlo
Copy link
Contributor

Im really liking the look of the bottom-aligned templates.

Note - kayboard nav for a11y is a bit rough in the current iteration. I can't seem to get access to anything in the interface other than the ellipsis menus.

Thinking about it this way, perhaps it makes more sense to support a native navigational pattern than 100% of users will be familiar with: the browser back button.

I think if we wanted to do something like that, we would need to make that a consistent behavior throughout all of Gutenberg's flows. That may be quite the task. In the meantime, "x" and "<" icons are widely used throughout the plugin to close, dismiss, and go back and don't take up much real estate on the screen.

@jameskoster
Copy link
Contributor

If we wanted to force each thumbnail to be the same height, another option to fill the empty space could be the 'transparent' texture that we often see in design software:

Screenshot 2021-10-06 at 19 07 37

@jorgefilipecosta
Copy link
Member Author

Closing the PR as there is no work currently happening on it, and we are not sure if we are going to have a mosaic view or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") Needs Design Feedback Needs general design feedback. [Package] Edit Site /packages/edit-site [Type] Feature New feature to highlight in changelogs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mosaic View of Theme Templates
8 participants