Skip to content

Commit 2c76b2e

Browse files
committed
minor bug fix
1 parent 81acdb7 commit 2c76b2e

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import AppContent from './AppContent';
33
import Carousel from './components/Carousel';
44

5-
const App = ({ carouselData, suggestionsData }) => {
5+
const App = ({ carouselData, suggestionsData, activeChats, setActiveChats }) => {
66
return (
77
<div style={{ backgroundColor: 'var(--color-main-bg)' }}>
88
{/* Carousel Section */}
@@ -32,7 +32,7 @@ const App = ({ carouselData, suggestionsData }) => {
3232
// height: '80vh'
3333
// }}
3434
>
35-
<AppContent suggestionsData={suggestionsData} />
35+
<AppContent suggestionsData={suggestionsData} activeChats={activeChats} setActiveChats={setActiveChats} />
3636
</div>
3737
</div>
3838
</div>

src/AppContent.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import ChatPage from './components/ChatPage';
66

77
const MOBILE_BREAKPOINT = 768; // px
88

9-
const AppContent = ({ suggestionsData }) => {
10-
const [activeChats, setActiveChats] = useState([]);
9+
const AppContent = ({ suggestionsData, activeChats, setActiveChats }) => {
1110
const [isSidebarOpen, setIsSidebarOpen] = useState(
1211
typeof window !== 'undefined' ? window.innerWidth >= MOBILE_BREAKPOINT : true
1312
);

src/components/DemoPage.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState } from 'react';
2+
import { useNavigate } from 'react-router-dom';
23
import LeftPane from './LeftPane';
34
import Carousel from './Carousel';
45
import App from '../App';
@@ -11,12 +12,16 @@ import { atomDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
1112
const DemoPage = () => {
1213
const [selectedHour, setSelectedHour] = useState(1); // Default to 1 PM
1314
const [abstractExpanded, setAbstractExpanded] = useState(false); // State for abstract toggle
15+
const [activeChats, setActiveChats] = useState([]);
16+
const navigate = useNavigate();
1417

1518
// Ensure we match the key type in dynamicData (keys as strings)
1619
const currentData = dynamicData[selectedHour.toString()] || { carousel: [], suggestions: [], activity: "" };
1720

1821
const handleTimeChange = (newHour) => {
1922
setSelectedHour(newHour);
23+
setActiveChats([]);
24+
navigate('/');
2025
};
2126

2227
const toggleAbstract = () => {
@@ -299,6 +304,8 @@ if __name__ == "__main__":
299304
<App
300305
carouselData={currentData.carousel}
301306
suggestionsData={currentData.suggestions}
307+
activeChats={activeChats}
308+
setActiveChats={setActiveChats}
302309
/>
303310
</DynamicDataProvider>
304311
</div>

0 commit comments

Comments
 (0)