Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style: add image/video switch (#13152)

CanisMinor2067cb2300e4
diff --git a/locales/ar/common.json b/locales/ar/common.json
index 6e4b0c1683b..fca0fc81c6d 100644
--- a/locales/ar/common.json
+++ b/locales/ar/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "قيّمنا على GitHub",
"footer.title": "هل أعجبك منتجنا؟",
"fullscreen": "وضع ملء الشاشة",
+ "generation.hero.taglinePrefix": "ابدأ في الإبداع مع",
"getDesktopApp": "احصل على تطبيق سطح المكتب",
"historyRange": "نطاق السجل",
"home.suggestQuestions": "جرّب هذه الأمثلة",
diff --git a/locales/bg-BG/common.json b/locales/bg-BG/common.json
index 8af33a864a1..b0aa862f77e 100644
--- a/locales/bg-BG/common.json
+++ b/locales/bg-BG/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "Дайте ни звезда в GitHub",
"footer.title": "Харесвате ли нашия продукт?",
"fullscreen": "Цял екран",
+ "generation.hero.taglinePrefix": "Започнете да създавате с",
"getDesktopApp": "Изтеглете настолното приложение",
"historyRange": "Обхват на историята",
"home.suggestQuestions": "Опитайте с тези примери",
diff --git a/locales/de-DE/common.json b/locales/de-DE/common.json
index 240f194db02..5393e7873c9 100644
--- a/locales/de-DE/common.json
+++ b/locales/de-DE/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "Geben Sie uns einen Stern auf GitHub",
"footer.title": "Gefällt Ihnen unser Produkt?",
"fullscreen": "Vollbildmodus",
+ "generation.hero.taglinePrefix": "Beginnen Sie mit der Erstellung von",
"getDesktopApp": "Desktop-App herunterladen",
"historyRange": "Verlaufsspanne",
"home.suggestQuestions": "Probieren Sie diese Beispiele aus",
diff --git a/locales/en-US/common.json b/locales/en-US/common.json
index e53319fb338..3533cacbc1b 100644
--- a/locales/en-US/common.json
+++ b/locales/en-US/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "Star us on GitHub",
"footer.title": "Like Our Product?",
"fullscreen": "Full Screen Mode",
+ "generation.hero.taglinePrefix": "Start Creating with",
"getDesktopApp": "Get Desktop App",
"historyRange": "History Range",
"home.suggestQuestions": "Try these examples",
diff --git a/locales/es-ES/common.json b/locales/es-ES/common.json
index c37d6b47aa9..e11d5a7a162 100644
--- a/locales/es-ES/common.json
+++ b/locales/es-ES/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "Danos una estrella en GitHub",
"footer.title": "¿Te gusta nuestro producto?",
"fullscreen": "Modo de pantalla completa",
+ "generation.hero.taglinePrefix": "Comienza a crear con",
"getDesktopApp": "Obtener la aplicación de escritorio",
"historyRange": "Rango de historial",
"home.suggestQuestions": "Prueba con estos ejemplos",
diff --git a/locales/fa-IR/common.json b/locales/fa-IR/common.json
index 0d5e8bf9518..26495b1c6ad 100644
--- a/locales/fa-IR/common.json
+++ b/locales/fa-IR/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "ما را در گیت‌هاب ستاره‌دار کنید",
"footer.title": "از محصول ما خوشتان آمده؟",
"fullscreen": "حالت تمام‌صفحه",
+ "generation.hero.taglinePrefix": "شروع کنید با",
"getDesktopApp": "دریافت برنامه دسکتاپ",
"historyRange": "محدوده تاریخچه",
"home.suggestQuestions": "این نمونه‌ها را امتحان کنید",
diff --git a/locales/fr-FR/common.json b/locales/fr-FR/common.json
index 4a71647467b..42d1658abfd 100644
--- a/locales/fr-FR/common.json
+++ b/locales/fr-FR/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "Ajoutez-nous une étoile sur GitHub",
"footer.title": "Vous aimez notre produit ?",
"fullscreen": "Mode plein écran",
+ "generation.hero.taglinePrefix": "Commencez à créer avec",
"getDesktopApp": "Obtenir l'application de bureau",
"historyRange": "Plage d'historique",
"home.suggestQuestions": "Essayez ces exemples",
diff --git a/locales/it-IT/common.json b/locales/it-IT/common.json
index 557be9e3197..863855152a0 100644
--- a/locales/it-IT/common.json
+++ b/locales/it-IT/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "Metti una stella su GitHub",
"footer.title": "Ti piace il nostro prodotto?",
"fullscreen": "Modalità schermo intero",
+ "generation.hero.taglinePrefix": "Inizia a creare con",
"getDesktopApp": "Scarica l'app desktop",
"historyRange": "Intervallo cronologia",
"home.suggestQuestions": "Prova questi esempi",
diff --git a/locales/ja-JP/common.json b/locales/ja-JP/common.json
index 0d1b4e6464d..80fc7d05501 100644
--- a/locales/ja-JP/common.json
+++ b/locales/ja-JP/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "GitHub でスターを付ける",
"footer.title": "製品は気に入りましたか?",
"fullscreen": "全画面モード",
+ "generation.hero.taglinePrefix": "作成を始めましょう",
"getDesktopApp": "デスクトップアプリを入手",
"historyRange": "履歴範囲",
"home.suggestQuestions": "次の例をお試しください",
diff --git a/locales/ko-KR/common.json b/locales/ko-KR/common.json
index e2c570b8abf..90bf17be779 100644
--- a/locales/ko-KR/common.json
+++ b/locales/ko-KR/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "GitHub에서 별표 추가",
"footer.title": "제품이 마음에 드시나요?",
"fullscreen": "전체 화면 모드",
+ "generation.hero.taglinePrefix": "시작하세요, 창작을",
"getDesktopApp": "데스크톱 앱 받기",
"historyRange": "기록 범위",
"home.suggestQuestions": "이런 예시를 시도해 보세요",
diff --git a/locales/nl-NL/common.json b/locales/nl-NL/common.json
index fe1d8f72689..f33d02ec406 100644
--- a/locales/nl-NL/common.json
+++ b/locales/nl-NL/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "Geef ons een ster op GitHub",
"footer.title": "Tevreden over ons product?",
"fullscreen": "Volledig scherm",
+ "generation.hero.taglinePrefix": "Begin met creëren met",
"getDesktopApp": "Download Desktop-app",
"historyRange": "Geschiedenisbereik",
"home.suggestQuestions": "Probeer deze voorbeelden",
diff --git a/locales/pl-PL/common.json b/locales/pl-PL/common.json
index 36801da188d..f0cc86aa3c3 100644
--- a/locales/pl-PL/common.json
+++ b/locales/pl-PL/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "Oceń nas na GitHubie",
"footer.title": "Podoba Ci się nasz produkt?",
"fullscreen": "Tryb pełnoekranowy",
+ "generation.hero.taglinePrefix": "Zacznij tworzyć z",
"getDesktopApp": "Pobierz aplikację na komputer",
"historyRange": "Zakres historii",
"home.suggestQuestions": "Wypróbuj te przykłady",
diff --git a/locales/pt-BR/common.json b/locales/pt-BR/common.json
index d6806e11875..bf8ef4cd9d3 100644
--- a/locales/pt-BR/common.json
+++ b/locales/pt-BR/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "Dê uma estrela no GitHub",
"footer.title": "Gosta do nosso produto?",
"fullscreen": "Modo Tela Cheia",
+ "generation.hero.taglinePrefix": "Comece a Criar com",
"getDesktopApp": "Obter Aplicativo para Desktop",
"historyRange": "Período do Histórico",
"home.suggestQuestions": "Experimente estes exemplos",
diff --git a/locales/ru-RU/common.json b/locales/ru-RU/common.json
index 94ccdebc090..c71cb1f9abe 100644
--- a/locales/ru-RU/common.json
+++ b/locales/ru-RU/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "Поставьте нам звезду на GitHub",
"footer.title": "Нравится наш продукт?",
"fullscreen": "Полноэкранный режим",
+ "generation.hero.taglinePrefix": "Начните создавать с",
"getDesktopApp": "Скачать приложение для компьютера",
"historyRange": "Диапазон истории",
"home.suggestQuestions": "Попробуйте эти примеры",
diff --git a/locales/tr-TR/common.json b/locales/tr-TR/common.json
index be8fdab0170..14d2af63c1e 100644
--- a/locales/tr-TR/common.json
+++ b/locales/tr-TR/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "GitHub'da bize yıldız verin",
"footer.title": "Ürünümüzü Beğendiniz mi?",
"fullscreen": "Tam Ekran Modu",
+ "generation.hero.taglinePrefix": "Oluşturmaya Başla",
"getDesktopApp": "Masaüstü Uygulamasını İndir",
"historyRange": "Geçmiş Aralığı",
"home.suggestQuestions": "Bu örnekleri deneyin",
diff --git a/locales/vi-VN/common.json b/locales/vi-VN/common.json
index 0a676c65ea9..0fa0dbeb947 100644
--- a/locales/vi-VN/common.json
+++ b/locales/vi-VN/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "Gắn sao cho chúng tôi trên GitHub",
"footer.title": "Bạn thích sản phẩm của chúng tôi?",
"fullscreen": "Chế độ toàn màn hình",
+ "generation.hero.taglinePrefix": "Bắt đầu Tạo với",
"getDesktopApp": "Tải ứng dụng trên máy tính",
"historyRange": "Phạm vi lịch sử",
"home.suggestQuestions": "Hãy thử những ví dụ này",
diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json
index 938966d4a31..7d3744a54ba 100644
--- a/locales/zh-CN/common.json
+++ b/locales/zh-CN/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "在 GitHub 为我们点亮星标",
"footer.title": "喜欢我们的产品?",
"fullscreen": "全屏模式",
+ "generation.hero.taglinePrefix": "即刻创作",
"getDesktopApp": "获取桌面应用",
"historyRange": "历史范围",
"home.suggestQuestions": "试试这些示例",
diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.json
index 225e5ef6986..281a625fb29 100644
--- a/locales/zh-TW/common.json
+++ b/locales/zh-TW/common.json
@@ -262,6 +262,7 @@
"footer.star.title": "在 GitHub 為我們點亮星標",
"footer.title": "喜歡我們的產品?",
"fullscreen": "全螢幕模式",
+ "generation.hero.taglinePrefix": "開始創造",
"getDesktopApp": "下載桌面應用程式",
"historyRange": "歷史範圍",
"home.suggestQuestions": "試試這些範例",
diff --git a/src/locales/default/common.ts b/src/locales/default/common.ts
index f648938a759..00b12b33a49 100644
--- a/src/locales/default/common.ts
+++ b/src/locales/default/common.ts
@@ -337,6 +337,7 @@ export default {
'footer.star.title': 'Star us on GitHub',
'footer.title': 'Like Our Product?',
'fullscreen': 'Full Screen Mode',
+ 'generation.hero.taglinePrefix': 'Start Creating with',
'historyRange': 'History Range',
'home.suggestQuestions': 'Try these examples',
'import': 'Import',
diff --git a/src/routes/(main)/(create)/components/PromptTitle.tsx b/src/routes/(main)/(create)/components/PromptTitle.tsx
index 7b9a5b14203..1c5605d34a1 100644
--- a/src/routes/(main)/(create)/components/PromptTitle.tsx
+++ b/src/routes/(main)/(create)/components/PromptTitle.tsx
@@ -1,41 +1,29 @@
'use client';
-import { Center, Icon, Text } from '@lobehub/ui';
-import { cssVar } from 'antd-style';
-import type { LucideIcon } from 'lucide-react';
+import { Flexbox } from '@lobehub/ui';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import GenerationMediaModeSegment from '@/routes/(main)/(create)/features/GenerationInput/GenerationMediaModeSegment';
+
interface PromptTitleProps {
- icon: LucideIcon;
- namespace: 'image' | 'video';
+ mode: 'image' | 'video';
}
-const PromptTitle = memo<PromptTitleProps>(({ icon, namespace }) => {
- const { t } = useTranslation(namespace);
+const PromptTitle = memo<PromptTitleProps>(({ mode }) => {
+ const { t } = useTranslation('common');
return (
- <Center horizontal gap={16} style={{ width: '100%' }}>
- <Center
- flex={'none'}
- height={54}
- width={54}
- style={{
- backgroundColor: cssVar.colorText,
- borderRadius: 16,
- }}
- >
- <Icon color={cssVar.colorBgLayout} icon={icon} size={32} />
- </Center>
- <Text
- as={'h1'}
- style={{
- margin: 0,
- }}
- >
- {t('config.header.title')}
- </Text>
- </Center>
+ <Flexbox
+ horizontal
+ align={'center'}
+ justify={'center'}
+ style={{ fontSize: 28, fontWeight: 'bold', marginBottom: 24 }}
+ width={'100%'}
+ >
+ {t('generation.hero.taglinePrefix')}
+ <GenerationMediaModeSegment layout={'hero'} mode={mode} />
+ </Flexbox>
);
});
diff --git a/src/routes/(main)/(create)/features/CreateGenerationPage.tsx b/src/routes/(main)/(create)/features/CreateGenerationPage.tsx
index 0df8ed83045..3e864dbb937 100644
--- a/src/routes/(main)/(create)/features/CreateGenerationPage.tsx
+++ b/src/routes/(main)/(create)/features/CreateGenerationPage.tsx
@@ -26,7 +26,19 @@ const CreateGenerationPage = memo<CreateGenerationPageProps>(({ path, Workspace,
return (
<>
- <NavHeader right={<WideScreenButton />} />
+ <NavHeader
+ right={<WideScreenButton />}
+ styles={{
+ center: {
+ alignItems: 'center',
+ display: 'flex',
+ justifyContent: 'center',
+ minWidth: 0,
+ },
+ left: { flex: 1, minWidth: 0 },
+ right: { flex: 1, minWidth: 0 },
+ }}
+ />
<Flexbox
height={'100%'}
style={{ flexDirection: 'column', overflow: 'hidden', position: 'relative' }}
diff --git a/src/routes/(main)/(create)/features/GenerationInput/GenerationMediaModeSegment.tsx b/src/routes/(main)/(create)/features/GenerationInput/GenerationMediaModeSegment.tsx
new file mode 100644
index 00000000000..1e863ffb574
--- /dev/null
+++ b/src/routes/(main)/(create)/features/GenerationInput/GenerationMediaModeSegment.tsx
@@ -0,0 +1,116 @@
+'use client';
+
+import { Flexbox, Icon } from '@lobehub/ui';
+import { Select, type SelectProps } from '@lobehub/ui/base-ui';
+import { createStaticStyles } from 'antd-style';
+import { ImageIcon, Video } from 'lucide-react';
+import { memo, useCallback, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useNavigate } from 'react-router-dom';
+
+export interface GenerationMediaModeSegmentProps {
+ /** `hero`: large inline headline select (cyan, borderless). `toolbar`: compact control in the input bar. */
+ layout?: 'hero' | 'toolbar';
+ mode: 'image' | 'video';
+}
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ lite: css`
+ height: 36px;
+ `,
+ heroSelect: css`
+ width: auto;
+ font-size: inherit;
+ line-height: 1.2;
+ `,
+ heroText: css`
+ font-size: 24px;
+ font-weight: 600;
+ line-height: 1.2;
+ `,
+}));
+
+const GenerationMediaModeSegment = memo<GenerationMediaModeSegmentProps>(
+ ({ mode, layout = 'toolbar' }) => {
+ const { t } = useTranslation('common');
+ const navigate = useNavigate();
+ const isHero = layout === 'hero';
+
+ const options = useMemo<SelectProps['options']>(
+ () => [
+ {
+ label: (
+ <Flexbox horizontal align="center" gap={8}>
+ {!isHero && <Icon icon={ImageIcon} />}
+ <span className={isHero ? styles.heroText : undefined}>{t('tab.aiImage')}</span>
+ </Flexbox>
+ ),
+ value: 'image',
+ },
+ {
+ label: (
+ <Flexbox horizontal align="center" gap={8}>
+ {!isHero && <Icon icon={Video} />}
+ <span className={isHero ? styles.heroText : undefined}>{t('tab.video')}</span>
+ </Flexbox>
+ ),
+ value: 'video',
+ },
+ ],
+ [t, isHero],
+ );
+
+ const labelRender: SelectProps['labelRender'] = useCallback(
+ (props: any) => {
+ const v = String((props as { value?: string }).value ?? '');
+ const isVideo = v === 'video';
+ const text = isVideo ? t('tab.video') : t('tab.aiImage');
+ if (isHero) {
+ return (
+ <span
+ style={{
+ fontSize: 'inherit',
+ fontWeight: 600,
+ whiteSpace: 'nowrap',
+ }}
+ >
+ {text}
+ </span>
+ );
+ }
+ return (
+ <Flexbox horizontal align="center" gap={6}>
+ <Icon icon={isVideo ? Video : ImageIcon} size={16} />
+ <span style={{ whiteSpace: 'nowrap' }}>{text}</span>
+ </Flexbox>
+ );
+ },
+ [isHero, t],
+ );
+
+ const handleChange = useCallback(
+ (value: string) => {
+ if (value === mode) return;
+ navigate(value === 'video' ? '/video' : '/image');
+ },
+ [mode, navigate],
+ );
+
+ return (
+ <Select
+ className={isHero ? styles.heroSelect : styles.lite}
+ labelRender={labelRender}
+ options={options}
+ popupMatchSelectWidth={false}
+ size={isHero ? 'large' : 'middle'}
+ value={mode}
+ variant={isHero ? 'borderless' : 'filled'}
+ onChange={handleChange}
+ />
+ );
+ },
+);
+
+GenerationMediaModeSegment.displayName = 'GenerationMediaModeSegment';
+
+export default GenerationMediaModeSegment;
diff --git a/src/routes/(main)/(create)/features/GenerationInput/GenerationPromptInput.tsx b/src/routes/(main)/(create)/features/GenerationInput/GenerationPromptInput.tsx
index 7015597a039..34875afa410 100644
--- a/src/routes/(main)/(create)/features/GenerationInput/GenerationPromptInput.tsx
+++ b/src/routes/(main)/(create)/features/GenerationInput/GenerationPromptInput.tsx
@@ -7,6 +7,7 @@ import type { KeyboardEvent, ReactNode } from 'react';
import { memo } from 'react';
interface GenerationPromptInputProps {
+ centerActions?: ReactNode;
className?: string;
disableGenerate?: boolean;
generateLabel: string;
@@ -34,6 +35,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
const GenerationPromptInput = memo<GenerationPromptInputProps>(
({
+ centerActions,
className,
header,
inlineContent,
@@ -78,10 +80,27 @@ const GenerationPromptInput = memo<GenerationPromptInputProps>(
header={header}
styles={{ body: { padding: 8 } }}
footer={
- <ChatInputActionBar
- left={leftActions}
- right={
- <Flexbox horizontal align={'center'} gap={8}>
+ centerActions ? (
+ <Flexbox horizontal align={'center'} gap={4} padding={4} width={'100%'}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ flex={1}
+ gap={4}
+ style={{ justifyContent: 'flex-start', minWidth: 0 }}
+ >
+ {leftActions}
+ </Flexbox>
+ <Flexbox align={'center'} flex={1} justify={'center'} style={{ minWidth: 0 }}>
+ {centerActions}
+ </Flexbox>
+ <Flexbox
+ horizontal
+ align={'center'}
+ flex={1}
+ gap={8}
+ style={{ justifyContent: 'flex-end', minWidth: 0 }}
+ >
{rightActions}
<SendButton
disabled={disableGenerate || !value}
@@ -90,8 +109,23 @@ const GenerationPromptInput = memo<GenerationPromptInputProps>(
onClick={onGenerate}
/>
</Flexbox>
- }
- />
+ </Flexbox>
+ ) : (
+ <ChatInputActionBar
+ left={leftActions}
+ right={
+ <Flexbox horizontal align={'center'} gap={8}>
+ {rightActions}
+ <SendButton
+ disabled={disableGenerate || !value}
+ loading={isCreating}
+ title={isCreating ? generatingLabel : generateLabel}
+ onClick={onGenerate}
+ />
+ </Flexbox>
+ }
+ />
+ )
}
>
{inlineContent ? (
diff --git a/src/routes/(main)/(create)/features/GenerationInput/UploadCard.tsx b/src/routes/(main)/(create)/features/GenerationInput/UploadCard.tsx
index b281a0d4e80..339711e516b 100644
--- a/src/routes/(main)/(create)/features/GenerationInput/UploadCard.tsx
+++ b/src/routes/(main)/(create)/features/GenerationInput/UploadCard.tsx
@@ -88,9 +88,12 @@ export const uploadCardStyles = createStaticStyles(({ css }) => ({
border-radius: 3px;
`,
label: css`
+ padding-inline: 4px;
+
font-size: 10px;
line-height: 1;
color: ${cssVar.colorTextQuaternary};
+ text-align: center;
`,
placeholderCard: css`
cursor: pointer;
diff --git a/src/routes/(main)/(create)/features/GenerationInput/index.ts b/src/routes/(main)/(create)/features/GenerationInput/index.ts
index c14d5123f51..ad84a1bd923 100644
--- a/src/routes/(main)/(create)/features/GenerationInput/index.ts
+++ b/src/routes/(main)/(create)/features/GenerationInput/index.ts
@@ -1,5 +1,6 @@
export { default as ConfigAction } from './ConfigAction';
export { default as GenerationInvalidAPIKey } from './GenerationInvalidAPIKey';
+export { default as GenerationMediaModeSegment } from './GenerationMediaModeSegment';
export { default as GenerationPromptInput } from './GenerationPromptInput';
export { default as ImagePreviewHeader } from './ImagePreviewHeader';
export { default as InlineImageReference } from './InlineImageReference';
diff --git a/src/routes/(main)/(create)/image/features/PromptInput/Title.tsx b/src/routes/(main)/(create)/image/features/PromptInput/Title.tsx
index 23f54953130..7a658521321 100644
--- a/src/routes/(main)/(create)/image/features/PromptInput/Title.tsx
+++ b/src/routes/(main)/(create)/image/features/PromptInput/Title.tsx
@@ -1,9 +1,7 @@
'use client';
-import { Palette } from 'lucide-react';
-
import PromptTitle from '@/routes/(main)/(create)/components/PromptTitle';
-const ImagePromptTitle = () => <PromptTitle icon={Palette} namespace="image" />;
+const ImagePromptTitle = () => <PromptTitle mode={'image'} />;
export default ImagePromptTitle;
diff --git a/src/routes/(main)/(create)/image/features/PromptInput/index.tsx b/src/routes/(main)/(create)/image/features/PromptInput/index.tsx
index 2c28ca07389..b57a1a5a97d 100644
--- a/src/routes/(main)/(create)/image/features/PromptInput/index.tsx
+++ b/src/routes/(main)/(create)/image/features/PromptInput/index.tsx
@@ -1,8 +1,7 @@
'use client';
import { ModelIcon } from '@lobehub/icons';
-import { Center, Flexbox, Text } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
+import { ActionIcon, Flexbox, Text } from '@lobehub/ui';
import { Images } from 'lucide-react';
import { useCallback, useEffect, useMemo, useRef } from 'react';
import { useTranslation } from 'react-i18next';
@@ -15,6 +14,7 @@ import { useIsDark } from '@/hooks/useIsDark';
import { useQueryState } from '@/hooks/useQueryParam';
import {
ConfigAction,
+ GenerationMediaModeSegment,
GenerationPromptInput,
InlineImageReference,
} from '@/routes/(main)/(create)/features/GenerationInput';
@@ -42,29 +42,6 @@ import { authSelectors } from '@/store/user/slices/auth/selectors';
import PromptTitle from './Title';
-const triggerStyles = createStaticStyles(({ css, cssVar }) => ({
- icon: cx(
- 'model-switch',
- css`
- transition: scale 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
- `,
- ),
- model: css`
- cursor: pointer;
- border-radius: 24px;
-
- :hover {
- background: ${cssVar.colorFillSecondary};
- }
-
- :active {
- .model-switch {
- scale: 0.8;
- }
- }
- `,
-}));
-
interface PromptInputProps {
disableAnimation?: boolean;
showTitle?: boolean;
@@ -227,6 +204,7 @@ const PromptInput = ({ showTitle = false }: PromptInputProps) => {
}
leftActions={
<Flexbox horizontal align={'center'} gap={4}>
+ <GenerationMediaModeSegment mode={'image'} />
<ModelSwitchPanel
ModelItemComponent={ImageModelItem}
enabledList={enabledImageModelList}
@@ -239,11 +217,13 @@ const PromptInput = ({ showTitle = false }: PromptInputProps) => {
setModelAndProviderOnSelect(model, provider);
}}
>
- <Center className={triggerStyles.model} height={36} width={36}>
- <div className={triggerStyles.icon}>
- <ModelIcon model={currentModel ?? ''} size={22} />
- </div>
- </Center>
+ <ActionIcon
+ icon={<ModelIcon model={currentModel ?? ''} size={22} />}
+ size={{
+ blockSize: 36,
+ size: 20,
+ }}
+ />
</ModelSwitchPanel>
<ConfigAction
title={t('config.title', { defaultValue: 'Config' })}
diff --git a/src/routes/(main)/(create)/video/features/PromptInput/Title.tsx b/src/routes/(main)/(create)/video/features/PromptInput/Title.tsx
index 9c9103fa23c..2c8d6b92938 100644
--- a/src/routes/(main)/(create)/video/features/PromptInput/Title.tsx
+++ b/src/routes/(main)/(create)/video/features/PromptInput/Title.tsx
@@ -1,9 +1,7 @@
'use client';
-import { Video } from 'lucide-react';
-
import PromptTitle from '@/routes/(main)/(create)/components/PromptTitle';
-const VideoPromptTitle = () => <PromptTitle icon={Video} namespace="video" />;
+const VideoPromptTitle = () => <PromptTitle mode={'video'} />;
export default VideoPromptTitle;
diff --git a/src/routes/(main)/(create)/video/features/PromptInput/index.tsx b/src/routes/(main)/(create)/video/features/PromptInput/index.tsx
index 64977ca8418..c89237cf793 100644
--- a/src/routes/(main)/(create)/video/features/PromptInput/index.tsx
+++ b/src/routes/(main)/(create)/video/features/PromptInput/index.tsx
@@ -1,9 +1,8 @@
'use client';
import { ModelIcon } from '@lobehub/icons';
-import { Center, Flexbox, InputNumber, Segmented, SliderWithInput, Text } from '@lobehub/ui';
+import { ActionIcon, Flexbox, InputNumber, Segmented, SliderWithInput, Text } from '@lobehub/ui';
import { Divider, Switch } from 'antd';
-import { createStaticStyles, cx } from 'antd-style';
import { Clock3, Dices } from 'lucide-react';
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
import { useTranslation } from 'react-i18next';
@@ -17,6 +16,7 @@ import { useIsDark } from '@/hooks/useIsDark';
import { useQueryState } from '@/hooks/useQueryParam';
import {
ConfigAction,
+ GenerationMediaModeSegment,
GenerationPromptInput,
InlineVideoFrames,
} from '@/routes/(main)/(create)/features/GenerationInput';
@@ -32,29 +32,6 @@ import { generateUniqueSeeds } from '@/utils/number';
import PromptTitle from './Title';
-const triggerStyles = createStaticStyles(({ css, cssVar }) => ({
- icon: cx(
- 'model-switch',
- css`
- transition: scale 400ms cubic-bezier(0.215, 0.61, 0.355, 1);
- `,
- ),
- model: css`
- cursor: pointer;
- border-radius: 24px;
-
- :hover {
- background: ${cssVar.colorFillSecondary};
- }
-
- :active {
- .model-switch {
- scale: 0.8;
- }
- }
- `,
-}));
-
interface PromptInputProps {
disableAnimation?: boolean;
showTitle?: boolean;
@@ -255,6 +232,7 @@ const PromptInput = ({ showTitle = false }: PromptInputProps) => {
}
leftActions={
<Flexbox horizontal align={'center'} gap={4}>
+ <GenerationMediaModeSegment mode={'video'} />
<ModelSwitchPanel
ModelItemComponent={VideoModelItem}
enabledList={enabledVideoModelList}
@@ -267,11 +245,13 @@ const PromptInput = ({ showTitle = false }: PromptInputProps) => {
setModelAndProviderOnSelect(model, provider);
}}
>
- <Center className={triggerStyles.model} height={36} width={36}>
- <div className={triggerStyles.icon}>
- <ModelIcon model={currentModel ?? ''} size={22} />
- </div>
- </Center>
+ <ActionIcon
+ icon={<ModelIcon model={currentModel ?? ''} size={22} />}
+ size={{
+ blockSize: 36,
+ size: 20,
+ }}
+ />
</ModelSwitchPanel>
<ConfigAction
title={t('config.title', { defaultValue: 'Config' })}