Skip to content

Commit 26b7f77

Browse files
committed
fixed mobile ui
1 parent 49c3337 commit 26b7f77

File tree

2 files changed

+63
-28
lines changed

2 files changed

+63
-28
lines changed

src/app/page.tsx

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,25 @@ export default function Home() {
5959
}
6060
};
6161

62-
// Scroll to the right end (newest images) on mount and window resize
62+
// Scroll functions for arrow buttons
63+
const scrollLeft = () => {
64+
const scrollContainer = document.getElementById("image-scroll-container");
65+
if (scrollContainer) {
66+
scrollContainer.scrollBy({ left: -300, behavior: "smooth" });
67+
}
68+
};
69+
70+
const scrollRight = () => {
71+
const scrollContainer = document.getElementById("image-scroll-container");
72+
if (scrollContainer) {
73+
scrollContainer.scrollBy({ left: 300, behavior: "smooth" });
74+
}
75+
};
76+
77+
// Only scroll on window resize, not on initial load
6378
useEffect(() => {
64-
// Initial scroll
65-
setTimeout(scrollToRight, 1);
79+
// Initial scroll to show newest images
80+
setTimeout(scrollToRight, 100);
6681

6782
// Add resize listener
6883
window.addEventListener("resize", scrollToRight);
@@ -245,7 +260,7 @@ export default function Home() {
245260
<h1 className="p-1 text-3xl font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent">
246261
AI Image Editor
247262
</h1>
248-
<p className="text-gray-100 mt-1">
263+
<p className="text-gray-100 mt-1 text-sm sm:text-base">
249264
Transform your images with AI-powered editing
250265
</p>
251266
</div>
@@ -259,8 +274,8 @@ export default function Home() {
259274
Your Gallery
260275
</h2>
261276
{selectedImages.size === 0 ? (
262-
<p className="text-sm text-gray-400">
263-
Click to select images for editing
277+
<p className="text-sm text-gray-400 text-right">
278+
Select images for editing
264279
</p>
265280
) : (
266281
<div className="bg-blue-600/20 backdrop-blur-xl rounded-xl px-3 border border-blue-500/30">
@@ -272,24 +287,44 @@ export default function Home() {
272287
)}
273288
</div>
274289

275-
<div
276-
className="w-full overflow-x-auto minimal-scrollbar"
277-
id="image-scroll-container"
278-
>
279-
<div className="flex gap-6 px-2 py-4">
280-
{images.map((image) => (
281-
<ImageCard
282-
key={image.id}
283-
image={image}
284-
isSelected={selectedImages.has(image.id)}
285-
fallbackImageUrl={null}
286-
onSelect={handleImageSelection}
287-
/>
288-
))}
289-
{/* add some space at the end to not interfere with ImageCard hover animation */}
290-
<div>-</div>
290+
<div className="relative">
291+
<div
292+
className="w-full overflow-x-auto minimal-scrollbar"
293+
id="image-scroll-container"
294+
>
295+
<div className="flex gap-6 px-2 py-4">
296+
{images.map((image) => (
297+
<ImageCard
298+
key={image.id}
299+
image={image}
300+
isSelected={selectedImages.has(image.id)}
301+
fallbackImageUrl={null}
302+
onSelect={handleImageSelection}
303+
/>
304+
))}
305+
{/* add some space at the end to not interfere with ImageCard hover animation */}
306+
<div className="hidden sm:block">-</div>
307+
</div>
291308
</div>
292309
</div>
310+
311+
{/* Arrow Navigation Buttons */}
312+
<div className="flex justify-center mt-4 gap-16">
313+
<button
314+
onClick={scrollLeft}
315+
className="text-2xl text-gray-400 hover:text-white transition-colors duration-200 font-bold"
316+
aria-label="Scroll left"
317+
>
318+
&lt;
319+
</button>
320+
<button
321+
onClick={scrollRight}
322+
className="text-2xl text-gray-400 hover:text-white transition-colors duration-200 font-bold"
323+
aria-label="Scroll right"
324+
>
325+
&gt;
326+
</button>
327+
</div>
293328
</div>
294329

295330
{/* Chat Interface */}

src/ui/chat-interface.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ export default function ChatInterface({
203203
{/* Input Form */}
204204
<form
205205
onSubmit={handleSubmit}
206-
className="p-6 border-t border-white/10 bg-white/5"
206+
className="p-4 sm:p-6 border-t border-white/10 bg-white/5"
207207
>
208-
<div className="flex gap-3">
208+
<div className="flex gap-2 sm:gap-3">
209209
{/* Image Upload Button */}
210-
<label className="flex items-center justify-center w-12 h-12 bg-white/10 hover:bg-white/20 border border-white/20 rounded-xl cursor-pointer transition-all duration-200 hover:scale-105">
210+
<label className="flex items-center justify-center w-10 h-10 sm:w-12 sm:h-12 bg-white/10 hover:bg-white/20 border border-white/20 rounded-xl cursor-pointer transition-all duration-200 hover:scale-105 flex-shrink-0">
211211
<input
212212
type="file"
213213
accept="image/jpeg,image/jpg,image/png,image/gif,image/webp"
@@ -216,7 +216,7 @@ export default function ChatInterface({
216216
disabled={isLoading}
217217
/>
218218
<svg
219-
className="w-5 h-5 text-gray-300 hover:text-white transition-colors"
219+
className="w-4 h-4 sm:w-5 sm:h-5 text-gray-300 hover:text-white transition-colors"
220220
fill="none"
221221
stroke="currentColor"
222222
viewBox="0 0 24 24"
@@ -237,13 +237,13 @@ export default function ChatInterface({
237237
value={inputMessage}
238238
onChange={(e) => setInputMessage(e.target.value)}
239239
placeholder="Type your message..."
240-
className="flex-1 p-3 border rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white/10 hover:bg-white/20 backdrop-blur-xl border-white/20 text-gray-100 placeholder-gray-400 transition-all duration-200"
240+
className="flex-1 min-w-0 p-2 sm:p-3 border rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white/10 hover:bg-white/20 backdrop-blur-xl border-white/20 text-gray-100 placeholder-gray-400 transition-all duration-200 text-sm sm:text-base"
241241
disabled={isLoading}
242242
/>
243243
<button
244244
type="submit"
245245
disabled={!inputMessage.trim() || isLoading}
246-
className="cursor-pointer px-6 py-3 bg-gradient-to-r from-blue-600 to-purple-900 hover:from-blue-700 hover:to-purple-950 text-white rounded-xl font-medium transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed hover:scale-102"
246+
className="cursor-pointer px-3 sm:px-6 py-2 sm:py-3 bg-gradient-to-r from-blue-600 to-purple-900 hover:from-blue-700 hover:to-purple-950 text-white rounded-xl font-medium transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed hover:scale-102 text-sm sm:text-base flex-shrink-0"
247247
>
248248
Send
249249
</button>

0 commit comments

Comments
 (0)