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

[77] Move no theme.json file found error message so it displays correctly. #78

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
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
129 changes: 64 additions & 65 deletions src/editor/components/ThemerComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@ const ThemerComponent = () => {
);
};

if ( validThemeJson?.error_type === 'error' ) {
return (
<ThemerNotice
status={ validThemeJson?.error_type }
message={ validThemeJson?.message }
isDismissible={ false }
/>
);
}

if ( ! themeConfig || ! previewCss || ! globalStylesId ) {
return (
<>
Expand Down Expand Up @@ -216,73 +226,62 @@ const ThemerComponent = () => {
setUserConfig,
} }
>
<ThemerNotice
status={ validThemeJson?.error_type }
message={ validThemeJson?.message }
isDismissible={ false }
/>
{ validThemeJson === true && (
<>
<div className="themer-topbar">
<Button
isSecondary
onClick={ () => reset() }
text="Reset"
disabled={ ! hasUnsavedChanges }
/>
<Button
isPrimary
onClick={ () => save() }
text="Save"
disabled={ ! hasUnsavedChanges }
/>
<MoreMenuDropdown>
{ () => (
<MenuGroup
label={ __( 'Tools', 'themer' ) }
className="themer-more-menu"
>
<ButtonExport />
<MenuItem
role="menuitem"
icon={ trash }
info={ __(
'Resets all customisations to your initial theme.json configuration.',
'themer'
) }
onClick={ () =>
clearAllCustomisations()
}
isDestructive
>
{ __(
'Clear all customisations',
'themer'
) }
</MenuItem>
</MenuGroup>
) }
</MoreMenuDropdown>
<div className="themer-topbar">
<Button
isSecondary
onClick={ () => reset() }
text="Reset"
disabled={ ! hasUnsavedChanges }
/>
<Button
isPrimary
onClick={ () => save() }
text="Save"
disabled={ ! hasUnsavedChanges }
/>
<MoreMenuDropdown>
{ () => (
<MenuGroup
label={ __( 'Tools', 'themer' ) }
className="themer-more-menu"
>
<ButtonExport />
<MenuItem
role="menuitem"
icon={ trash }
info={ __(
'Resets all customisations to your initial theme.json configuration.',
'themer'
) }
onClick={ () =>
clearAllCustomisations()
}
isDestructive
>
{ __(
'Clear all customisations',
'themer'
) }
</MenuItem>
</MenuGroup>
) }
</MoreMenuDropdown>
</div>
<NavigatorProvider initialPath="/">
<div className="themer-body">
<div className="themer-nav-container">
<Nav />
</div>
<NavigatorProvider initialPath="/">
<div className="themer-body">
<div className="themer-nav-container">
<Nav />
</div>
<div className="themer-content-container">
<div className="themer-styles-container">
<StylesPanel />
</div>
<div className="themer-code-view-container">
<CodeView
themeConfig={ themeConfig }
/>
</div>
</div>
<div className="themer-content-container">
<div className="themer-styles-container">
<StylesPanel />
</div>
<div className="themer-code-view-container">
<CodeView themeConfig={ themeConfig } />
</div>
</NavigatorProvider>
</>
) }
</div>
</div>
</NavigatorProvider>
</StylesContext.Provider>
</EditorContext.Provider>
</>
Expand Down