2023-08-28 01:28:05 +00:00
/ * *
* WordPress dependencies
* /
/* eslint-disable @woocommerce/dependency-group */
/* eslint-disable @typescript-eslint/ban-ts-comment */
2024-02-22 08:48:49 +00:00
import { createInterpolateElement , useContext } from '@wordpress/element' ;
2023-08-28 01:28:05 +00:00
import {
// @ts-ignore No types for this exist yet.
__experimentalItemGroup as ItemGroup ,
// @ts-ignore No types for this exist yet.
__experimentalNavigatorButton as NavigatorButton ,
// @ts-ignore No types for this exist yet.
__experimentalHeading as Heading ,
} from '@wordpress/components' ;
import { __ } from '@wordpress/i18n' ;
import {
siteLogo ,
color ,
typography ,
header ,
home ,
footer ,
} from '@wordpress/icons' ;
// @ts-ignore No types for this exist yet.
import SidebarNavigationItem from '@wordpress/edit-site/build-module/components/sidebar-navigation-item' ;
import { Link } from '@woocommerce/components' ;
/ * *
* Internal dependencies
* /
import { SidebarNavigationScreen } from './sidebar-navigation-screen' ;
import { ADMIN_URL } from '~/utils/admin-settings' ;
2024-02-22 08:48:49 +00:00
import { CustomizeStoreContext } from '~/customize-store/assembler-hub' ;
import { FlowType } from '~/customize-store/types' ;
2024-04-23 17:38:06 +00:00
import { trackEvent } from '~/customize-store/tracking' ;
2024-06-11 13:26:04 +00:00
import { getNewPath , navigateTo } from '@woocommerce/navigation' ;
import {
SidebarNavigationAnimationDirection ,
SidebarNavigationContext ,
} from '../components/sidebar' ;
2024-07-02 11:56:34 +00:00
import { isFullComposabilityFeatureAndAPIAvailable } from '../utils/is-full-composability-enabled' ;
2023-08-28 01:28:05 +00:00
export const SidebarNavigationScreenMain = ( ) = > {
2024-02-22 08:48:49 +00:00
const {
context : { flowType } ,
} = useContext ( CustomizeStoreContext ) ;
const aiOnline = flowType === FlowType . AIOnline ;
2024-06-11 13:26:04 +00:00
const { navigate } = useContext ( SidebarNavigationContext ) ;
2024-02-22 08:48:49 +00:00
2023-08-28 01:28:05 +00:00
return (
< SidebarNavigationScreen
isRoot
title = { __ ( "Let's get creative" , 'woocommerce' ) }
description = { createInterpolateElement (
__ (
'Use our style and layout tools to customize the design of your store. Content and images can be added or changed via the <EditorLink>Editor</EditorLink> later.' ,
'woocommerce'
) ,
{
EditorLink : (
< Link
2023-09-19 03:37:46 +00:00
onClick = { ( ) = > {
2024-04-23 17:38:06 +00:00
trackEvent (
2023-09-19 03:37:46 +00:00
'customize_your_store_assembler_hub_editor_link_click' ,
{
source : 'main' ,
}
) ;
window . open (
` ${ ADMIN_URL } site-editor.php ` ,
'_blank'
) ;
return false ;
} }
href = ""
2023-08-28 01:28:05 +00:00
/ >
) ,
}
) }
content = {
< >
< div className = "edit-site-sidebar-navigation-screen-patterns__group-header" >
< Heading level = { 2 } >
{ __ ( 'Style' , 'woocommerce' ) }
< / Heading >
< / div >
< ItemGroup >
< NavigatorButton
as = { SidebarNavigationItem }
2023-09-12 06:32:50 +00:00
path = "/customize-store/assembler-hub/logo"
2023-08-28 01:28:05 +00:00
withChevron
icon = { siteLogo }
2023-09-19 03:37:46 +00:00
onClick = { ( ) = > {
2024-06-11 13:26:04 +00:00
const logoUrl = getNewPath (
{ customizing : true } ,
'/customize-store/assembler-hub/logo' ,
{ }
) ;
navigateTo ( { url : logoUrl } ) ;
navigate (
SidebarNavigationAnimationDirection . Forward
) ;
2024-04-23 17:38:06 +00:00
trackEvent (
2023-09-19 03:37:46 +00:00
'customize_your_store_assembler_hub_sidebar_item_click' ,
{
item : 'logo' ,
}
) ;
} }
2023-08-28 01:28:05 +00:00
>
{ __ ( 'Add your logo' , 'woocommerce' ) }
< / NavigatorButton >
< NavigatorButton
as = { SidebarNavigationItem }
2023-09-12 06:32:50 +00:00
path = "/customize-store/assembler-hub/color-palette"
2023-08-28 01:28:05 +00:00
withChevron
icon = { color }
2023-09-19 03:37:46 +00:00
onClick = { ( ) = > {
2024-06-11 13:26:04 +00:00
const colorPaletteUrl = getNewPath (
{ customizing : true } ,
'/customize-store/assembler-hub/color-palette' ,
{ }
) ;
navigateTo ( { url : colorPaletteUrl } ) ;
navigate (
SidebarNavigationAnimationDirection . Forward
) ;
2024-04-23 17:38:06 +00:00
trackEvent (
2023-09-19 03:37:46 +00:00
'customize_your_store_assembler_hub_sidebar_item_click' ,
{
item : 'color-palette' ,
}
) ;
} }
2023-08-28 01:28:05 +00:00
>
2024-02-22 08:48:49 +00:00
{ aiOnline
? __ (
'Change the color palette' ,
'woocommerce'
)
: __ (
'Choose your color palette' ,
'woocommerce'
) }
2023-08-28 01:28:05 +00:00
< / NavigatorButton >
< NavigatorButton
as = { SidebarNavigationItem }
2023-09-12 06:32:50 +00:00
path = "/customize-store/assembler-hub/typography"
2023-08-28 01:28:05 +00:00
withChevron
icon = { typography }
2023-09-19 03:37:46 +00:00
onClick = { ( ) = > {
2024-06-11 13:26:04 +00:00
const typographyUrl = getNewPath (
{ customizing : true } ,
'/customize-store/assembler-hub/typography' ,
{ }
) ;
navigateTo ( { url : typographyUrl } ) ;
navigate (
SidebarNavigationAnimationDirection . Forward
) ;
2024-04-23 17:38:06 +00:00
trackEvent (
2023-09-19 03:37:46 +00:00
'customize_your_store_assembler_hub_sidebar_item_click' ,
{
item : 'typography' ,
}
) ;
} }
2023-08-28 01:28:05 +00:00
>
2024-02-22 08:48:49 +00:00
{ aiOnline
? __ ( 'Change fonts' , 'woocommerce' )
: __ ( 'Choose fonts' , 'woocommerce' ) }
2023-08-28 01:28:05 +00:00
< / NavigatorButton >
< / ItemGroup >
< div className = "edit-site-sidebar-navigation-screen-patterns__group-header" >
< Heading level = { 2 } >
{ __ ( 'Layout' , 'woocommerce' ) }
< / Heading >
< / div >
< ItemGroup >
< NavigatorButton
as = { SidebarNavigationItem }
2023-09-12 06:32:50 +00:00
path = "/customize-store/assembler-hub/header"
2023-08-28 01:28:05 +00:00
withChevron
icon = { header }
2023-09-19 03:37:46 +00:00
onClick = { ( ) = > {
2024-06-11 13:26:04 +00:00
const headerUrl = getNewPath (
{ customizing : true } ,
'/customize-store/assembler-hub/header' ,
{ }
) ;
navigateTo ( { url : headerUrl } ) ;
navigate (
SidebarNavigationAnimationDirection . Forward
) ;
2024-04-23 17:38:06 +00:00
trackEvent (
2023-09-19 03:37:46 +00:00
'customize_your_store_assembler_hub_sidebar_item_click' ,
{
item : 'header' ,
}
) ;
} }
2023-08-28 01:28:05 +00:00
>
2024-02-22 08:48:49 +00:00
{ aiOnline
? __ ( 'Change your header' , 'woocommerce' )
: __ ( 'Choose your header' , 'woocommerce' ) }
2023-08-28 01:28:05 +00:00
< / NavigatorButton >
< NavigatorButton
as = { SidebarNavigationItem }
2023-09-12 06:32:50 +00:00
path = "/customize-store/assembler-hub/homepage"
2023-08-28 01:28:05 +00:00
withChevron
icon = { home }
2023-09-19 03:37:46 +00:00
onClick = { ( ) = > {
2024-07-02 11:56:34 +00:00
const homepageUrl =
isFullComposabilityFeatureAndAPIAvailable ( )
? getNewPath (
{ customizing : true } ,
'/customize-store/assembler-hub/homepage/intro' ,
{ }
)
: getNewPath (
{ customizing : true } ,
'/customize-store/assembler-hub/homepage' ,
{ }
) ;
2024-06-11 13:26:04 +00:00
navigateTo ( { url : homepageUrl } ) ;
navigate (
SidebarNavigationAnimationDirection . Forward
) ;
2024-04-23 17:38:06 +00:00
trackEvent (
2023-09-19 03:37:46 +00:00
'customize_your_store_assembler_hub_sidebar_item_click' ,
{
item : 'home' ,
}
) ;
} }
2023-08-28 01:28:05 +00:00
>
2024-02-22 08:48:49 +00:00
{ aiOnline
? __ ( 'Change your homepage' , 'woocommerce' )
: __ ( 'Design your homepage' , 'woocommerce' ) }
2023-08-28 01:28:05 +00:00
< / NavigatorButton >
< NavigatorButton
as = { SidebarNavigationItem }
2023-09-12 06:32:50 +00:00
path = "/customize-store/assembler-hub/footer"
2023-08-28 01:28:05 +00:00
withChevron
icon = { footer }
2023-09-19 03:37:46 +00:00
onClick = { ( ) = > {
2024-06-11 13:26:04 +00:00
const footerUrl = getNewPath (
{ customizing : true } ,
'/customize-store/assembler-hub/footer' ,
{ }
) ;
navigateTo ( { url : footerUrl } ) ;
navigate (
SidebarNavigationAnimationDirection . Forward
) ;
2024-04-23 17:38:06 +00:00
trackEvent (
2023-09-19 03:37:46 +00:00
'customize_your_store_assembler_hub_sidebar_item_click' ,
{
item : 'footer' ,
}
) ;
} }
2023-08-28 01:28:05 +00:00
>
2024-02-22 08:48:49 +00:00
{ aiOnline
? __ ( 'Change your footer' , 'woocommerce' )
: __ ( 'Choose your footer' , 'woocommerce' ) }
2023-08-28 01:28:05 +00:00
< / NavigatorButton >
2023-09-19 03:37:46 +00:00
{ /* TODO: Turn on this in Phrase 2 */ }
{ / * < N a v i g a t o r B u t t o n
2023-08-28 01:28:05 +00:00
as = { SidebarNavigationItem }
2023-09-12 06:32:50 +00:00
path = "/customize-store/assembler-hub/pages"
2023-08-28 01:28:05 +00:00
withChevron
icon = { pages }
>
{ __ ( 'Add and edit other pages' , 'woocommerce' ) }
2023-09-19 03:37:46 +00:00
< / NavigatorButton > * / }
2023-08-28 01:28:05 +00:00
< / ItemGroup >
< / >
}
/ >
) ;
} ;