diff --git a/frontend/src/components/ui/Tabs.js b/frontend/src/components/ui/Tabs.js index 61baaa6..89e3bf5 100644 --- a/frontend/src/components/ui/Tabs.js +++ b/frontend/src/components/ui/Tabs.js @@ -1,4 +1,4 @@ -import React, { createContext, useContext } from 'react'; +import React, { createContext, useContext, useRef, useEffect, useState } from 'react'; const TabsContext = createContext(); @@ -13,23 +13,55 @@ const Tabs = ({ value, onValueChange, children, className = '' }) => { }; const TabsList = ({ children, className = '', ...props }) => { + const { value: currentValue } = useContext(TabsContext); + const [indicatorStyle, setIndicatorStyle] = useState({ left: 0, width: 0 }); + const tabsRef = useRef({}); + + useEffect(() => { + const activeTab = tabsRef.current[currentValue]; + if (activeTab) { + setIndicatorStyle({ + left: activeTab.offsetLeft, + width: activeTab.offsetWidth, + }); + } + }, [currentValue]); + return ( -
- {children} +
+
+ {React.Children.map(children, (child) => + React.cloneElement(child, { tabsRef }) + )}
); }; -const TabsTrigger = ({ value, children, className = '', ...props }) => { +const TabsTrigger = ({ value, children, className = '', tabsRef, ...props }) => { const { value: currentValue, onValueChange } = useContext(TabsContext); const isActive = currentValue === value; + const buttonRef = useRef(null); + + useEffect(() => { + if (tabsRef && buttonRef.current) { + tabsRef.current[value] = buttonRef.current; + } + }, [tabsRef, value]); return ( +
+ +

Messages

Chat with other users about items

@@ -344,16 +347,24 @@ const MessagesPage = () => {
-

{message.text}

-

+

+ {message.text} +

+

{message.timestamp?.toDate?.()?.toLocaleTimeString() || 'Just now'}

diff --git a/frontend/src/pages/ProfilePage.js b/frontend/src/pages/ProfilePage.js index 145b613..c044057 100644 --- a/frontend/src/pages/ProfilePage.js +++ b/frontend/src/pages/ProfilePage.js @@ -232,10 +232,10 @@ export default function ProfilePage() { return } - // Validate file size (2MB max) - const maxSize = 2 * 1024 * 1024 + // Validate file size (5MB max) + const maxSize = 5 * 1024 * 1024 if (file.size > maxSize) { - alert('Image must be less than 2MB') + alert('Image must be less than 5MB') return }