Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@mui/icons-material": "^7.2.0",
"@mui/lab": "^7.0.0-beta.14",
"@mui/material": "^7.2.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
Expand Down
38 changes: 12 additions & 26 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,26 @@
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="theme-color" content="#6750a4" />
<meta
name="description"
content="Web site created using create-react-app"
content="ThinkML - AI-powered thinking and learning platform with Material Design"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>

<!-- Google Fonts - Roboto for Material Design -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Roboto+Mono:wght@400;500&display=swap" rel="stylesheet">

<!-- Material Design Icons -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

<title>ThinkML - Material Design</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
30 changes: 30 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* ==================== App 全局样式 ==================== */

/* 基础盒模型设置 */
* {
box-sizing: border-box;
}

/* Loading spinner 通用样式 */
.loading-spinner {
border: 2px solid rgba(0, 0, 0, 0.1);
border-top: 2px solid #1976d2;
border-radius: 50%;
width: 20px;
height: 20px;
animation: spin 1s linear infinite;
}

@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}

/* 平滑的主题过渡效果 */
.theme-transition * {
transition:
background-color 0.3s ease,
color 0.3s ease,
border-color 0.3s ease,
box-shadow 0.3s ease;
}
94 changes: 58 additions & 36 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,48 +1,70 @@
import React from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import MainLayout from './MainLayout/MainLayout';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import ErrorBoundary from './components/ErrorBoundary';
import { MuiThemeProvider } from './contexts/MuiThemeContext';

// Layout
import MainLayout from './MainLayout';

// Pages
import Chat from './Pages/Chat';
import Gpts from './Pages/Gpts';
import GptsDetail from './Pages/Gpts/Detail';
import GptsNew from './Pages/Gpts/New';
import Login from './Pages/Login';
import Signup from './Pages/Signup';
import Settings from './Pages/Settings';
import SettingsPreferences from './Pages/Settings/Preferences';
import SettingsNotifications from './Pages/Settings/Notifications';
import SettingsKeyboard from './Pages/Settings/Keyboard';
import SettingsDataControls from './Pages/Settings/DataControls';
import SettingsPlan from './Pages/Settings/Plan';
import Privacy from './Pages/Privacy';
import Terms from './Pages/Terms';
import SimpleTest from './Pages/SimpleTest';
import NotFound from './Pages/NotFound';
import Profile from './Pages/Settings/Profile';
import Preferences from './Pages/Settings/Preferences';
import Notifications from './Pages/Settings/Notifications';
import PrivacySecurity from './Pages/Settings/PrivacySecurity';
import DataManagement from './Pages/Settings/DataManagement';
import { ThemeInitializer } from './components/ThemeInitializer';

function App() {
const App: React.FC = () => {
return (
<>
<ThemeInitializer />
<Router>
<Routes>
{/* Public routes */}
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />
{/* Protected routes - require login */}
<Route path="/" element={<MainLayout />}>
<Route index element={<Navigate to="/chat" replace />} />
<Route path="chat" element={<Chat />} />
<Route path="gpts" element={<Gpts />} />
<Route path="settings" element={<Settings />}>
<Route path="profile" element={<Profile />} />
<Route path="preferences" element={<Preferences />} />
<Route path="notifications" element={<Notifications />} />
<Route path="privacy" element={<PrivacySecurity />} />
<Route path="data" element={<DataManagement />} />
<Route index element={<Navigate to="profile" replace />} />
</Route>
</Route>
{/* 404 page */}
<Route path="*" element={<NotFound />} />
</Routes>
</Router>
</>
<ErrorBoundary>
<MuiThemeProvider>
<BrowserRouter>
<ErrorBoundary>
<Routes>
{/* Public Routes */}
<Route path="/login" element={<Login />} />
<Route path="/signup" element={<Signup />} />
<Route path="/privacy" element={<Privacy />} />
<Route path="/terms" element={<Terms />} />
<Route path="/simple-test" element={<SimpleTest />} />

{/* Main App Routes with Layout */}
<Route path="/" element={<MainLayout />}>
<Route index element={<Navigate to="/simple-test" replace />} />
<Route path="chat" element={<Chat />} />
<Route path="gpts" element={<Gpts />} />
<Route path="gpts/detail/:id" element={<GptsDetail />} />
<Route path="gpts/new" element={<GptsNew />} />

{/* Settings Routes */}
<Route path="settings" element={<Settings />}>
<Route index element={<Navigate to="preferences" replace />} />
<Route path="preferences" element={<SettingsPreferences />} />
<Route path="notifications" element={<SettingsNotifications />} />
<Route path="keyboard" element={<SettingsKeyboard />} />
<Route path="data-controls" element={<SettingsDataControls />} />
<Route path="plan" element={<SettingsPlan />} />
</Route>
</Route>

{/* 404 Route */}
<Route path="*" element={<NotFound />} />
</Routes>
</ErrorBoundary>
</BrowserRouter>
</MuiThemeProvider>
</ErrorBoundary>
);
}
};

export default App;
90 changes: 0 additions & 90 deletions src/MainLayout/MainContent/MainContent.module.css

This file was deleted.

Loading