1 line
9.9 KiB
JSON
1 line
9.9 KiB
JSON
|
|
{"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 [isLoading, setIsLoading] = useState(true);\n useEffect(() => {\n const token = localStorage.getItem('token');\n if (token) {\n setIsAuthenticated(true);\n }\n setIsLoading(false);\n }, []);\n const handleLogin = token => {\n localStorage.setItem('token', token);\n setIsAuthenticated(true);\n };\n const handleLogout = () => {\n localStorage.removeItem('token');\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: 58,\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 },\n children: \"\\u52A0\\u8F7D\\u4E2D...\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 61,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 60,\n columnNumber: 11\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 59,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 57,\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: 72,\n columnNumber: 7\n }, this), /*#__PURE__*/_jsxDEV(AppContainer, {\n children: /*#__PURE__*/_jsxDEV(AppContent, {\n children: isAuthenticated ? /*#__PURE__*/_jsxDEV(TodoApp, {\n onLogout: handleLogout\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 76,\n columnNumber: 13\n }, this) : /*#__PURE__*/_jsxDEV(LoginForm, {\n onLogin: handleLogin\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 78,\n columnNumber: 13\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 74,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 73,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 71,\n columnNumber: 5\n }, this);\n}\n_s(App, \"QGOAXroSjAVQAlauW9LqDUcn+wM=\");\n_c3 = App;\nexport default App;\nvar _c, _c2, _c3;\n$Refresh
|