electro-sb commited on
Commit
cba60be
·
1 Parent(s): b2697b1

Adjust React imports for TypeScript compatibility

Browse files
Files changed (2) hide show
  1. web/src/App.tsx +64 -65
  2. web/src/main.tsx +9 -9
web/src/App.tsx CHANGED
@@ -1,66 +1,65 @@
1
- import * as React from 'react';
2
- import { useState, useEffect } from 'react';
3
- import ChessBoard from './components/ChessBoard';
4
- import GameControls from './components/GameControls';
5
- import GameInfo from './components/GameInfo';
6
-
7
- const App: React.FC = () => {
8
- // Theme state kept but not exposed in UI
9
- const [boardTheme] = useState<'brown' | 'grey'>('brown');
10
-
11
- // Add useEffect to log when the component mounts
12
- React.useEffect(() => {
13
- console.log('Chess UI App mounted - Version 1.0');
14
-
15
- // Force a refresh of styles
16
- const style = document.createElement('style');
17
- style.textContent = `
18
- .chess-board {
19
- width: 800px !important;
20
- max-width: 100% !important;
21
- }
22
- .chess-piece {
23
- width: 85% !important;
24
- height: 85% !important;
25
- }
26
- .rank-label, .file-label {
27
- font-size: 0.9rem !important;
28
- }
29
- .rank-label {
30
- left: 8px !important;
31
- top: 8px !important;
32
- }
33
- .file-label {
34
- right: 8px !important;
35
- bottom: 8px !important;
36
- }
37
- `;
38
- document.head.appendChild(style);
39
-
40
- return () => {
41
- document.head.removeChild(style);
42
- };
43
- }, []);
44
-
45
- return (
46
- <div className="min-h-screen bg-gradio-bg text-gradio-text py-8">
47
- <div className="container mx-auto px-4">
48
-
49
- <div className="flex flex-col lg:flex-row gap-8 game-layout">
50
- <div className="flex-1 flex flex-col items-center">
51
- <ChessBoard theme={boardTheme} />
52
- </div>
53
-
54
- <div className="w-full lg:w-96 flex flex-col">
55
- <GameInfo boardTheme={boardTheme} onThemeChange={() => {}} />
56
- <div className="mt-6">
57
- <GameControls />
58
- </div>
59
- </div>
60
- </div>
61
- </div>
62
- </div>
63
- );
64
- };
65
-
66
  export default App;
 
1
+ import React, { useState, useEffect } from 'react';
2
+ import ChessBoard from './components/ChessBoard';
3
+ import GameControls from './components/GameControls';
4
+ import GameInfo from './components/GameInfo';
5
+
6
+ const App: React.FC = () => {
7
+ // Theme state kept but not exposed in UI
8
+ const [boardTheme] = useState<'brown' | 'grey'>('brown');
9
+
10
+ // Add useEffect to log when the component mounts
11
+ React.useEffect(() => {
12
+ console.log('Chess UI App mounted - Version 1.0');
13
+
14
+ // Force a refresh of styles
15
+ const style = document.createElement('style');
16
+ style.textContent = `
17
+ .chess-board {
18
+ width: 800px !important;
19
+ max-width: 100% !important;
20
+ }
21
+ .chess-piece {
22
+ width: 85% !important;
23
+ height: 85% !important;
24
+ }
25
+ .rank-label, .file-label {
26
+ font-size: 0.9rem !important;
27
+ }
28
+ .rank-label {
29
+ left: 8px !important;
30
+ top: 8px !important;
31
+ }
32
+ .file-label {
33
+ right: 8px !important;
34
+ bottom: 8px !important;
35
+ }
36
+ `;
37
+ document.head.appendChild(style);
38
+
39
+ return () => {
40
+ document.head.removeChild(style);
41
+ };
42
+ }, []);
43
+
44
+ return (
45
+ <div className="min-h-screen bg-gradio-bg text-gradio-text py-8">
46
+ <div className="container mx-auto px-4">
47
+
48
+ <div className="flex flex-col lg:flex-row gap-8 game-layout">
49
+ <div className="flex-1 flex flex-col items-center">
50
+ <ChessBoard theme={boardTheme} />
51
+ </div>
52
+
53
+ <div className="w-full lg:w-96 flex flex-col">
54
+ <GameInfo boardTheme={boardTheme} onThemeChange={() => {}} />
55
+ <div className="mt-6">
56
+ <GameControls />
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ );
63
+ };
64
+
 
65
  export default App;
web/src/main.tsx CHANGED
@@ -1,10 +1,10 @@
1
- import * as React from 'react';
2
- import * as ReactDOM from 'react-dom/client';
3
- import App from './App';
4
- import './index.css';
5
-
6
- ReactDOM.createRoot(document.getElementById('root')!).render(
7
- <React.StrictMode>
8
- <App />
9
- </React.StrictMode>,
10
  );
 
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import App from './App';
4
+ import './index.css';
5
+
6
+ ReactDOM.createRoot(document.getElementById('root')!).render(
7
+ <React.StrictMode>
8
+ <App />
9
+ </React.StrictMode>,
10
  );