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

[RNMobile] Add OfflineStatus component to display network connectivity #56627

Closed
wants to merge 85 commits into from

Conversation

derekblank
Copy link
Member

@derekblank derekblank commented Nov 29, 2023

What?

Adds a mobile component to display a visual indicator when working offline within the mobile editor. (Note: the functionality to subscribe to network status will be handled in a separate PR.)

Why?

Overall, to improve the user's experience when uploading media.

Addresses:

How?

Adds OfflineStatus component and updates Layout component to host it.

Testing Instructions

Applying the test patch will display the component statically until it is wired to the connectivity subscription hook proposed in #56609.

Test Diff
diff --git a/packages/block-editor/src/components/block-list/index.native.js b/packages/block-editor/src/components/block-list/index.native.js
index 810e23e4c1..b4d69aa7c7 100644
--- a/packages/block-editor/src/components/block-list/index.native.js
+++ b/packages/block-editor/src/components/block-list/index.native.js
@@ -30,6 +30,7 @@ import {
 import { BlockDraggableWrapper } from '../block-draggable';
 import { useEditorWrapperStyles } from '../../hooks/use-editor-wrapper-styles';
 import { store as blockEditorStore } from '../../store';
+import OfflineStatus from '../offline-status';
 
 const identity = ( x ) => x;
 
@@ -235,6 +236,7 @@ export default function BlockList( {
 			onLayout={ onLayout }
 			testID="block-list-wrapper"
 		>
+			{ __DEV__ && <OfflineStatus /> }
 			{ isRootList ? (
 				<BlockListProvider
 					value={ {

Screenshots or screencast

Screenshot 2023-11-29 at 4 43 17 pm
@derekblank derekblank added [Type] Enhancement A suggestion for improvement. Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) labels Nov 29, 2023
Copy link

github-actions bot commented Nov 29, 2023

Size Change: +2.43 kB (0%)

Total Size: 1.72 MB

Filename Size Change
build/block-editor/index.min.js 248 kB -3 B (0%)
build/block-editor/style-rtl.css 15.7 kB -45 B (0%)
build/block-editor/style.css 15.7 kB -48 B (0%)
build/block-library/blocks/social-links/style-rtl.css 1.49 kB +22 B (+1%)
build/block-library/blocks/social-links/style.css 1.49 kB +22 B (+2%)
build/block-library/index.min.js 213 kB +228 B (0%)
build/block-library/style-rtl.css 14.7 kB +16 B (0%)
build/block-library/style.css 14.7 kB +15 B (0%)
build/blocks/index.min.js 51.1 kB +38 B (0%)
build/components/index.min.js 256 kB -11 B (0%)
build/compose/index.min.js 12.8 kB +47 B (0%)
build/core-commands/index.min.js 2.73 kB +3 B (0%)
build/core-data/index.min.js 72.6 kB -35 B (0%)
build/customize-widgets/index.min.js 12.1 kB +6 B (0%)
build/edit-post/index.min.js 34.9 kB -827 B (-2%)
build/edit-post/style-rtl.css 7.56 kB -41 B (-1%)
build/edit-post/style.css 7.55 kB -43 B (-1%)
build/edit-site/index.min.js 210 kB +1.38 kB (+1%)
build/edit-site/style-rtl.css 14.6 kB +16 B (0%)
build/edit-site/style.css 14.6 kB +17 B (0%)
build/edit-widgets/index.min.js 17.2 kB +10 B (0%)
build/edit-widgets/style-rtl.css 4.65 kB -1 B (0%)
build/edit-widgets/style.css 4.64 kB -3 B (0%)
build/editor/index.min.js 48.6 kB +1.18 kB (+2%)
build/interactivity/index.min.js 12.5 kB +41 B (0%)
build/patterns/index.min.js 5.28 kB +440 B (+9%) 🔍
build/private-apis/index.min.js 994 B +6 B (+1%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 964 B
build/annotations/index.min.js 2.71 kB
build/api-fetch/index.min.js 2.29 kB
build/autop/index.min.js 2.11 kB
build/blob/index.min.js 590 B
build/block-directory/index.min.js 7.25 kB
build/block-directory/style-rtl.css 1.04 kB
build/block-directory/style.css 1.04 kB
build/block-editor/content-rtl.css 4.29 kB
build/block-editor/content.css 4.28 kB
build/block-editor/default-editor-styles-rtl.css 403 B
build/block-editor/default-editor-styles.css 403 B
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 90 B
build/block-library/blocks/archives/style.css 90 B
build/block-library/blocks/audio/editor-rtl.css 150 B
build/block-library/blocks/audio/editor.css 150 B
build/block-library/blocks/audio/style-rtl.css 122 B
build/block-library/blocks/audio/style.css 122 B
build/block-library/blocks/audio/theme-rtl.css 138 B
build/block-library/blocks/audio/theme.css 138 B
build/block-library/blocks/avatar/editor-rtl.css 116 B
build/block-library/blocks/avatar/editor.css 116 B
build/block-library/blocks/avatar/style-rtl.css 104 B
build/block-library/blocks/avatar/style.css 104 B
build/block-library/blocks/block/editor-rtl.css 305 B
build/block-library/blocks/block/editor.css 305 B
build/block-library/blocks/button/editor-rtl.css 587 B
build/block-library/blocks/button/editor.css 587 B
build/block-library/blocks/button/style-rtl.css 633 B
build/block-library/blocks/button/style.css 632 B
build/block-library/blocks/buttons/editor-rtl.css 337 B
build/block-library/blocks/buttons/editor.css 337 B
build/block-library/blocks/buttons/style-rtl.css 332 B
build/block-library/blocks/buttons/style.css 332 B
build/block-library/blocks/calendar/style-rtl.css 239 B
build/block-library/blocks/calendar/style.css 239 B
build/block-library/blocks/categories/editor-rtl.css 113 B
build/block-library/blocks/categories/editor.css 112 B
build/block-library/blocks/categories/style-rtl.css 124 B
build/block-library/blocks/categories/style.css 124 B
build/block-library/blocks/code/editor-rtl.css 53 B
build/block-library/blocks/code/editor.css 53 B
build/block-library/blocks/code/style-rtl.css 121 B
build/block-library/blocks/code/style.css 121 B
build/block-library/blocks/code/theme-rtl.css 124 B
build/block-library/blocks/code/theme.css 124 B
build/block-library/blocks/columns/editor-rtl.css 108 B
build/block-library/blocks/columns/editor.css 108 B
build/block-library/blocks/columns/style-rtl.css 421 B
build/block-library/blocks/columns/style.css 421 B
build/block-library/blocks/comment-author-avatar/editor-rtl.css 125 B
build/block-library/blocks/comment-author-avatar/editor.css 125 B
build/block-library/blocks/comment-content/style-rtl.css 92 B
build/block-library/blocks/comment-content/style.css 92 B
build/block-library/blocks/comment-template/style-rtl.css 199 B
build/block-library/blocks/comment-template/style.css 198 B
build/block-library/blocks/comments-pagination-numbers/editor-rtl.css 123 B
build/block-library/blocks/comments-pagination-numbers/editor.css 121 B
build/block-library/blocks/comments-pagination/editor-rtl.css 222 B
build/block-library/blocks/comments-pagination/editor.css 209 B
build/block-library/blocks/comments-pagination/style-rtl.css 235 B
build/block-library/blocks/comments-pagination/style.css 231 B
build/block-library/blocks/comments-title/editor-rtl.css 75 B
build/block-library/blocks/comments-title/editor.css 75 B
build/block-library/blocks/comments/editor-rtl.css 840 B
build/block-library/blocks/comments/editor.css 839 B
build/block-library/blocks/comments/style-rtl.css 637 B
build/block-library/blocks/comments/style.css 636 B
build/block-library/blocks/cover/editor-rtl.css 647 B
build/block-library/blocks/cover/editor.css 650 B
build/block-library/blocks/cover/style-rtl.css 1.7 kB
build/block-library/blocks/cover/style.css 1.69 kB
build/block-library/blocks/details/editor-rtl.css 65 B
build/block-library/blocks/details/editor.css 65 B
build/block-library/blocks/details/style-rtl.css 98 B
build/block-library/blocks/details/style.css 98 B
build/block-library/blocks/embed/editor-rtl.css 293 B
build/block-library/blocks/embed/editor.css 293 B
build/block-library/blocks/embed/style-rtl.css 410 B
build/block-library/blocks/embed/style.css 410 B
build/block-library/blocks/embed/theme-rtl.css 138 B
build/block-library/blocks/embed/theme.css 138 B
build/block-library/blocks/file/editor-rtl.css 316 B
build/block-library/blocks/file/editor.css 316 B
build/block-library/blocks/file/style-rtl.css 280 B
build/block-library/blocks/file/style.css 281 B
build/block-library/blocks/file/view.min.js 322 B
build/block-library/blocks/footnotes/style-rtl.css 201 B
build/block-library/blocks/footnotes/style.css 199 B
build/block-library/blocks/form-input/editor-rtl.css 229 B
build/block-library/blocks/form-input/editor.css 228 B
build/block-library/blocks/form-input/style-rtl.css 343 B
build/block-library/blocks/form-input/style.css 343 B
build/block-library/blocks/form-submission-notification/editor-rtl.css 343 B
build/block-library/blocks/form-submission-notification/editor.css 342 B
build/block-library/blocks/form-submit-button/style-rtl.css 69 B
build/block-library/blocks/form-submit-button/style.css 69 B
build/block-library/blocks/form/view.min.js 452 B
build/block-library/blocks/freeform/editor-rtl.css 2.61 kB
build/block-library/blocks/freeform/editor.css 2.61 kB
build/block-library/blocks/gallery/editor-rtl.css 957 B
build/block-library/blocks/gallery/editor.css 962 B
build/block-library/blocks/gallery/style-rtl.css 1.75 kB
build/block-library/blocks/gallery/style.css 1.75 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 654 B
build/block-library/blocks/group/editor.css 654 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 78 B
build/block-library/blocks/group/theme.css 78 B
build/block-library/blocks/heading/style-rtl.css 189 B
build/block-library/blocks/heading/style.css 189 B
build/block-library/blocks/html/editor-rtl.css 340 B
build/block-library/blocks/html/editor.css 341 B
build/block-library/blocks/image/editor-rtl.css 834 B
build/block-library/blocks/image/editor.css 833 B
build/block-library/blocks/image/style-rtl.css 1.61 kB
build/block-library/blocks/image/style.css 1.6 kB
build/block-library/blocks/image/theme-rtl.css 137 B
build/block-library/blocks/image/theme.css 137 B
build/block-library/blocks/image/view.min.js 2.02 kB
build/block-library/blocks/latest-comments/style-rtl.css 357 B
build/block-library/blocks/latest-comments/style.css 357 B
build/block-library/blocks/latest-posts/editor-rtl.css 213 B
build/block-library/blocks/latest-posts/editor.css 212 B
build/block-library/blocks/latest-posts/style-rtl.css 478 B
build/block-library/blocks/latest-posts/style.css 478 B
build/block-library/blocks/list/style-rtl.css 88 B
build/block-library/blocks/list/style.css 88 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 505 B
build/block-library/blocks/media-text/style.css 503 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 671 B
build/block-library/blocks/navigation-link/editor.css 672 B
build/block-library/blocks/navigation-link/style-rtl.css 103 B
build/block-library/blocks/navigation-link/style.css 103 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 299 B
build/block-library/blocks/navigation-submenu/editor.css 299 B
build/block-library/blocks/navigation/editor-rtl.css 2.26 kB
build/block-library/blocks/navigation/editor.css 2.26 kB
build/block-library/blocks/navigation/style-rtl.css 2.27 kB
build/block-library/blocks/navigation/style.css 2.26 kB
build/block-library/blocks/navigation/view.min.js 1.04 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 401 B
build/block-library/blocks/page-list/editor.css 401 B
build/block-library/blocks/page-list/style-rtl.css 175 B
build/block-library/blocks/page-list/style.css 175 B
build/block-library/blocks/paragraph/editor-rtl.css 235 B
build/block-library/blocks/paragraph/editor.css 235 B
build/block-library/blocks/paragraph/style-rtl.css 335 B
build/block-library/blocks/paragraph/style.css 335 B
build/block-library/blocks/post-author/style-rtl.css 175 B
build/block-library/blocks/post-author/style.css 176 B
build/block-library/blocks/post-comments-form/editor-rtl.css 96 B
build/block-library/blocks/post-comments-form/editor.css 96 B
build/block-library/blocks/post-comments-form/style-rtl.css 508 B
build/block-library/blocks/post-comments-form/style.css 508 B
build/block-library/blocks/post-date/style-rtl.css 61 B
build/block-library/blocks/post-date/style.css 61 B
build/block-library/blocks/post-excerpt/editor-rtl.css 71 B
build/block-library/blocks/post-excerpt/editor.css 71 B
build/block-library/blocks/post-excerpt/style-rtl.css 141 B
build/block-library/blocks/post-excerpt/style.css 141 B
build/block-library/blocks/post-featured-image/editor-rtl.css 666 B
build/block-library/blocks/post-featured-image/editor.css 662 B
build/block-library/blocks/post-featured-image/style-rtl.css 345 B
build/block-library/blocks/post-featured-image/style.css 345 B
build/block-library/blocks/post-navigation-link/style-rtl.css 215 B
build/block-library/blocks/post-navigation-link/style.css 214 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 409 B
build/block-library/blocks/post-template/style.css 408 B
build/block-library/blocks/post-terms/style-rtl.css 96 B
build/block-library/blocks/post-terms/style.css 96 B
build/block-library/blocks/post-time-to-read/style-rtl.css 69 B
build/block-library/blocks/post-time-to-read/style.css 69 B
build/block-library/blocks/post-title/style-rtl.css 100 B
build/block-library/blocks/post-title/style.css 100 B
build/block-library/blocks/preformatted/style-rtl.css 125 B
build/block-library/blocks/preformatted/style.css 125 B
build/block-library/blocks/pullquote/editor-rtl.css 135 B
build/block-library/blocks/pullquote/editor.css 135 B
build/block-library/blocks/pullquote/style-rtl.css 335 B
build/block-library/blocks/pullquote/style.css 335 B
build/block-library/blocks/pullquote/theme-rtl.css 168 B
build/block-library/blocks/pullquote/theme.css 168 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 221 B
build/block-library/blocks/query-pagination/editor.css 211 B
build/block-library/blocks/query-pagination/style-rtl.css 288 B
build/block-library/blocks/query-pagination/style.css 284 B
build/block-library/blocks/query-title/style-rtl.css 63 B
build/block-library/blocks/query-title/style.css 63 B
build/block-library/blocks/query/editor-rtl.css 486 B
build/block-library/blocks/query/editor.css 486 B
build/block-library/blocks/query/style-rtl.css 312 B
build/block-library/blocks/query/style.css 308 B
build/block-library/blocks/query/view.min.js 647 B
build/block-library/blocks/quote/style-rtl.css 237 B
build/block-library/blocks/quote/style.css 237 B
build/block-library/blocks/quote/theme-rtl.css 223 B
build/block-library/blocks/quote/theme.css 226 B
build/block-library/blocks/read-more/style-rtl.css 140 B
build/block-library/blocks/read-more/style.css 140 B
build/block-library/blocks/rss/editor-rtl.css 149 B
build/block-library/blocks/rss/editor.css 149 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 184 B
build/block-library/blocks/search/editor.css 184 B
build/block-library/blocks/search/style-rtl.css 613 B
build/block-library/blocks/search/style.css 613 B
build/block-library/blocks/search/theme-rtl.css 114 B
build/block-library/blocks/search/theme.css 114 B
build/block-library/blocks/search/view.min.js 475 B
build/block-library/blocks/separator/editor-rtl.css 146 B
build/block-library/blocks/separator/editor.css 146 B
build/block-library/blocks/separator/style-rtl.css 234 B
build/block-library/blocks/separator/style.css 234 B
build/block-library/blocks/separator/theme-rtl.css 194 B
build/block-library/blocks/separator/theme.css 194 B
build/block-library/blocks/shortcode/editor-rtl.css 329 B
build/block-library/blocks/shortcode/editor.css 329 B
build/block-library/blocks/site-logo/editor-rtl.css 760 B
build/block-library/blocks/site-logo/editor.css 760 B
build/block-library/blocks/site-logo/style-rtl.css 204 B
build/block-library/blocks/site-logo/style.css 204 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 116 B
build/block-library/blocks/site-title/editor.css 116 B
build/block-library/blocks/site-title/style-rtl.css 57 B
build/block-library/blocks/site-title/style.css 57 B
build/block-library/blocks/social-link/editor-rtl.css 184 B
build/block-library/blocks/social-link/editor.css 184 B
build/block-library/blocks/social-links/editor-rtl.css 682 B
build/block-library/blocks/social-links/editor.css 681 B
build/block-library/blocks/spacer/editor-rtl.css 359 B
build/block-library/blocks/spacer/editor.css 359 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 432 B
build/block-library/blocks/table/editor.css 432 B
build/block-library/blocks/table/style-rtl.css 646 B
build/block-library/blocks/table/style.css 645 B
build/block-library/blocks/table/theme-rtl.css 157 B
build/block-library/blocks/table/theme.css 157 B
build/block-library/blocks/tag-cloud/style-rtl.css 251 B
build/block-library/blocks/tag-cloud/style.css 253 B
build/block-library/blocks/template-part/editor-rtl.css 403 B
build/block-library/blocks/template-part/editor.css 403 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/style-rtl.css 111 B
build/block-library/blocks/term-description/style.css 111 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 99 B
build/block-library/blocks/verse/style.css 99 B
build/block-library/blocks/video/editor-rtl.css 552 B
build/block-library/blocks/video/editor.css 555 B
build/block-library/blocks/video/style-rtl.css 191 B
build/block-library/blocks/video/style.css 191 B
build/block-library/blocks/video/theme-rtl.css 139 B
build/block-library/blocks/video/theme.css 139 B
build/block-library/classic-rtl.css 179 B
build/block-library/classic.css 179 B
build/block-library/common-rtl.css 1.11 kB
build/block-library/common.css 1.11 kB
build/block-library/editor-elements-rtl.css 75 B
build/block-library/editor-elements.css 75 B
build/block-library/editor-rtl.css 12.5 kB
build/block-library/editor.css 12.4 kB
build/block-library/elements-rtl.css 54 B
build/block-library/elements.css 54 B
build/block-library/reset-rtl.css 472 B
build/block-library/reset.css 472 B
build/block-library/theme-rtl.css 700 B
build/block-library/theme.css 705 B
build/block-serialization-default-parser/index.min.js 1.13 kB
build/block-serialization-spec-parser/index.min.js 2.87 kB
build/commands/index.min.js 15.5 kB
build/commands/style-rtl.css 947 B
build/commands/style.css 942 B
build/components/style-rtl.css 12.1 kB
build/components/style.css 12.1 kB
build/customize-widgets/style-rtl.css 1.43 kB
build/customize-widgets/style.css 1.43 kB
build/data-controls/index.min.js 651 B
build/data/index.min.js 8.87 kB
build/date/index.min.js 17.9 kB
build/deprecated/index.min.js 462 B
build/dom-ready/index.min.js 336 B
build/dom/index.min.js 4.68 kB
build/edit-post/classic-rtl.css 571 B
build/edit-post/classic.css 571 B
build/editor/style-rtl.css 3.74 kB
build/editor/style.css 3.73 kB
build/element/index.min.js 4.87 kB
build/escape-html/index.min.js 548 B
build/format-library/index.min.js 7.76 kB
build/format-library/style-rtl.css 577 B
build/format-library/style.css 577 B
build/hooks/index.min.js 1.57 kB
build/html-entities/index.min.js 454 B
build/i18n/index.min.js 3.61 kB
build/interactivity/file.min.js 442 B
build/interactivity/image.min.js 2.15 kB
build/interactivity/navigation.min.js 1.16 kB
build/interactivity/query.min.js 791 B
build/interactivity/search.min.js 610 B
build/is-shallow-equal/index.min.js 535 B
build/keyboard-shortcuts/index.min.js 1.76 kB
build/keycodes/index.min.js 1.9 kB
build/list-reusable-blocks/index.min.js 2.11 kB
build/list-reusable-blocks/style-rtl.css 865 B
build/list-reusable-blocks/style.css 865 B
build/media-utils/index.min.js 2.92 kB
build/modules/importmap-polyfill.min.js 12.2 kB
build/notices/index.min.js 964 B
build/nux/index.min.js 2.01 kB
build/nux/style-rtl.css 775 B
build/nux/style.css 771 B
build/patterns/style-rtl.css 564 B
build/patterns/style.css 564 B
build/plugins/index.min.js 1.81 kB
build/preferences-persistence/index.min.js 1.85 kB
build/preferences/index.min.js 1.26 kB
build/primitives/index.min.js 994 B
build/priority-queue/index.min.js 1.52 kB
build/react-i18n/index.min.js 631 B
build/react-refresh-entry/index.min.js 9.46 kB
build/react-refresh-runtime/index.min.js 6.78 kB
build/redux-routine/index.min.js 2.71 kB
build/reusable-blocks/index.min.js 2.74 kB
build/reusable-blocks/style-rtl.css 265 B
build/reusable-blocks/style.css 265 B
build/rich-text/index.min.js 9.98 kB
build/router/index.min.js 1.79 kB
build/server-side-render/index.min.js 1.96 kB
build/shortcode/index.min.js 1.4 kB
build/style-engine/index.min.js 1.98 kB
build/token-list/index.min.js 587 B
build/url/index.min.js 3.83 kB
build/vendors/inert-polyfill.min.js 2.48 kB
build/vendors/react-dom.min.js 41.8 kB
build/vendors/react.min.js 4.02 kB
build/viewport/index.min.js 967 B
build/warning/index.min.js 259 B
build/widgets/index.min.js 7.18 kB
build/widgets/style-rtl.css 1.18 kB
build/widgets/style.css 1.18 kB
build/wordcount/index.min.js 1.03 kB

compressed-size-action

Copy link
Member

@dcalhoun dcalhoun left a comment

Choose a reason for hiding this comment

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

Good progress! I did not test the code given the draft state, but provided initial feedback.

Copy link
Member

@dcalhoun dcalhoun left a comment

Choose a reason for hiding this comment

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

The latest changes look good. I noted a few things while testing.

First, we likely need to implement dark mode support. Currently, the status text is illegible when dark mode is enabled.

iOS Screenshot

Offline status is illegible when dark mode is enabled

Second, after relocating OfflineStatus to the editor package, the testing instructions result in a cyclic dependency that throws an error. If we intend to use OfflineStatus in block-editor we may need to relocate OfflineStatus — possibly to the block-editor.

The cyclic dependency from the testing instructions is noted in this diagram with a red arrow.

Cyclic dependency caused by the testing instructions

Error Details
 ERROR  Error: Cannot unlock an undefined object., js engine: hermes
    at Gutenberg (http://localhost:8081/index.bundle//&platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.wordpress.gutenberg.development:120500:38)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.wordpress.gutenberg.development:48203:43)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.wordpress.gutenberg.development:48203:43)
    at AppContainer (http://localhost:8081/index.bundle//&platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.wordpress.gutenberg.development:48081:36)
    at gutenberg(RootComponent) (http://localhost:8081/index.bundle//&platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.wordpress.gutenberg.development:84470:28)
 ERROR  Error: Cannot unlock an undefined object., js engine: hermes
    at Gutenberg (http://localhost:8081/index.bundle//&platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.wordpress.gutenberg.development:120500:38)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.wordpress.gutenberg.development:48203:43)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.wordpress.gutenberg.development:48203:43)
    at AppContainer (http://localhost:8081/index.bundle//&platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.wordpress.gutenberg.development:48081:36)
    at gutenberg(RootComponent) (http://localhost:8081/index.bundle//&platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true&app=org.wordpress.gutenberg.development:84470:28)
 ERROR  TypeError: Cannot read property 'default' of undefined

This error is located at:
    in Gutenberg
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in gutenberg(RootComponent), js engine: hermes
 ERROR  TypeError: Cannot read property 'default' of undefined

This error is located at:
    in Gutenberg
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in gutenberg(RootComponent), js engine: hermes
packages/react-native-editor/CHANGELOG.md Outdated Show resolved Hide resolved
packages/edit-post/src/components/layout/style.native.scss Outdated Show resolved Hide resolved
@dcalhoun
Copy link
Member

dcalhoun commented Dec 5, 2023

Additional suggestion: For changes dependent another branch, I generally build atop that branch. That might make it easier to test the changes and ensure the integration is without issue. That said, I fully recognize this work was started prior to that branch existing.

In this case I might build atop #56609. I would then open the PR against feat/connectivity-status so that the PR showcases only the additional changes. Once #56609 merges, I would use the following command to rebase this branch atop the latest trunk that includes the merged dependent changes:

git switch rnmobile/offline-status
git fetch
git rebase --onto origin/trunk origin/feat/connectivity-status rnmobile/offline-status

Note the above requires that the feat/connectivity-status branch exists on origin, which would require restoring the branch temporarily after merging the associated PR.

I do not share to ask that it be done, merely to share my workflow. Merging the work in hidden pieces is a legitimate approach is well.

Copy link

github-actions bot commented Dec 6, 2023

Flaky tests detected in e97417d.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7111347950
📝 Reported issues:

@derekblank
Copy link
Member Author

First, we likely need to implement dark mode support. Currently, the status text is illegible when dark mode is enabled.

Updated to include dark mode support. 👍

Second, after relocating OfflineStatus to the editor package, the testing instructions result in a cyclic dependency

I encountered this as well when testing, and agree that the block-editor package may be a better choice. I've moved the files there. With that change, OfflineStatus can be imported privately within block-list without the need to export it. Extrapolating this testing patch further, eventually we'd replace __DEV__ with the inverted boolean from the isNetworkConnected hook:

diff --git a/packages/block-editor/src/components/block-list/index.native.js b/packages/block-editor/src/components/block-list/index.native.js
index 810e23e4c1..b4d69aa7c7 100644
--- a/packages/block-editor/src/components/block-list/index.native.js
+++ b/packages/block-editor/src/components/block-list/index.native.js
@@ -30,6 +30,7 @@ import {
 import { BlockDraggableWrapper } from '../block-draggable';
 import { useEditorWrapperStyles } from '../../hooks/use-editor-wrapper-styles';
 import { store as blockEditorStore } from '../../store';
+import OfflineStatus from '../offline-status';
 
 const identity = ( x ) => x;
 
@@ -235,6 +236,7 @@ export default function BlockList( {
 			onLayout={ onLayout }
 			testID="block-list-wrapper"
 		>
+			{ __DEV__ && <OfflineStatus /> }
 			{ isRootList ? (
 				<BlockListProvider
 					value={ {
@derekblank
Copy link
Member Author

derekblank commented Dec 6, 2023

In this case I might build atop #56609. I would then open the PR against feat/connectivity-status so that the PR showcases only the additional changes. Once #56609 merges, I would use the following command to rebase this branch atop the latest trunk that includes the merged dependent changes [...]

I think this is a good approach. I think we can begin merging the work in #56609 and associated PRs. Once merged, we can follow the rebasing steps you've outlined, and update block-list to something like this to have the OfflineStatus component available behind a dev flag in order to merge this PR:

{ __DEV__ && ! isConnected && <OfflineStatus /> }

WDYT? Do you note any other code changes needed in this PR (outside of depending upon the #56609 merge flow)?

@@ -11,6 +11,7 @@ For each user feature we should also add a importance categorization label to i

## Unreleased
- [*] [internal] Move InserterButton from components package to block-editor package [#56494]
- [**] Editor displays network status when offline [#56627]
Copy link
Member Author

Choose a reason for hiding this comment

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

If we were to merge this PR within the next week with this work behind a __DEV__ flag, this may not be the most accurate release note as it would not display network status until connected to the connectivity hook. Do we have a precedent for release notes with dev-only changes? Perhaps just [internal]?

Copy link
Member

Choose a reason for hiding this comment

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

I believe we have generally merely excluded release notes until the user-facing features are present. I.e. we would add the release note in the PR removing the __DEV__ flag.

That said, changing this release note to be an [internal] note more focused on the implementation details would likely be fine as well, e.g. [internal] Add OfflineStatus component for communicating network connection state.

);

const iconStyle = usePreferredColorSchemeStyle(
styles.icon,
Copy link
Member Author

Choose a reason for hiding this comment

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

Noting that the linter will throw an error if these are written in square-bracket syntax, e.g., styles[ 'icon' ]:

  21:11  error  ["container"] is better written in dot notation  dot-notation
  26:11  error  ["text"] is better written in dot notation       dot-notation
  31:11  error  ["icon"] is better written in dot notation       dot-notation

Perhaps a quirk of BEM semantics, but using dot-notation for light styles and square-bracket syntax for dark styles, unless you have any suggestions.

Copy link
Member

Choose a reason for hiding this comment

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

Your approach is expected and correct. For better or worse, we only use bracket notations for selectors that include hyphens.

@derekblank derekblank changed the title Add OfflineStatus component to display network connectivity Dec 6, 2023
Copy link
Member

@dcalhoun dcalhoun left a comment

Choose a reason for hiding this comment

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

Thanks for making the changes. 🙇🏻

I noticed the contrast between the offline banner and top navigation header differs when comparing light and dark mode. The former uses different background colors for each element, the latter uses the same background color. A small detail, but I was unsure if the divergence was intentional.

Appearance Divergence
Light Mode Dark Mode
light-mode-uses-differing background-colors dark-mode-uses-identical-background-colors

I think this [stacking branches] is a good approach. I think we can begin merging the work in #56609 and associated PRs.

To clarify, the example git rebase --onto command I shared is only relevant if we rebased this branch atop the dependent feat/connectivity-status before it is merged into the trunk branch.

Stacked Branches Details
  1. git switch rnmobile/offline-status
  2. git pull --rebase origin feat/connectivity-status
  3. Integrate the isConnected hook into the OfflineStatus component.
  4. git push origin rnmobile/offline-status --force-with-lease
  5. Update thie PR to target feat/connectivity-status instead of trunk.
  6. Merge feat/connectivity-status into trunk. Note: GitHub will now automatically update this PR to target trunk instead of feat/connectivity-status.
  7. Temporarily restore the feat/connected-status branch in GitHub.
  8. git fetch
  9. git rebase --onto origin/trunk feat/connected-status rnmobile/offline-status
  10. git push origin rnmobile/offline-status --force-with-lease

Steps 1–5 would've been done originally when starting this work, building atop the dependent branch. Steps 6–10 would be done to rebase this branch atop trunk after the merge.

Now that we are likely about to merge feat/connectivity-status into trunk, this approach is less relevant for this particular PR.

If your plan is to await merging feat/connectivity-status before rebasing, then we can simply rebase this branch on trunk after the merge and work to integrate the newly available isConnected hook into this branch.

Await Dependent Work Merge Details
  1. Merge feat/connectivity-status into trunk.
  2. git switch rnmobile/offline-status
  3. git pull --rebase origin trunk
  4. Integrate the isConnected hook into the OfflineStatus component.
  5. git push origin rnmobile/offline-status --force-with-lease

We can now review the changes in this PR with the isConnected hook integrated.

[...] Once merged, we can follow the rebasing steps you've outlined, and update block-list to something like this to have the OfflineStatus component available behind a dev flag in order to merge this PR:

{ __DEV__ && ! isConnected && <OfflineStatus /> }

My thought was that we would use isConnected Hook within the OfflineStatus component, returning null when isConnected is true. This would keep the network state closer to the component that uses it. It might also avoid unnecessary re-renders of block-list — not sure. WDYT?

);

const iconStyle = usePreferredColorSchemeStyle(
styles.icon,
Copy link
Member

Choose a reason for hiding this comment

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

Your approach is expected and correct. For better or worse, we only use bracket notations for selectors that include hyphens.

@@ -11,6 +11,7 @@ For each user feature we should also add a importance categorization label to i

## Unreleased
- [*] [internal] Move InserterButton from components package to block-editor package [#56494]
- [**] Editor displays network status when offline [#56627]
Copy link
Member

Choose a reason for hiding this comment

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

I believe we have generally merely excluded release notes until the user-facing features are present. I.e. we would add the release note in the PR removing the __DEV__ flag.

That said, changing this release note to be an [internal] note more focused on the implementation details would likely be fine as well, e.g. [internal] Add OfflineStatus component for communicating network connection state.

@derekblank
Copy link
Member Author

derekblank commented Dec 6, 2023

My thought was that we would use isConnected Hook within the OfflineStatus component, returning null when isConnected is true.

I agree that using isConnected within the OfflineStatus component would likely help avoid re-renders of block-list. I'll follow the steps outlined in Await Dependent Work Merge Details later to sync this work with the hook.

Noting that the merge of feat/connectivity-status was reverted. I plan to continue using the Stacked Branches Details approach.

apeatling and others added 9 commits December 7, 2023 17:13
* Remove dropdown menu

* Make sure setEditorCanvasContainerView() calls are made when needed so that toggle status works correctly when viewing any other sections of global styles.

* Pre select the revisions count to prevent flashes of incorrect revision counts. Hat tip @ramonjd.

* Remove CSS no longer needed.

* Modify e2e test to reflect removal of menu item.

* Fix issue with style book closing when browsing blocks.

* Replace onClick with onBack to reduce confusion with screen header click action.

* Change ordering of `isRevisionsOpened` const.
* Add kebab casing and font family wrapping in sanitization function.

Remove commented code.

* Simplify how kebab casing and quote wrapping is done.

* Ensure incoming font is returned.

* Add kebab casing to slug in form data.

* Add tests for wpKebabCase

* remove redundant test

* test 2 different inputs on first wpKebabCase case

* Move formatting functions to utils.

* reduce the scope of the function

* fix the live preview (without reloading the page) of the just installed fonts in the editor

* format php

* Add test for format_font_family.

* Format php.

* Add more test cases and format.

* Remove accidental badKey.

* Format.

---------

Co-authored-by: Vicente Canales <vicente.canales@automattic.com>
Co-authored-by: Sarah Norris <1645628+mikachan@users.noreply.github.com>
Co-authored-by: Sarah Norris <sarah@sekai.co.uk>
Co-authored-by: Matias Benedetto <matias.benedetto@gmail.com>
…hiteSpace()` if `value` is not a string (#56570)

* (RichText)(Fix)(Workaround) Make sure value is always a string to avoid TypeErorrs

See the comments in this changeset for more info on why this was needed.

* Use a more localized fix that does not change the argument
* Add setting to disable custom content size controls

* Make sure theme setting overrides block setting.

* Revert "Make sure theme setting overrides block setting."

This reverts commit ad4b76c.

* Change setting name to `allowCustomContentAndWideSize`
…6334)

* Add block registration documentation

* Update block registration process

* Update block registration in client code

* updated doc

* Update block registration settings

* Grammar check

* Moved Registration of A block to fundamentals of block development

* Added maarkdown extension

* Delete docs/getting-started/fundamentals-block-development/registration-of-a-block

* Removed "key"

* clarification path block.json

* Fix block.json registration path

* server-side features require block server registration

* server-side features require block server registration

* Update docs/getting-started/fundamentals-block-development/registration-of-a-block.md

Co-authored-by: Ramon <ramonjd@users.noreply.github.com>

* Update docs/getting-started/fundamentals-block-development/registration-of-a-block.md

Co-authored-by: Ramon <ramonjd@users.noreply.github.com>

* Update docs/getting-started/fundamentals-block-development/registration-of-a-block.md

Co-authored-by: Ramon <ramonjd@users.noreply.github.com>

* Update docs/getting-started/fundamentals-block-development/registration-of-a-block.md

Co-authored-by: Ramon <ramonjd@users.noreply.github.com>

* Update docs/getting-started/fundamentals-block-development/registration-of-a-block.md

Co-authored-by: Ramon <ramonjd@users.noreply.github.com>

* Update docs/getting-started/fundamentals-block-development/registration-of-a-block.md

Co-authored-by: Ramon <ramonjd@users.noreply.github.com>

* Fix formatting in registration-of-a-block.md

* Added link to new page and some text adjustments

* Update block registration function and build process reference

---------

Co-authored-by: Ramon <ramonjd@users.noreply.github.com>
…the Block Editor (#56553)

* Add JavaScript build process documentation

* Update docs/getting-started/fundamentals-block-development/javascript-in-the-block-editor.md

Co-authored-by: Fabian Kägy <mail@fabian-kaegy.de>

---------

Co-authored-by: Fabian Kägy <mail@fabian-kaegy.de>
…56551)

* Add file structure documentation for custom blocks

* Update docs/getting-started/fundamentals-block-development/file-structure-of-a-block.md

Co-authored-by: Ryan Welcher <me@ryanwelcher.com>

* Removed not clear sentence

---------

Co-authored-by: Ryan Welcher <me@ryanwelcher.com>
@derekblank
Copy link
Member Author

Closing this PR due to the rebase complexity. Will reopen another one based on feat/connectivity-status. Apologies for the noise.

@gziolo gziolo deleted the rnmobile/offline-status branch December 7, 2023 07:31
@dmsnell
Copy link
Contributor

dmsnell commented Dec 7, 2023

Thought for wherever this is resurrected, but the browser API also exposes online/offline events. I'm not sure if this already incorporates that element, but there's no reason we need to limit the status indicator to mobile devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - Automation Label used to initiate Mobile App PR Automation Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Type] Enhancement A suggestion for improvement.