mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Small AdminX UI improments (#17758)
refs. https://github.com/TryGhost/Product/issues/3349 - added static Preview button to Tips and Donations - updated modal buttons in Design settigns, so it doesn't close on save and easier to play around with various settings
This commit is contained in:
parent
5b896eb0f7
commit
ab36892799
6 changed files with 15 additions and 13 deletions
|
@ -7,7 +7,7 @@ interface DesktopChromeProps {
|
||||||
const DesktopChrome: React.FC<DesktopChromeProps & React.HTMLAttributes<HTMLDivElement>> = ({children, ...props}) => {
|
const DesktopChrome: React.FC<DesktopChromeProps & React.HTMLAttributes<HTMLDivElement>> = ({children, ...props}) => {
|
||||||
return (
|
return (
|
||||||
<div className='flex h-full w-full flex-col px-5 pb-5' {...props}>
|
<div className='flex h-full w-full flex-col px-5 pb-5' {...props}>
|
||||||
<div className="h-full w-full overflow-hidden rounded-[4px] shadow-xl">
|
<div className="h-full w-full overflow-hidden rounded-[4px] shadow-sm">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -41,6 +41,7 @@ export const ConfirmationModalContent: React.FC<ConfirmationModalProps> = ({
|
||||||
size={540}
|
size={540}
|
||||||
testId='confirmation-modal'
|
testId='confirmation-modal'
|
||||||
title={title}
|
title={title}
|
||||||
|
formSheet
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
onOk={async () => {
|
onOk={async () => {
|
||||||
setTaskState('running');
|
setTaskState('running');
|
||||||
|
|
|
@ -193,7 +193,6 @@ export const PreviewModalContent: React.FC<PreviewModalProps> = ({
|
||||||
key: 'ok-modal',
|
key: 'ok-modal',
|
||||||
label: okLabel,
|
label: okLabel,
|
||||||
color: okColor,
|
color: okColor,
|
||||||
className: 'min-w-[80px]',
|
|
||||||
onClick: onOk,
|
onClick: onOk,
|
||||||
disabled: buttonsDisabled
|
disabled: buttonsDisabled
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import Button from '../../../admin-x-ds/global/Button';
|
import Button from '../../../admin-x-ds/global/Button';
|
||||||
|
import Heading from '../../../admin-x-ds/global/Heading';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Select from '../../../admin-x-ds/global/form/Select';
|
import Select from '../../../admin-x-ds/global/form/Select';
|
||||||
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
|
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
|
||||||
|
@ -26,13 +27,19 @@ const TipsOrDonations: React.FC<{ keywords: string[] }> = ({keywords}) => {
|
||||||
value: '$12'
|
value: '$12'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
heading: 'Sharable link',
|
heading: '',
|
||||||
key: 'sharable-link',
|
key: 'sharable-link',
|
||||||
value: (
|
value: (
|
||||||
<div className='w-100 group relative -m-1 overflow-hidden rounded p-1 hover:bg-grey-50'>
|
<div className='w-100'>
|
||||||
|
<div className='flex items-center gap-2'>
|
||||||
|
<Heading level={6}>Sharable link —</Heading>
|
||||||
|
<a className='text-2xs font-semibold uppercase tracking-wider text-green' href="https://ghost.org" rel="noopener noreferrer" target="_blank">Preview</a>
|
||||||
|
</div>
|
||||||
|
<div className='w-100 group relative -m-1 mt-0 overflow-hidden rounded p-1 hover:bg-grey-50'>
|
||||||
https://example.com/tip
|
https://example.com/tip
|
||||||
<div className='invisible absolute right-0 top-[50%] flex translate-y-[-50%] gap-1 bg-white pl-1 group-hover:visible'>
|
<div className='invisible absolute right-0 top-[50%] flex translate-y-[-50%] gap-1 bg-white pl-1 group-hover:visible'>
|
||||||
<Button color='outline' label='Copy' size='sm' />
|
<Button color='outline' label='Copy' size='sm' />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
@ -213,9 +213,10 @@ const DesignModal: React.FC = () => {
|
||||||
updateRoute('design');
|
updateRoute('design');
|
||||||
}}
|
}}
|
||||||
buttonsDisabled={saveState === 'saving'}
|
buttonsDisabled={saveState === 'saving'}
|
||||||
|
cancelLabel='Close'
|
||||||
defaultTab='homepage'
|
defaultTab='homepage'
|
||||||
dirty={saveState === 'unsaved'}
|
dirty={saveState === 'unsaved'}
|
||||||
okLabel={saveState === 'saved' ? 'Saved' : (saveState === 'saving' ? 'Saving...' : 'Save & close')}
|
okLabel={saveState === 'saved' ? 'Saved' : (saveState === 'saving' ? 'Saving...' : 'Save')}
|
||||||
preview={previewContent}
|
preview={previewContent}
|
||||||
previewToolbarTabs={previewTabs}
|
previewToolbarTabs={previewTabs}
|
||||||
selectedURL={selectedPreviewTab}
|
selectedURL={selectedPreviewTab}
|
||||||
|
@ -226,8 +227,6 @@ const DesignModal: React.FC = () => {
|
||||||
title='Design'
|
title='Design'
|
||||||
onOk={async () => {
|
onOk={async () => {
|
||||||
await handleSave();
|
await handleSave();
|
||||||
modal.remove();
|
|
||||||
updateRoute('design');
|
|
||||||
}}
|
}}
|
||||||
onSelectURL={onSelectURL}
|
onSelectURL={onSelectURL}
|
||||||
/>;
|
/>;
|
||||||
|
|
|
@ -82,8 +82,6 @@ test.describe('Design settings', async () => {
|
||||||
await modal.getByLabel('Site description').fill('new description');
|
await modal.getByLabel('Site description').fill('new description');
|
||||||
await modal.getByRole('button', {name: 'Save'}).click();
|
await modal.getByRole('button', {name: 'Save'}).click();
|
||||||
|
|
||||||
await expect(modal).not.toBeVisible();
|
|
||||||
|
|
||||||
expect(lastPreviewRequest.previewHeader).toMatch(/&d=new\+description&/);
|
expect(lastPreviewRequest.previewHeader).toMatch(/&d=new\+description&/);
|
||||||
|
|
||||||
expect(lastApiRequests.editSettings?.body).toEqual({
|
expect(lastApiRequests.editSettings?.body).toEqual({
|
||||||
|
@ -132,8 +130,6 @@ test.describe('Design settings', async () => {
|
||||||
await modal.getByLabel('Navigation layout').selectOption('Logo in the middle');
|
await modal.getByLabel('Navigation layout').selectOption('Logo in the middle');
|
||||||
await modal.getByRole('button', {name: 'Save'}).click();
|
await modal.getByRole('button', {name: 'Save'}).click();
|
||||||
|
|
||||||
await expect(modal).not.toBeVisible();
|
|
||||||
|
|
||||||
const expectedSettings = {navigation_layout: 'Logo in the middle'};
|
const expectedSettings = {navigation_layout: 'Logo in the middle'};
|
||||||
const expectedEncoded = new URLSearchParams([['custom', JSON.stringify(expectedSettings)]]).toString();
|
const expectedEncoded = new URLSearchParams([['custom', JSON.stringify(expectedSettings)]]).toString();
|
||||||
expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`));
|
expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`));
|
||||||
|
|
Loading…
Add table
Reference in a new issue