diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 5ea459b..2547e67 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -34,7 +34,8 @@ function App() { const [version, setVersion] = useState('...') const [settings, setSettings] = useState({ conversations: { - show_calls: true + show_calls: true, + message_limit: 100000 } }) @@ -89,7 +90,8 @@ function App() { // Use default settings if fetch fails setSettings({ conversations: { - show_calls: true + show_calls: true, + message_limit: 100000 } }) } @@ -372,6 +374,7 @@ function App() { conversation={selectedConversation} startDate={startDate} endDate={endDate} + messageLimit={settings.conversations.message_limit} /> > diff --git a/frontend/src/components/MessageThread.jsx b/frontend/src/components/MessageThread.jsx index 262f907..6b5e9e8 100644 --- a/frontend/src/components/MessageThread.jsx +++ b/frontend/src/components/MessageThread.jsx @@ -7,7 +7,7 @@ import MediaGrid from './MediaGrid' const API_BASE = import.meta.env.VITE_API_URL || 'http://localhost:8085/api' -function MessageThread({ conversation, startDate, endDate }) { +function MessageThread({ conversation, startDate, endDate, messageLimit }) { const location = useLocation() const [items, setItems] = useState([]) const [loading, setLoading] = useState(false) @@ -235,6 +235,7 @@ function MessageThread({ conversation, startDate, endDate }) { } if (startDate) params.start = startDate.toISOString() if (endDate) params.end = endDate.toISOString() + if (messageLimit) params.limit = messageLimit const response = await axios.get(`${API_BASE}/messages`, { params }) setItems(response.data || []) diff --git a/frontend/src/components/SettingsModal.jsx b/frontend/src/components/SettingsModal.jsx index d03a625..520ac0c 100644 --- a/frontend/src/components/SettingsModal.jsx +++ b/frontend/src/components/SettingsModal.jsx @@ -3,10 +3,20 @@ import axios from 'axios' const API_BASE = import.meta.env.VITE_API_URL || 'http://localhost:8085/api' +const MESSAGE_LIMIT_OPTIONS = [ + { value: 100, label: '100' }, + { value: 1000, label: '1,000' }, + { value: 10000, label: '10,000' }, + { value: 100000, label: '100,000' }, + { value: 200000, label: '200,000' }, + { value: 500000, label: '500,000' }, +] + function SettingsModal({ show, onClose, onSettingsUpdated }) { const [settings, setSettings] = useState({ conversations: { - show_calls: true + show_calls: true, + message_limit: 100000 } }) const [loading, setLoading] = useState(true) @@ -38,7 +48,6 @@ function SettingsModal({ show, onClose, onSettingsUpdated }) { setError('') await axios.put(`${API_BASE}/settings`, settings) - // Notify parent component that settings were updated if (onSettingsUpdated) { onSettingsUpdated(settings) } @@ -62,6 +71,16 @@ function SettingsModal({ show, onClose, onSettingsUpdated }) { }) } + const handleMessageLimitChange = (e) => { + setSettings({ + ...settings, + conversations: { + ...settings.conversations, + message_limit: parseInt(e.target.value, 10) + } + }) + } + if (!show) return null return ( @@ -89,7 +108,7 @@ function SettingsModal({ show, onClose, onSettingsUpdated }) {