merge: 合入总仓库 weiyuan(bfdfb339) web/ 新功能,保留 ui-optimization 的 UI 重构
来源:luoguang/monkey-ai weiyuan@bfdfb339 的 web/(经 sync/main-weiyuan-web-bfdfb339 同步)
同步基准:总仓库 a2ca13cb = 本仓库初始导入 d8f3aee2
冲突处理原则:保留 ui-optimization 的 UI(样式/结构/组件),嫁接 weiyuan 的功能逻辑。
- i18n:按键三方合并;ours 的「令牌→密钥」改名键上移植 theirs 的术语修订
- task-logs / OrgLogs:ours 已手工移植同一功能(6ad95e2),保留 ours
- 删除:OrgCreate(theirs 下线 /org/create)、旧 image 组件与 VideoRegenerateModal(theirs 体验中心重写)、
OrgAvatarSection / PricingBentoPage / CommissionConsole(ours 重构中已移除)
- 测试:users-pagination 的 i18next mock 补 t();theirs 新增文件补 license header
This commit is contained in:
@@ -17,10 +17,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, { useContext } from 'react';
|
||||
import { Navigate, useLocation, useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { BrainCircuit, Image, Video } from 'lucide-react';
|
||||
import { StatusContext } from '../../context/Status';
|
||||
import { useMarquee } from '../../hooks/common/useMarquee';
|
||||
import PageBackground from '../../components/common/PageBackground';
|
||||
import TextModel from './components/TextModel';
|
||||
@@ -32,13 +33,19 @@ import CloudBrain from '../CloudBrain';
|
||||
import { CLOUD_BRAIN_UI_ENABLED } from '../../config/cloudBrainUi';
|
||||
import Loading from '../../components/common/ui/Loading';
|
||||
import { DEFAULT_LOGIN_REDIRECT } from '../../helpers/data';
|
||||
import { isCreationStudioEnabled } from '../../helpers/creationStudio';
|
||||
import { badgeText } from '../../hooks/creation/creationWatch';
|
||||
import {
|
||||
useCreationUnread,
|
||||
useCreationWatchPoller,
|
||||
} from '../../hooks/creation/useCreationWatch';
|
||||
import {
|
||||
EXPERIENCE_MODULES,
|
||||
useExperienceModules,
|
||||
} from './useExperienceModules';
|
||||
|
||||
// 移动端底部导航组件
|
||||
const MobileBottomNav = ({ currentPath, navigate, isAvailable }) => {
|
||||
// 移动端底部导航组件(exp-mobile-bottom-nav:新创作台展开态期间由 creation-dock.css 隐藏)
|
||||
const MobileBottomNav = ({ currentPath, navigate, isAvailable, unread }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
// 与桌面侧边栏共用 useExperienceModules 判定,运营关闭的子页两端一致隐藏
|
||||
@@ -59,6 +66,7 @@ const MobileBottomNav = ({ currentPath, navigate, isAvailable }) => {
|
||||
label: t('图片'),
|
||||
path: '/experience-center/image-generation',
|
||||
gradient: 'from-pink-500 to-rose-600',
|
||||
unread: unread?.image || 0,
|
||||
},
|
||||
{
|
||||
key: 'video',
|
||||
@@ -67,11 +75,12 @@ const MobileBottomNav = ({ currentPath, navigate, isAvailable }) => {
|
||||
label: t('视频'),
|
||||
path: '/experience-center/video-generation',
|
||||
gradient: 'from-cyan-500 to-blue-600',
|
||||
unread: unread?.video || 0,
|
||||
},
|
||||
].filter((item) => isAvailable(item.configKey));
|
||||
|
||||
return (
|
||||
<div className='md:hidden fixed bottom-0 left-0 right-0 z-50 bg-white/90 dark:bg-neutral-900/90 backdrop-blur-xl border-t border-gray-200/80 dark:border-neutral-800/80 safe-area-inset-bottom'>
|
||||
<div className='exp-mobile-bottom-nav md:hidden fixed bottom-0 left-0 right-0 z-50 bg-white/90 dark:bg-neutral-900/90 backdrop-blur-xl border-t border-gray-200/80 dark:border-neutral-800/80 safe-area-inset-bottom'>
|
||||
<div className='flex items-center justify-around h-14'>
|
||||
{navItems.map((item) => {
|
||||
const isActive = currentPath.includes(item.key);
|
||||
@@ -109,6 +118,14 @@ const MobileBottomNav = ({ currentPath, navigate, isAvailable }) => {
|
||||
BETA
|
||||
</span>
|
||||
)}
|
||||
{item.unread > 0 && !isActive ? (
|
||||
<span
|
||||
className='exp-unread-badge absolute top-1 right-[22%]'
|
||||
aria-label={t('{{n}} 个新作品', { n: item.unread })}
|
||||
>
|
||||
{badgeText(item.unread)}
|
||||
</span>
|
||||
) : null}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
@@ -120,10 +137,15 @@ const MobileBottomNav = ({ currentPath, navigate, isAvailable }) => {
|
||||
const ExperienceCenter = () => {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const [statusState] = useContext(StatusContext);
|
||||
const { ready, orgOnly, isAvailable, defaultPath } = useExperienceModules();
|
||||
|
||||
// 跑马灯公告是否存在(用于动态计算顶部间距)
|
||||
const { visible: hasMarquee } = useMarquee();
|
||||
// 新创作台:用户在体验中心其他页面时轻量轮询已提交的任务,完成后显示未读角标(WP C-4)
|
||||
const creationStudioEnabled = isCreationStudioEnabled(statusState?.status);
|
||||
useCreationWatchPoller(creationStudioEnabled);
|
||||
const unread = useCreationUnread(creationStudioEnabled);
|
||||
|
||||
// 默认落地:进第一个对当前用户可用的子页;一个都没有时,org_only 用户回企业
|
||||
// 空间,其余用户去默认登录落地页。兜底目标都不在体验中心内,不会重定向循环。
|
||||
@@ -162,13 +184,17 @@ const ExperienceCenter = () => {
|
||||
return <Navigate to='/experience-center' replace />;
|
||||
}
|
||||
|
||||
// 新创作台:视口高度用 dvh,微信 H5 / 移动端键盘弹起时底部创作台与生成按钮保持可见
|
||||
const dynamicViewport =
|
||||
(isVideoGeneration || isImageGeneration) && creationStudioEnabled;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`flex flex-col md:flex-row h-screen bg-[var(--surface-bg-base)] overflow-hidden ${hasMarquee ? 'pt-[91px] md:pt-[107px]' : 'pt-14 md:pt-[72px]'}`}
|
||||
className={`flex flex-col md:flex-row ${dynamicViewport ? 'h-screen supports-[height:100dvh]:h-dvh' : 'h-screen'} bg-[var(--surface-bg-base)] overflow-hidden ${hasMarquee ? 'pt-[91px] md:pt-[107px]' : 'pt-14 md:pt-[72px]'}`}
|
||||
>
|
||||
{/* Sidebar - 桌面端 */}
|
||||
<div className='hidden md:block'>
|
||||
<ExperienceSidebar />
|
||||
<ExperienceSidebar unread={unread} />
|
||||
</div>
|
||||
|
||||
{/* Main Content */}
|
||||
@@ -210,6 +236,7 @@ const ExperienceCenter = () => {
|
||||
currentPath={location.pathname}
|
||||
navigate={navigate}
|
||||
isAvailable={isAvailable}
|
||||
unread={unread}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user