Skip to content

Commit d0bc0ab

Browse files
committed
Fix: Image generation page layout
1 parent ea68c3f commit d0bc0ab

File tree

3 files changed

+53
-27
lines changed

3 files changed

+53
-27
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import { ImageGenerationResult } from '../../types/image';
3+
import { useTranslation } from 'react-i18next';
4+
5+
interface ImageGenerateResultProps {
6+
imageResult: ImageGenerationResult;
7+
}
8+
9+
const ImageGenerateResult: React.FC<ImageGenerateResultProps> = ({
10+
imageResult,
11+
}) => {
12+
const { t } = useTranslation();
13+
14+
return (
15+
<></>
16+
);
17+
};
18+
19+
export default ImageGenerateResult;

src/components/pages/ImageGenerationPage.tsx

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
SettingsService,
44
SETTINGS_CHANGE_EVENT,
55
} from "../../services/settings-service";
6-
import { ChevronDown, RefreshCw } from "lucide-react";
6+
import { ChevronDown, RefreshCw, Settings, Zap } from "lucide-react";
77
import { useTranslation } from "react-i18next";
88
import { AIService } from "../../services/ai-service";
99
import { OPENAI_PROVIDER_NAME } from "../../services/providers/openai-service";
@@ -101,38 +101,44 @@ export const ImageGenerationPage = () => {
101101
</div>
102102
)}
103103

104-
<div className="flex flex-row h-full">
104+
<div className="flex flex-row justify-center h-full">
105105
{/* Left side - Controls */}
106-
<div className="flex-1 p-6 overflow-y-auto frame-right-border">
107-
<h1 className="mb-6 text-2xl font-semibold">
108-
{t("imageGeneration.title")}
109-
</h1>
110-
106+
<div className="flex-1 max-w-5xl p-6 overflow-y-auto">
111107
{/* Prompt input */}
112108
<div className="mb-6">
113109
<label className="block mb-2 text-sm font-medium text-gray-700">
114110
{t("imageGeneration.prompt")}
115111
</label>
116-
<textarea
117-
value={prompt}
118-
onChange={(e) => setPrompt(e.target.value)}
119-
placeholder={t("imageGeneration.promptPlaceholder")}
120-
className="w-full p-3 input-box min-h-14"
121-
rows={4}
122-
/>
123-
</div>
112+
<div className="flex flex-row gap-2">
113+
<textarea
114+
value={prompt}
115+
onChange={(e) => setPrompt(e.target.value)}
116+
placeholder={t("imageGeneration.promptPlaceholder")}
117+
className="w-full p-3 input-box min-h-14"
118+
rows={1}
119+
/>
124120

125-
{/* Generation button */}
126-
<div className="flex justify-center mb-6">
127-
<button
128-
onClick={handleGenerateImage}
129-
disabled={isGenerating || !prompt.trim() || isApiKeyMissing}
130-
className="px-8 py-2.5 text-white confirm-btn"
131-
>
132-
{isGenerating
133-
? t("imageGeneration.generating")
134-
: t("imageGeneration.generateButton")}
135-
</button>
121+
<div className="flex flex-row gap-2 p-2 border border-gray-300 rounded-lg shadow-sm">
122+
<button
123+
onClick={handleGenerateImage}
124+
disabled={isGenerating || !prompt.trim() || isApiKeyMissing}
125+
className="px-4 py-2.5 text-nowrap flex flex-row gap-1 text-white text-center confirm-btn"
126+
>
127+
<Settings></Settings>
128+
{t("imageGeneration.settingsButton")}
129+
</button>
130+
<button
131+
onClick={handleGenerateImage}
132+
disabled={isGenerating || !prompt.trim() || isApiKeyMissing}
133+
className="px-4 py-2.5 text-nowrap flex flex-row gap-1 text-white text-center confirm-btn"
134+
>
135+
<Zap></Zap>
136+
{isGenerating
137+
? t("imageGeneration.generating")
138+
: t("imageGeneration.generateButton")}
139+
</button>
140+
</div>
141+
</div>
136142
</div>
137143

138144
<div className="flex items-center mb-4">
@@ -186,7 +192,7 @@ export const ImageGenerationPage = () => {
186192
</div>
187193

188194
{/* Right side - Results */}
189-
<div className="w-[420px] h-full p-6 overflow-y-auto">
195+
<div className="hidden w-[420px] h-full p-6 overflow-y-auto">
190196
{/* Provider selection */}
191197
<div className="mb-6">
192198
<label className="block mb-2 text-sm font-medium text-gray-700">

src/locales/zh-CN/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"randomSeed": "随机种子",
114114
"generateButton": "生成",
115115
"generating": "正在生成图像...",
116+
"settingsButton": "设置",
116117
"creatingImage": "AI正在创建您的图像",
117118
"generationFailed": "图像生成失败",
118119
"generatedImage": "生成的图像",

0 commit comments

Comments
 (0)