Skip to content

Commit

Permalink
Hide panel after unchecking option
Browse files Browse the repository at this point in the history
  • Loading branch information
octaedro committed Feb 23, 2024
1 parent 79b13e1 commit e88dfa8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/js/product-editor/src/components/header/header.tsx
Expand Up @@ -27,6 +27,7 @@ import { PublishButton } from './publish-button';
import { LoadingState } from './loading-state';
import { Tabs } from '../tabs';
import { HEADER_PINNED_ITEMS_SCOPE, TRACKS_SOURCE } from '../../constants';
import { useShowPrepublishChecks } from '../../hooks/use-show-prepublish-checks';

export type HeaderProps = {
onTabSelect: ( tabId: string | null ) => void;
Expand Down Expand Up @@ -64,6 +65,10 @@ export function Header( {
'name'
);

const { isResolving, showPrepublishChecks } = useShowPrepublishChecks();

const isPrepublishButtonVisible = ! isResolving && showPrepublishChecks;

const sidebarWidth = useAdminSidebarWidth();

useEffect( () => {
Expand Down Expand Up @@ -158,7 +163,10 @@ export function Header( {
productStatus={ lastPersistedProduct?.status }
/>

<PublishButton productType={ productType } prePublish />
<PublishButton
productType={ productType }
prePublish={ isPrepublishButtonVisible }
/>

<WooHeaderItem.Slot name="product" />
<PinnedItems.Slot scope={ HEADER_PINNED_ITEMS_SCOPE } />
Expand Down

0 comments on commit e88dfa8

Please sign in to comment.