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

Move Entities Saved States from Modal to Sidebar #21522

Merged
merged 61 commits into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
44f9fb3
moved to sidebar, functional in post editor / hidden in site
Addison-Stavlo Apr 7, 2020
37b1aab
copied over some styles, working in site editor now
Addison-Stavlo Apr 7, 2020
ff7f7c7
added close button
Addison-Stavlo Apr 7, 2020
ee6dac0
added icons and styles
Addison-Stavlo Apr 8, 2020
1b663c2
added selection feature
Addison-Stavlo Apr 8, 2020
0cae61e
refactored store goo
Addison-Stavlo Apr 9, 2020
836a536
refactored z-index
Addison-Stavlo Apr 9, 2020
3894fe3
refactored entities saved states
Addison-Stavlo Apr 9, 2020
716a288
refactored scss
Addison-Stavlo Apr 9, 2020
455aafc
added test for actions
Addison-Stavlo Apr 9, 2020
faf3bf9
added tests for reducer
Addison-Stavlo Apr 9, 2020
0524f80
added selector test
Addison-Stavlo Apr 9, 2020
97208e4
fixing lint
Addison-Stavlo Apr 9, 2020
f22140c
fixing more lint
Addison-Stavlo Apr 9, 2020
0d99a58
cleanup bad auto-pretty
Addison-Stavlo Apr 9, 2020
f717b30
last of cleanup?
Addison-Stavlo Apr 9, 2020
af220c1
renamed select entity button
Addison-Stavlo Apr 9, 2020
f9b8a38
added actions/reducers/tests to edit-post
Addison-Stavlo Apr 15, 2020
99223ab
added store things to edit-site
Addison-Stavlo Apr 15, 2020
7846f7f
restructured to run on isOpen/closePanel props
Addison-Stavlo Apr 15, 2020
eb83b7f
removed from editor package store
Addison-Stavlo Apr 15, 2020
a350168
created Actions component for post editor layout
Addison-Stavlo Apr 20, 2020
820e529
added save panel hidden button to post editor
Addison-Stavlo Apr 21, 2020
a74cc82
added hidden button to site editor
Addison-Stavlo Apr 21, 2020
8abafb1
added styles and class names
Addison-Stavlo Apr 21, 2020
f52e7a0
fixed z-index name issue
Addison-Stavlo Apr 21, 2020
f3e74c1
restored z-indexes to previous values, no need with non-overlapping p…
Addison-Stavlo Apr 21, 2020
878a5a4
refactor ActionsPanel, always mount entitites"
Addison-Stavlo Apr 27, 2020
e44427c
removed unnecessary vars and imports
Addison-Stavlo Apr 27, 2020
614c505
make save component always mounted in edit site"
Addison-Stavlo Apr 27, 2020
fc79a18
added some comments
Addison-Stavlo Apr 27, 2020
a399f74
fixed closePanel for selecting entity in small width
Addison-Stavlo Apr 28, 2020
9769a69
removed entities actions/reducers from edit-site editor
Addison-Stavlo Apr 28, 2020
8301e25
passed localstate down through props in edit-site
Addison-Stavlo Apr 28, 2020
e6a9dca
removed entities goo from edit-site store
Addison-Stavlo Apr 28, 2020
0388f6a
added parentBlockId as dep to callback in entitiy selection
Addison-Stavlo Apr 28, 2020
c968585
converted entities to local state in edit-post layout
Addison-Stavlo Apr 28, 2020
7bf675f
set up edit-post save panel on local state props
Addison-Stavlo Apr 28, 2020
8782b3e
removed entities goo from edit-post store
Addison-Stavlo Apr 28, 2020
c2ec04a
fixed z-index naming convention
Addison-Stavlo Apr 28, 2020
c18805e
refactored actions panel
Addison-Stavlo Apr 28, 2020
e4ac4f5
fixed comment misspellings
Addison-Stavlo Apr 28, 2020
3ccf6bb
refactored entitiesSavedStates icon enum
Addison-Stavlo Apr 28, 2020
a633707
removed unnecessary comments
Addison-Stavlo Apr 29, 2020
448e4db
added comment to redundant looking useCallback
Addison-Stavlo Apr 29, 2020
0797c0c
updated description titles in test to no longer say 'modal'
Addison-Stavlo Apr 29, 2020
545c200
added tests for panels/a11y buttons rendering
Addison-Stavlo Apr 29, 2020
d47a13d
minor name and descriptor changes
Addison-Stavlo Apr 29, 2020
66e669d
added waitForSelector to failing post-visibility test
Addison-Stavlo Apr 29, 2020
5ddd8b5
changed waitFor to wait for button to be clickable
Addison-Stavlo Apr 29, 2020
25956cc
changed 'Select entity' button to 'Select'
Addison-Stavlo Apr 29, 2020
607c539
Update packages/base-styles/_z-index.scss
Addison-Stavlo Apr 29, 2020
f3cc10c
applying some suggestions
Addison-Stavlo Apr 30, 2020
d4b867d
Update packages/edit-post/src/components/layout/actions-panel.js
Addison-Stavlo Apr 30, 2020
69cf8d7
added comment to setting callback
Addison-Stavlo Apr 30, 2020
76e1f70
updated callback goo
Addison-Stavlo Apr 30, 2020
70a1a20
fixed useCallback for dismissing panel
Addison-Stavlo Apr 30, 2020
9ea1a04
updates prop name from closePanel to close
Addison-Stavlo Apr 30, 2020
107d924
updated how we clear the callback
Addison-Stavlo Apr 30, 2020
d8522d8
simplified logic on callback setting and open/close
Addison-Stavlo Apr 30, 2020
74d5c9c
minor comment nit
Addison-Stavlo Apr 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,16 @@ function Layout() {
isEntitiesSavedStatesOpen,
setIsEntitiesSavedStatesOpen,
] = useState( false );
const [
closeEntitiesCallback,
setCloseEntitiesCallback,
] = useState( () => () => {} );
const [ closeEntitiesCallback, setCloseEntitiesCallback ] = useState();
const openEntitiesSavedStates = useCallback(
() => setIsEntitiesSavedStatesOpen( true ),
[]
);
const closeEntitiesSavedStates = useCallback(
( callbackArg ) => {
closeEntitiesCallback( callbackArg );
if ( closeEntitiesCallback ) {
closeEntitiesCallback( callbackArg );
}
setIsEntitiesSavedStatesOpen( false );
},
[ closeEntitiesCallback ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ export default function EntitiesSavedStates( { isOpen, closePanel } ) {

// Explicitly define this with no argument passed. Using `closePanel` on
// its own will use the event object in place of the expected saved entities.
const dismissPanel = useCallback( () => closePanel(), [] );
// Do NOT useCallback, it will skip the 'this' bound callback used in the
// closePanel function.
const dismissPanel = () => closePanel();
epiqueras marked this conversation as resolved.
Show resolved Hide resolved

return isOpen ? (
<div className="entities-saved-states__panel">
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/components/post-publish-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export class PostPublishButton extends Component {
entitiesSavedStatesCallback();
}
} );
// Clear the callback set for entities saved states.
this.props.setCloseEntitiesCallback();
Addison-Stavlo marked this conversation as resolved.
Show resolved Hide resolved
}

render() {
Expand Down