Spaces:
Sleeping
Sleeping
Commit
·
cba60be
1
Parent(s):
b2697b1
Adjust React imports for TypeScript compatibility
Browse files- web/src/App.tsx +64 -65
- web/src/main.tsx +9 -9
web/src/App.tsx
CHANGED
|
@@ -1,66 +1,65 @@
|
|
| 1 |
-
import
|
| 2 |
-
import
|
| 3 |
-
import
|
| 4 |
-
import
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
width:
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
<
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 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
|
| 2 |
-
import
|
| 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 |
);
|