/*
* External dependencies
*/
import { speakToneIcon } from '@automattic/jetpack-ai-client';
import {
MenuItem,
MenuGroup,
ToolbarDropdownMenu,
DropdownMenu,
Icon,
Button,
Tooltip,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { chevronRight } from '@wordpress/icons';
import React from 'react';
/**
* Internal dependencies
*/
import './style.scss';
const PROMPT_TONES_LIST = [
'formal',
'informal',
'optimistic',
// 'pessimistic',
'humorous',
'serious',
'skeptical',
'empathetic',
// 'enthusiastic',
// 'neutral',
'confident',
// 'curious',
// 'respectful',
'passionate',
// 'cautious',
'provocative',
// 'inspirational',
// 'satirical',
// 'dramatic',
// 'mysterious',
] as const;
export const DEFAULT_PROMPT_TONE = 'formal';
export const PROMPT_TONES_MAP = {
formal: {
label: __( 'Formal', 'jetpack' ),
emoji: '๐ฉ',
},
informal: {
label: __( 'Informal', 'jetpack' ),
emoji: '๐',
},
optimistic: {
label: __( 'Optimistic', 'jetpack' ),
emoji: '๐',
},
// pessimistic: {
// label: __( 'Pessimistic', 'jetpack' ),
// emoji: 'โน๏ธ',
// },
humorous: {
label: __( 'Humorous', 'jetpack' ),
emoji: '๐',
},
serious: {
label: __( 'Serious', 'jetpack' ),
emoji: '๐',
},
skeptical: {
label: __( 'Skeptical', 'jetpack' ),
emoji: '๐คจ',
},
empathetic: {
label: __( 'Empathetic', 'jetpack' ),
emoji: '๐',
},
// enthusiastic: {
// label: __( 'Enthusiastic', 'jetpack' ),
// emoji: '๐คฉ',
// },
// neutral: {
// label: __( 'Neutral', 'jetpack' ),
// emoji: '๐ถ',
// },
confident: {
label: __( 'Confident', 'jetpack' ),
emoji: '๐',
},
// curious: {
// label: __( 'Curious', 'jetpack' ),
// emoji: '๐ง',
// },
// respectful: {
// label: __( 'Respectful', 'jetpack' ),
// emoji: '๐',
// },
passionate: {
label: __( 'Passionate', 'jetpack' ),
emoji: 'โค๏ธ',
},
// cautious: {
// label: __( 'Cautious', 'jetpack' ),
// emoji: '๐ง',
// },
provocative: {
label: __( 'Provocative', 'jetpack' ),
emoji: '๐ฅ',
},
// inspirational: {
// label: __( 'Inspirational', 'jetpack' ),
// emoji: 'โจ',
// },
// satirical: {
// label: __( 'Satirical', 'jetpack' ),
// emoji: '๐',
// },
// dramatic: {
// label: __( 'Dramatic', 'jetpack' ),
// emoji: '๐ญ',
// },
// mysterious: {
// label: __( 'Mysterious', 'jetpack' ),
// emoji: '๐ฎ',
// },
};
export type ToneProp = ( typeof PROMPT_TONES_LIST )[ number ];
type ToneToolbarDropdownMenuProps = {
value?: ToneProp;
onChange: ( value: ToneProp ) => void;
label?: string;
disabled?: boolean;
};
const ToneMenuGroup = ( { value, onChange }: ToneToolbarDropdownMenuProps ) => (
{ PROMPT_TONES_LIST.map( tone => {
return (
);
} ) }
);
export function ToneDropdownMenu( {
label = __( 'Change tone', 'jetpack' ),
value = DEFAULT_PROMPT_TONE,
onChange,
disabled = false,
}: ToneToolbarDropdownMenuProps ) {
return (
{ label }
>
),
disabled,
} }
>
{ ( { onClose } ) => (
{
onChange( newTone );
onClose();
} }
/>
) }
);
}
export default function ToneToolbarDropdownMenu( {
value = DEFAULT_PROMPT_TONE,
onChange,
disabled = false,
}: ToneToolbarDropdownMenuProps ) {
const label = __( 'Change tone', 'jetpack' );
return disabled ? (
) : (
{ () => }
);
}