diff --git a/src/actions/ConversationActions.js b/src/actions/ConversationActions.js index 1d0bec5..c0477e4 100644 --- a/src/actions/ConversationActions.js +++ b/src/actions/ConversationActions.js @@ -12,13 +12,28 @@ import dayjs from 'dayjs'; export const fetchTemplates = async (params) => { const data = await fetchJSON(`${API_HOST}/listtemplates`, params); const canUseTemplates = (data?.result?.items || []) - .filter((_t) => _t.status === 'APPROVED' && _t.name !== 'say_hello_from_trip_advisor') - .map((ele) => ({ ...ele, components_origin: ele.components, components: groupBy(ele.components, (_c) => _c.type.toLowerCase()) })); - const topName = ['free_style_7', 'online_inquiry_received','say_hello_again', 'first_message_for_not_reply', 'free_style_2', 'free_style_1', 'free_style_3', 'free_style_4']; + .filter((_t) => _t.status === 'APPROVED' && !['say_hello_from_trip_advisor','free_style_7','free_style_1'].includes(_t.name)) + .map((ele, i) => ({ ...ele, components_origin: ele.components, components: groupBy(ele.components, (_c) => _c.type.toLowerCase()), key:ele.name, })); + const topName = [ + 'order_updated_specialist_assigned_sharon', + 'online_inquiry_received', + 'say_hello_again', + 'first_message_for_not_reply', + 'order_updated_specialist_assigned_christy', + 'free_style_2', + 'free_style_3', + 'free_style_4', + ] const top = sortArrayByOrder( canUseTemplates.filter((_t) => topName.includes(_t.name)), 'name', topName); const raw = canUseTemplates.filter((_t) => !topName.includes(_t.name)); return [...top, ...raw]; }; +/** + * ↑上面的模板名称bak + * order_updated_specialist_assigned_sharon : free_style_7 + * order_updated_specialist_assigned_christy : free_style_1 + * online_inquiry_received: say_hello_from_trip_advisor + */ export const CONVERSATION_PAGE_SIZE = 20; /** diff --git a/src/views/Conversations/Online/Input/Template.jsx b/src/views/Conversations/Online/Input/Template.jsx index 5ff08dd..090d187 100644 --- a/src/views/Conversations/Online/Input/Template.jsx +++ b/src/views/Conversations/Online/Input/Template.jsx @@ -108,17 +108,21 @@ const CategoryList = ({ dataSource, handleSendTemplate, valueMapped, onInput, ac className=' h-[90%] overflow-y-auto text-slate-900' itemLayout='horizontal' dataSource={dataSource} - rowKey={'name'} + rowKey={'key'} pagination={dataSource.length < 4 ? false : { position: 'bottom', pageSize: 3, align: 'start', size: 'small' }} renderItem={(item, index) => ( - + - {item.components.header?.[0]?.text || item.name}{item.language.toUpperCase()} - {/* {templateCaterogyText[item.category]} */} - {templateCaterogyTipText[item.category] && {templateCaterogyTipText[item.category]}} + + {item.components.header?.[0]?.text || (item.name.includes('specialist') ? `specialist_followup` : item.name)} + + {item.language.toUpperCase()} + + {/* {templateCaterogyText[item.category]} */} + {templateCaterogyTipText[item.category] && {templateCaterogyTipText[item.category]}}