Skip to content

Commit

Permalink
SIte management panel - Keep "WP Admin" and "Home" button primary acr…
Browse files Browse the repository at this point in the history
…oss all tabs (#94774)

* Make Home and WP Admin buttons always CTA

* Remove sectionName reference

* Remove another sectionName reference
  • Loading branch information
DustyReagan authored Sep 20, 2024
1 parent c6cd0bf commit 965d3a5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ interface Props {
selectedSiteFeaturePreview: React.ReactNode;
closeSitePreviewPane: () => void;
changeSitePreviewPane: ( siteId: number ) => void;
sectionName?: string;
}

const OVERLAY_MODAL_SELECTORS = [
Expand All @@ -43,12 +42,6 @@ const OVERLAY_MODAL_SELECTORS = [
'div.help-center__container:not(.is-minimized)',
];

type HeaderButtonsProps = {
focusRef: React.RefObject< HTMLButtonElement >;
itemData: ItemData;
closeSitePreviewPane: () => void;
};

const DotcomPreviewPane = ( {
site,
selectedSiteFeature,
Expand Down Expand Up @@ -200,9 +193,7 @@ const DotcomPreviewPane = ( {
itemPreviewPaneHeaderExtraProps={ {
externalIconSize: 16,
siteIconFallback: 'first-grapheme',
headerButtons: ( props: HeaderButtonsProps ) => (
<PreviewPaneHeaderButtons { ...props } sectionName={ selectedSiteFeature } />
),
headerButtons: PreviewPaneHeaderButtons,
subtitleExtra: () =>
( site.is_wpcom_staging_site || isStagingStatusFinished ) && (
<SiteEnvironmentSwitcher onChange={ changeSitePreviewPane } site={ site } />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,20 @@ type Props = {
focusRef: React.RefObject< HTMLButtonElement >;
itemData: ItemData;
closeSitePreviewPane?: () => void;
sectionName?: string;
};

const PreviewPaneHeaderButtons = ( {
focusRef,
closeSitePreviewPane,
itemData,
sectionName,
}: Props ) => {
const PreviewPaneHeaderButtons = ( { focusRef, closeSitePreviewPane, itemData }: Props ) => {
const adminButtonRef = useRef< HTMLButtonElement | null >( null );
const { adminLabel, adminUrl } = useSiteAdminInterfaceData( itemData.blogId );
const { __ } = useI18n();
const isHostingOverview = sectionName === 'dotcom-hosting';

return (
<>
<Button onClick={ closeSitePreviewPane } className="item-preview__close-preview-button">
{ __( 'Close' ) }
</Button>
<Button
primary={ isHostingOverview }
primary
className="item-preview__admin-button"
href={ `${ adminUrl }` }
ref={ useMergeRefs( [ adminButtonRef, focusRef ] ) }
Expand Down
2 changes: 0 additions & 2 deletions client/hosting/sites/components/sites-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ const SitesDashboard = ( {
selectedSite,
initialSiteFeature = DOTCOM_OVERVIEW,
selectedSiteFeaturePreview = undefined,
sectionName,
}: SitesDashboardProps ) => {
const [ initialSortApplied, setInitialSortApplied ] = useState( false );
const isWide = useBreakpoint( WIDE_BREAKPOINT );
Expand Down Expand Up @@ -442,7 +441,6 @@ const SitesDashboard = ( {
setSelectedSiteFeature={ setSelectedSiteFeature }
closeSitePreviewPane={ closeSitePreviewPane }
changeSitePreviewPane={ changeSitePreviewPane }
sectionName={ sectionName }
/>
</LayoutColumn>
<GuidedTour defaultTourId="siteManagementTour" />
Expand Down

0 comments on commit 965d3a5

Please sign in to comment.