File size: 1,935 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
import { isEnabled } from '@automattic/calypso-config';
import { SelectItem, SelectItemAlt } from '@automattic/onboarding';
import { useTranslate } from 'i18n-calypso';
import { build, write, shoppingCart } from '../../icons';
import type { IntentFlag } from './types';
type Intent = SelectItem< IntentFlag >;
type IntentAlt = SelectItemAlt< IntentFlag >;
export const useIntents = (): Intent[] => {
const translate = useTranslate();
const intents: Intent[] = [
{
key: 'write',
title: translate( 'Write' ),
description: <p>{ translate( 'Share your ideas with the world' ) }</p>,
icon: write,
value: 'write',
actionText: translate( 'Start writing' ),
},
{
key: 'build',
title: translate( 'Build' ),
description: <p>{ translate( 'Begin creating your website' ) }</p>,
icon: build,
value: 'build',
actionText: translate( 'Start building' ),
},
];
if ( isEnabled( 'seller-experience' ) ) {
intents.push( {
key: 'sell',
title: translate( 'Sell' ),
description: <p>{ translate( 'Set up an online store' ) }</p>,
icon: shoppingCart,
value: 'sell',
actionText: translate( 'Start selling' ),
} );
}
return intents;
};
export const useIntentsAlt = ( canImport: boolean ): IntentAlt[] => {
const translate = useTranslate();
return [
{
show: true,
key: 'wpadmin',
description: translate( "Know what you're doing?" ),
value: 'wpadmin',
disable: false,
disableText: '',
actionText: translate( 'Start from scratch' ),
},
{
show: isEnabled( 'onboarding/import' ),
key: 'import',
description: translate( 'Already have an existing website?' ),
value: 'import',
actionText: translate( 'Import your site content' ),
disable: ! canImport,
disableText: translate(
"You're not authorized to import content.{{br/}}Please check with your site admin.",
{
components: {
br: <br />,
},
}
),
},
];
};
|