Updated recommendations settings design (#17957)

refs https://github.com/TryGhost/Product/issues/3786, https://github.com/TryGhost/Product/issues/3773

- Moved Recommendations under Memberships section in settings sidebar
- Updated design for recommendations to work better with small favicons
This commit is contained in:
Djordje Vlaisavljevic 2023-09-04 16:21:37 +01:00 committed by GitHub
parent 8ba5470c5e
commit cd4fa044c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 11 deletions

View File

@ -46,7 +46,6 @@ const Sidebar: React.FC = () => {
{/* <SettingNavItem navid='theme' title="Theme" onClick={handleSectionClick} /> */} {/* <SettingNavItem navid='theme' title="Theme" onClick={handleSectionClick} /> */}
<SettingNavItem navid='design' title="Branding and design" onClick={handleSectionClick} /> <SettingNavItem navid='design' title="Branding and design" onClick={handleSectionClick} />
<SettingNavItem navid='navigation' title="Navigation" onClick={handleSectionClick} /> <SettingNavItem navid='navigation' title="Navigation" onClick={handleSectionClick} />
{hasRecommendations && <SettingNavItem navid='recommendations' title="Recommendations" onClick={handleSectionClick} />}
</SettingNavSection> </SettingNavSection>
<SettingNavSection title="Membership"> <SettingNavSection title="Membership">
@ -55,6 +54,7 @@ const Sidebar: React.FC = () => {
<SettingNavItem navid='tiers' title="Tiers" onClick={handleSectionClick} /> <SettingNavItem navid='tiers' title="Tiers" onClick={handleSectionClick} />
{hasTipsAndDonations && <SettingNavItem navid='tips-or-donations' title="Tips or donations" onClick={handleSectionClick} />} {hasTipsAndDonations && <SettingNavItem navid='tips-or-donations' title="Tips or donations" onClick={handleSectionClick} />}
<SettingNavItem navid='analytics' title="Analytics" onClick={handleSectionClick} /> <SettingNavItem navid='analytics' title="Analytics" onClick={handleSectionClick} />
{hasRecommendations && <SettingNavItem navid='recommendations' title="Recommendations" onClick={handleSectionClick} />}
</SettingNavSection> </SettingNavSection>
<SettingNavSection title="Email newsletters"> <SettingNavSection title="Email newsletters">

View File

@ -1,4 +1,3 @@
import Avatar from '../../../../admin-x-ds/global/Avatar';
import Button from '../../../../admin-x-ds/global/Button'; import Button from '../../../../admin-x-ds/global/Button';
import ConfirmationModal from '../../../../admin-x-ds/global/modal/ConfirmationModal'; import ConfirmationModal from '../../../../admin-x-ds/global/modal/ConfirmationModal';
import NiceModal from '@ebay/nice-modal-react'; import NiceModal from '@ebay/nice-modal-react';
@ -42,10 +41,12 @@ const RecommendationItem: React.FC<{recommendation: Recommendation}> = ({recomme
<TableRow action={action} hideActions> <TableRow action={action} hideActions>
<TableCell onClick={showDetails}> <TableCell onClick={showDetails}>
<div className='group flex items-center gap-3 hover:cursor-pointer'> <div className='group flex items-center gap-3 hover:cursor-pointer'>
{recommendation.favicon && <Avatar image={recommendation.favicon} labelColor='white' />}
<div className={`flex grow flex-col`}> <div className={`flex grow flex-col`}>
<span className='mb-0.5 font-medium'>{recommendation.title}</span> <div className="mb-1 flex items-center gap-2">
<span className='text-xs leading-snug text-grey-700'>{recommendation.reason || 'No reason'}</span> {recommendation.favicon && <img alt={recommendation.title} className="h-5 w-5 rounded-sm" src={recommendation.favicon} />}
<span className='line-clamp-1'>{recommendation.title}</span>
</div>
<span className='line-clamp-1 text-xs leading-snug text-grey-700'>{recommendation.reason || 'No reason added'}</span>
</div> </div>
</div> </div>
</TableCell> </TableCell>

View File

@ -1,4 +1,3 @@
import Avatar from '../../../../admin-x-ds/global/Avatar';
import Form from '../../../../admin-x-ds/global/form/Form'; import Form from '../../../../admin-x-ds/global/form/Form';
import Heading from '../../../../admin-x-ds/global/Heading'; import Heading from '../../../../admin-x-ds/global/Heading';
import React from 'react'; import React from 'react';
@ -20,14 +19,15 @@ const RecommendationReasonForm: React.FC<Props<EditOrAddRecommendation | Recomme
> >
<div> <div>
<Heading className='mb-2 block text-2xs font-semibold uppercase tracking-wider text-grey-700'>Preview</Heading> <Heading className='mb-2 block text-2xs font-semibold uppercase tracking-wider text-grey-700'>Preview</Heading>
<a className='flex items-center gap-3 rounded-sm border border-grey-300 p-3' href={formState.url} rel="noopener noreferrer" target="_blank"> <a className='flex flex-col rounded-sm border border-grey-300 p-3' href={formState.url} rel="noopener noreferrer" target="_blank">
{(formState.favicon || formState.featured_image) && <Avatar image={formState.favicon ?? formState.featured_image!} labelColor='white' />} <div className="mb-1 flex items-center gap-2">
<div className={`flex grow flex-col`}> {(formState.favicon || formState.featured_image) && <img alt={formState.title} className="h-5 w-5 rounded-sm" src={formState.favicon ?? formState.featured_image!} />}
<span className='word-wrap mb-0.5 font-medium'>{formState.title}</span> <span className='line-clamp-1 font-medium'>{formState.title}</span>
<span className='word-wrap text-xs leading-snug text-grey-700'>{formState.url}</span>
</div> </div>
<span className='line-clamp-1 text-xs leading-snug text-grey-700'>{formState.url}</span>
</a> </a>
</div> </div>
<TextField <TextField
error={Boolean(errors.title)} error={Boolean(errors.title)}
hint={errors.title} hint={errors.title}