feat(home): add help center quick operation link
- Add helpCenter.svg and helpCenter_active.svg menu icons for help center navigation - Add "Help Center" translation strings to English and Chinese i18n files - Update QuickOperation component to include help center as fourth quick operation - Implement external link handler that opens help documentation based on current language (zh or en) - Change grid layout from 3 columns to 4 columns to accommodate new help center card - Add file header documentation to QuickOperation component - Help center link redirects to https://docs.redbearai.com/s/{lang}-memorybear with language-specific routing
This commit is contained in:
14
web/src/assets/images/menu/helpCenter.svg
Normal file
14
web/src/assets/images/menu/helpCenter.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>使用帮助备份</title>
|
||||
<g id="v0.2.0" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="首页" transform="translate(-51, -358)" stroke="#5F6266">
|
||||
<g id="使用帮助备份" transform="translate(51, 358)">
|
||||
<g id="编组-35" transform="translate(2, 1.5)">
|
||||
<path d="M6.13163525,1.97938144 L10.3064533,1.97938144 C11.2417733,1.97938144 12,2.70634106 12,3.6030912 L12,10.3762902 C12,11.2730404 11.2417733,12 10.3064533,12 L1.69354673,12 C0.758226699,12 0,11.2730404 0,10.3762902 L0,3.6030912 C0,2.70634106 0.758226699,1.97938144 1.69354673,1.97938144 L2.02448435,1.97938144 L2.02448435,1.97938144" id="路径"></path>
|
||||
<path d="M3.52033177,0.78470905 L6.09032258,1.97938144 L6.09032258,1.97938144 L6.09032258,11.8762887 L2.51918436,10.2162282 C2.10022604,10.0214734 1.83225806,9.6014016 1.83225806,9.13938916 L1.83225806,1.86154804 C1.83225806,1.2057099 2.36391992,0.674048044 3.01975806,0.674048044 C3.19268295,0.674048044 3.36352144,0.711815028 3.52033177,0.78470905 Z" id="矩形" stroke-linejoin="round"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
14
web/src/assets/images/menu/helpCenter_active.svg
Normal file
14
web/src/assets/images/menu/helpCenter_active.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>使用帮助</title>
|
||||
<g id="v0.2.0" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="首页" transform="translate(-24, -358)" stroke="#212332">
|
||||
<g id="使用帮助" transform="translate(24, 358)">
|
||||
<g id="编组-35" transform="translate(2, 1.5)">
|
||||
<path d="M6.13163525,1.97938144 L10.3064533,1.97938144 C11.2417733,1.97938144 12,2.70634106 12,3.6030912 L12,10.3762902 C12,11.2730404 11.2417733,12 10.3064533,12 L1.69354673,12 C0.758226699,12 0,11.2730404 0,10.3762902 L0,3.6030912 C0,2.70634106 0.758226699,1.97938144 1.69354673,1.97938144 L2.02448435,1.97938144 L2.02448435,1.97938144" id="路径"></path>
|
||||
<path d="M3.52033177,0.78470905 L6.09032258,1.97938144 L6.09032258,1.97938144 L6.09032258,11.8762887 L2.51918436,10.2162282 C2.10022604,10.0214734 1.83225806,9.6014016 1.83225806,9.13938916 L1.83225806,1.86154804 C1.83225806,1.2057099 2.36391992,0.674048044 3.01975806,0.674048044 C3.19268295,0.674048044 3.36352144,0.711815028 3.52033177,0.78470905 Z" id="矩形" stroke-linejoin="round"></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -91,6 +91,7 @@ export const en = {
|
||||
memberManagement: 'Member Management',
|
||||
memorySummary: 'Memory Summary',
|
||||
memoryConversation: 'Memory Validation',
|
||||
helpCenter: 'Help Center',
|
||||
memorySummaryHandlers: 'Memory Summary Handlers',
|
||||
createMemorySummary: 'Create Memory Summary',
|
||||
memoryManagement: 'Memory Management',
|
||||
@@ -190,7 +191,8 @@ export const en = {
|
||||
|
||||
memoryConversation: 'Memory Conversation',
|
||||
memoryConversationDesc: 'Memory Conversation',
|
||||
|
||||
helpCenter: 'Help Center',
|
||||
helpCenterDesc: 'Help Center',
|
||||
memorySummary: 'View Memory Summary',
|
||||
memorySummaryDesc: 'View Memory Summary Report',
|
||||
|
||||
@@ -616,6 +618,7 @@ export const en = {
|
||||
retrieve:'Retrieve',
|
||||
processing: 'Processing',
|
||||
processingMode: 'Processing Mode',
|
||||
processMsg: 'Processing Message',
|
||||
dataSize: 'Data Size',
|
||||
createUpdateTime: 'Create/Update Time',
|
||||
operation: 'Operation',
|
||||
|
||||
@@ -789,7 +789,8 @@ export const zh = {
|
||||
|
||||
memoryConversation: '记忆对话',
|
||||
memoryConversationDesc: '记忆对话',
|
||||
|
||||
helpCenter: '帮助中心',
|
||||
helpCenterDesc: '帮助中心',
|
||||
memorySummary: '查看记忆摘要',
|
||||
memorySummaryDesc: '查看记忆摘要报告',
|
||||
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* @Description:
|
||||
* @Version: 0.0.1
|
||||
* @Author: yujiangping
|
||||
* @Date: 2026-01-05 17:22:23
|
||||
* @LastEditors: yujiangping
|
||||
* @LastEditTime: 2026-01-15 14:55:51
|
||||
*/
|
||||
import { type FC } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
@@ -5,33 +13,49 @@ import Card from './Card';
|
||||
import applicationIcon from '@/assets/images/menu/application_active.svg';
|
||||
import knowledgeIcon from '@/assets/images/menu/knowledge_active.svg';
|
||||
import memoryConversationIcon from '@/assets/images/menu/memoryConversation_active.svg';
|
||||
import helpCenterIcon from '@/assets/images/menu/helpCenter_active.svg'
|
||||
import arrowTopRight from '@/assets/images/home/arrow_top_right.svg';
|
||||
|
||||
const quickOperations = [
|
||||
{ key: 'createNewApplication', url: '/application' },
|
||||
{ key: 'createNewKnowledge', url: '/knowledge-base' },
|
||||
{ key: 'memoryConversation', url: '/memory-conversation' },
|
||||
{ key: 'helpCenter', url: '' },
|
||||
]
|
||||
|
||||
const quickOperationIcons: {[key: string]: string | undefined} = {
|
||||
createNewApplication: applicationIcon,
|
||||
createNewKnowledge: knowledgeIcon,
|
||||
memoryConversation: memoryConversationIcon,
|
||||
helpCenter: helpCenterIcon
|
||||
}
|
||||
const QuickOperation:FC = () => {
|
||||
const { t } = useTranslation()
|
||||
const { t, i18n } = useTranslation()
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleJump = (url: string | null) => {
|
||||
if (url) {
|
||||
navigate(url)
|
||||
}else{
|
||||
const currentLang = i18n.language;
|
||||
const lang = currentLang === 'zh' ? 'zh' : 'en';
|
||||
const helpUrl = `https://docs.redbearai.com/s/${lang}-memorybear`;
|
||||
|
||||
// 创建隐藏的 a 标签来避免弹窗拦截
|
||||
const link = document.createElement('a');
|
||||
link.href = helpUrl;
|
||||
link.target = '_blank';
|
||||
link.rel = 'noopener noreferrer';
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<Card
|
||||
title={t('dashboard.quickOperation')}
|
||||
>
|
||||
<div className="rb:grid rb:grid-cols-3 rb:gap-[16px]">
|
||||
<div className="rb:grid rb:grid-cols-4 rb:gap-[16px]">
|
||||
{quickOperations.map(item => (
|
||||
<div key={item.key} className="rb:rounded-[8px] rb:p-[20px_16px] rb:border-1 rb:border-[#DFE4ED] rb:cursor-pointer rb:hover:border-[#155EEF]" onClick={() => handleJump(item.url)}>
|
||||
<div className="rb:flex rb:justify-between">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { useEffect, useState, useRef, useCallback, type FC } from 'react';
|
||||
import { useNavigate, useParams, useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Switch, Button, Dropdown, Space, Modal, message, Radio } from 'antd';
|
||||
import { Switch, Button, Dropdown, Space, Modal, message, Radio, Tooltip } from 'antd';
|
||||
import type { MenuProps } from 'antd';
|
||||
import SearchInput from '@/components/SearchInput'
|
||||
import Table, { type TableRef } from '@/components/Table'
|
||||
@@ -564,6 +564,37 @@ const Private: FC = () => {
|
||||
</span>
|
||||
);
|
||||
}
|
||||
},{
|
||||
title: t('knowledgeBase.processMsg'),
|
||||
dataIndex: 'progress_msg',
|
||||
key: 'progress_msg',
|
||||
width: 320,
|
||||
render: (value: string) => {
|
||||
if (!value) return '-';
|
||||
|
||||
// 解析日志格式,将 \n 转换为换行
|
||||
const formattedText = value.replace(/\\n/g, '\n');
|
||||
|
||||
return (
|
||||
<Tooltip title={<pre style={{ margin: 0, whiteSpace: 'pre-wrap' }}>{formattedText}</pre>} placement="topLeft">
|
||||
<div
|
||||
style={{
|
||||
maxWidth: '320px',
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
display: '-webkit-box',
|
||||
WebkitLineClamp: 2,
|
||||
WebkitBoxOrient: 'vertical',
|
||||
lineHeight: '1.5',
|
||||
whiteSpace: 'pre-wrap',
|
||||
wordBreak: 'break-word'
|
||||
}}
|
||||
>
|
||||
{formattedText}
|
||||
</div>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: t('knowledgeBase.processingMode'),
|
||||
|
||||
Reference in New Issue
Block a user