Initial import of weiyuan frontend
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Tabs, TabPane } from '@douyinfe/semi-ui';
|
||||
import { IconImage, IconVideo, IconBolt } from '@douyinfe/semi-icons';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import ImageGenerationTab from './AICreation/ImageGenerationTab';
|
||||
import VideoGenerationTab from './AICreation/VideoGenerationTab';
|
||||
import VideoRemixTab from './AICreation/VideoRemixTab';
|
||||
|
||||
const AICreation = () => {
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const [activeTab, setActiveTab] = useState('image');
|
||||
|
||||
// 从URL中解析当前选中的标签页
|
||||
useEffect(() => {
|
||||
const pathSegments = location.pathname.split('/');
|
||||
let tabKey = pathSegments[pathSegments.length - 1] || 'image';
|
||||
if (tabKey === 'ai-creation') {
|
||||
tabKey = 'image';
|
||||
}
|
||||
setActiveTab(tabKey);
|
||||
}, [location.pathname]);
|
||||
|
||||
// 当标签页变化时,更新URL
|
||||
const handleTabChange = (tabKey) => {
|
||||
setActiveTab(tabKey);
|
||||
navigate(`/experience-center/ai-creation/${tabKey}`);
|
||||
};
|
||||
|
||||
return (
|
||||
<div style={{ padding: '20px' }}>
|
||||
<Tabs
|
||||
activeKey={activeTab}
|
||||
onChange={handleTabChange}
|
||||
type='button'
|
||||
size='large'
|
||||
style={{ marginBottom: '24px' }}
|
||||
>
|
||||
<TabPane
|
||||
tab={
|
||||
<span>
|
||||
<IconImage style={{ marginRight: '8px' }} />
|
||||
{t('图片生成')}
|
||||
</span>
|
||||
}
|
||||
itemKey='image'
|
||||
>
|
||||
<ImageGenerationTab />
|
||||
</TabPane>
|
||||
|
||||
<TabPane
|
||||
tab={
|
||||
<span>
|
||||
<IconVideo style={{ marginRight: '8px' }} />
|
||||
{t('视频生成')}
|
||||
</span>
|
||||
}
|
||||
itemKey='video'
|
||||
>
|
||||
<VideoGenerationTab />
|
||||
</TabPane>
|
||||
|
||||
<TabPane
|
||||
tab={
|
||||
<span>
|
||||
<IconBolt style={{ marginRight: '8px' }} />
|
||||
{t('视频 Remix')}
|
||||
</span>
|
||||
}
|
||||
itemKey='remix'
|
||||
>
|
||||
<VideoRemixTab />
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AICreation;
|
||||
Reference in New Issue
Block a user