Skip to content

Commit 2375b77

Browse files
committed
fix
1 parent 3326715 commit 2375b77

File tree

7 files changed

+88
-47
lines changed

7 files changed

+88
-47
lines changed

webapp/chat-app/package.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,35 @@
2525
"@types/react-redux": "^7.1.34",
2626
"@types/react-router-dom": "^5.3.3",
2727
"@types/styled-components": "^5.1.34",
28+
"cross-env": "^7.0.3",
2829
"eslint": "^8.0.0",
2930
"typescript": "^4.9.5"
3031
},
3132
"scripts": {
32-
"start": "react-scripts start",
33-
"build": "react-scripts build",
33+
"start": "cross-env GENERATE_SOURCEMAP=true react-scripts start",
34+
"build": "cross-env GENERATE_SOURCEMAP=true INLINE_RUNTIME_CHUNK=false react-scripts build",
3435
"test": "react-scripts test",
3536
"eject": "react-scripts eject",
36-
"lint": "eslint \"src/**/*.{ts,tsx,js,jsx}\" --fix",
37+
"lint": "eslint \"src/**/*.{ts,tsx,js,jsx}\" --fix --max-warnings=0",
3738
"type-check": "tsc --noEmit"
3839
},
3940
"eslintConfig": {
4041
"extends": [
4142
"react-app",
4243
"react-app/jest"
43-
]
44+
],
45+
"rules": {
46+
"no-console": [
47+
"warn",
48+
{
49+
"allow": [
50+
"warn",
51+
"error"
52+
]
53+
}
54+
],
55+
"no-debugger": "warn"
56+
}
4457
},
4558
"browserslist": {
4659
"production": [

webapp/chat-app/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {GlobalStyles} from './styles/GlobalStyles';
66
import ChatInterface from './components/ChatInterface';
77
import ThemeProvider from './themes/ThemeProvider';
88
import {Menu} from "./components/Menu/Menu";
9+
import {Modal} from "./components/Modal/Modal";
910

1011
const App: React.FC = () => {
1112
console.log('[App] Component rendering');
@@ -41,6 +42,7 @@ const App: React.FC = () => {
4142
websocket={websocket}
4243
isConnected={isConnected}
4344
/>
45+
<Modal/>
4446
</div>
4547
</>
4648
);

webapp/chat-app/src/components/Menu/Menu.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@ const Dropdown = styled.div`
2727
padding: ${({theme}) => theme.sizing.spacing.sm};
2828
text-decoration: none;
2929
cursor: pointer;
30+
position: relative;
3031
3132
&:hover {
3233
background-color: ${({theme}) => theme.colors.primary};
3334
color: white;
34-
}
3535
36-
&:hover .div {
37-
display: block;
3836
}
3937
`;
4038

@@ -57,6 +55,12 @@ const DropdownContent = styled.div`
5755
min-width: 160px;
5856
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
5957
z-index: 1;
58+
top: 100%;
59+
left: 0;
60+
61+
${Dropdown}:hover & {
62+
display: block;
63+
}
6064
`;
6165

6266
const DropdownItem = styled.a`
@@ -84,6 +88,11 @@ export const Menu: React.FC = () => {
8488
const handleModalOpen = (modalType: string) => {
8589
console.log(`Opening modal: ${modalType}`);
8690
dispatch(showModal(modalType));
91+
// Verify the action was dispatched
92+
console.log('[Menu] Modal action dispatched:', {
93+
type: 'showModal',
94+
modalType
95+
});
8796
};
8897

8998
const handleLogout = () => {
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React from 'react';
2+
import styled from 'styled-components';
3+
import { useSelector, useDispatch } from 'react-redux';
4+
import { RootState } from '../../store';
5+
import { hideModal } from '../../store/slices/uiSlice';
6+
7+
const ModalOverlay = styled.div`
8+
position: fixed;
9+
top: 0;
10+
left: 0;
11+
right: 0;
12+
bottom: 0;
13+
background-color: rgba(0, 0, 0, 0.5);
14+
display: flex;
15+
justify-content: center;
16+
align-items: center;
17+
z-index: 1000;
18+
`;
19+
20+
const ModalContent = styled.div`
21+
background-color: ${({theme}) => theme.colors.surface};
22+
padding: ${({theme}) => theme.sizing.spacing.lg};
23+
border-radius: 4px;
24+
min-width: 300px;
25+
`;
26+
27+
export const Modal: React.FC = () => {
28+
const dispatch = useDispatch();
29+
const { modalOpen, modalType } = useSelector((state: RootState) => state.ui);
30+
31+
if (!modalOpen) return null;
32+
33+
console.log('[Modal] Rendering modal:', { modalType });
34+
35+
return (
36+
<ModalOverlay onClick={() => dispatch(hideModal())}>
37+
<ModalContent onClick={e => e.stopPropagation()}>
38+
<h2>{modalType}</h2>
39+
{/* Add your modal content here based on modalType */}
40+
</ModalContent>
41+
</ModalOverlay>
42+
);
43+
};

webapp/chat-app/src/components/Tabs/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ interface TabsProps {
2929
}
3030

3131
const Tabs: React.FC<TabsProps> = ({ tabs, activeTab, onTabChange, children }) => {
32-
// Log when component mounts or updates
3332
useEffect(() => {
3433
console.log('Tabs component mounted/updated with:', {
3534
tabsCount: tabs.length,
@@ -65,7 +64,7 @@ const Tabs: React.FC<TabsProps> = ({ tabs, activeTab, onTabChange, children }) =
6564
</TabContainer>
6665
);
6766
};
68-
// Add component display name for better debugging
67+
6968
Tabs.displayName = 'Tabs';
7069

7170

webapp/chat-app/src/store/slices/uiSlice.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,23 @@ const uiSlice = createSlice({
2424
state.theme = action.payload;
2525
},
2626
showModal: (state, action: PayloadAction<string>) => {
27-
console.log('[UI Slice] Showing modal:', action.payload);
27+
console.log('[UI Slice] Showing modal:', {
28+
modalType: action.payload,
29+
previousState: {
30+
modalOpen: state.modalOpen,
31+
modalType: state.modalType
32+
}
33+
});
2834
state.modalOpen = true;
2935
state.modalType = action.payload;
3036
},
3137
hideModal: (state) => {
32-
console.log('[UI Slice] Hiding modal');
38+
console.log('[UI Slice] Hiding modal', {
39+
previousState: {
40+
modalOpen: state.modalOpen,
41+
modalType: state.modalType
42+
}
43+
});
3344
state.modalOpen = false;
3445
state.modalType = null;
3546
},

webapp/chat-app/src/themes/themes.ts (Additional changes for theme objects)

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)