This repository has been archived on 2026-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
todo/client/node_modules/.cache/babel-loader/a3f616c9017e66dcf51c2603c701552917a6c080312cac72dffbf5afa616af2e.json

1 line
12 KiB
JSON
Raw Normal View History

2025-06-13 07:31:12 +00:00
{"ast":null,"code":"var _jsxFileName = \"D:\\\\aiproject\\\\goAgent\\\\todo\\\\client\\\\src\\\\App.js\",\n _s = $RefreshSig$();\nimport React, { useState, useEffect } from 'react';\nimport { ThemeProvider } from 'styled-components';\nimport { theme, GlobalStyle } from './styles/theme';\nimport LoginForm from './components/LoginForm';\nimport TodoApp from './components/TodoApp';\nimport styled from 'styled-components';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst AppContainer = styled.div`\n min-height: 100vh;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: ${({\n theme\n}) => theme.spacing.md};\n background: linear-gradient(135deg, ${({\n theme\n}) => theme.colors.primary}20, ${({\n theme\n}) => theme.colors.secondary}20);\n backdrop-filter: blur(10px);\n -webkit-backdrop-filter: blur(10px);\n\n @media (max-width: ${({\n theme\n}) => theme.breakpoints.md}) {\n padding: ${({\n theme\n}) => theme.spacing.sm};\n }\n`;\n_c = AppContainer;\nconst AppContent = styled.div`\n width: 100%;\n max-width: 1200px;\n height: 100%;\n min-height: 600px;\n display: flex;\n flex-direction: column;\n position: relative;\n`;\n_c2 = AppContent;\nfunction App() {\n _s();\n const [isAuthenticated, setIsAuthenticated] = useState(false);\n const [currentUser, setCurrentUser] = useState(null);\n const [isLoading, setIsLoading] = useState(true);\n useEffect(() => {\n const token = localStorage.getItem('token');\n const user = localStorage.getItem('user');\n if (token && user) {\n try {\n const parsedUser = JSON.parse(user);\n setCurrentUser(parsedUser);\n setIsAuthenticated(true);\n } catch (error) {\n console.error('解析用户信息失败:', error);\n localStorage.removeItem('token');\n localStorage.removeItem('user');\n }\n }\n setIsLoading(false);\n }, []);\n const handleLogin = (token, user) => {\n localStorage.setItem('token', token);\n localStorage.setItem('user', JSON.stringify(user));\n setCurrentUser(user);\n setIsAuthenticated(true);\n };\n const handleLogout = () => {\n localStorage.removeItem('token');\n localStorage.removeItem('user');\n setCurrentUser(null);\n setIsAuthenticated(false);\n };\n if (isLoading) {\n return /*#__PURE__*/_jsxDEV(ThemeProvider, {\n theme: theme,\n children: [/*#__PURE__*/_jsxDEV(GlobalStyle, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 73,\n columnNumber: 9\n }, this), /*#__PURE__*/_jsxDEV(AppContainer, {\n children: /*#__PURE__*/_jsxDEV(AppContent, {\n children: /*#__PURE__*/_jsxDEV(\"div\", {\n style: {\n textAlign: 'center',\n color: theme.colors.text.secondary,\n fontSize: theme.typography.fontSize.lg\n },\n children: \"\\u52A0\\u8F7D\\u4E2D...\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 76,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 75,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 72,\n columnNumber: 7\n }, this);\n }\n return /*#__PURE__*/_jsxDEV(ThemeProvider, {\n theme: theme,\n children: [/*#__PURE__*/_jsxDEV(GlobalStyle, {}, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 91,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(AppContainer, {\n children: /*#__PURE__*/_jsxDEV(AppContent, {\n children: isAuthenticated ? /*#__PURE__*/_jsxDEV(TodoApp, {\n onLogout: handleLogout,\n currentUser: currentUser\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 95,\n columnNumber: 13\n }, this) : /*#__PURE__*/_jsxDEV(