githubPages自动部署

This commit is contained in:
Jerry 2025-06-05 20:59:01 +08:00
parent 20ded22f22
commit 17510c69a9
7 changed files with 123 additions and 4 deletions

28
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Deploy React App from src/frontend
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/frontend
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- run: pnpm install
- run: pnpm run build
- run: npx gh-pages -d build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4"> <module type="PYTHON_MODULE" version="4">
<component name="FacetManager"> <component name="FacetManager">
<facet type="Python" name="Python facet"> <facet type="Python" name="Python facet">
<configuration sdkName="Python 3.12" /> <configuration sdkName="Python 3.10" />
</facet> </facet>
</component> </component>
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
@ -11,6 +11,6 @@
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.13" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Python 3.12 interpreter library" level="application" /> <orderEntry type="library" name="Python 3.10 interpreter library" level="application" />
</component> </component>
</module> </module>

View File

@ -2,6 +2,7 @@
"name": "network-admin-frontend", "name": "network-admin-frontend",
"version": "0.1.0", "version": "0.1.0",
"private": false, "private": false,
"homepage": "https://JerryPlsuy.github.io/AI-powered-switches",
"dependencies": { "dependencies": {
"@chakra-ui/react": "^3.19.1", "@chakra-ui/react": "^3.19.1",
"@emotion/react": "^11.14.0", "@emotion/react": "^11.14.0",
@ -28,6 +29,8 @@
"build": "react-app-rewired build", "build": "react-app-rewired build",
"test": "react-app-rewired test", "test": "react-app-rewired test",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"predeploy": "pnpm run build",
"deploy": "gh-pages -d build",
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,md}\"" "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,md}\""
}, },
"eslintConfig": { "eslintConfig": {
@ -54,6 +57,7 @@
"eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb": "^19.0.4",
"eslint-plugin-react": "^7.37.5", "eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^4.3.0", "eslint-plugin-react-hooks": "^4.3.0",
"gh-pages": "^6.3.0",
"prettier": "^3.5.3", "prettier": "^3.5.3",
"react-app-rewired": "^2.2.1" "react-app-rewired": "^2.2.1"
} }

View File

@ -81,6 +81,9 @@ importers:
eslint-plugin-react-hooks: eslint-plugin-react-hooks:
specifier: ^4.3.0 specifier: ^4.3.0
version: 4.6.2(eslint@8.57.0) version: 4.6.2(eslint@8.57.0)
gh-pages:
specifier: ^6.3.0
version: 6.3.0
prettier: prettier:
specifier: ^3.5.3 specifier: ^3.5.3
version: 3.5.3 version: 3.5.3
@ -2277,6 +2280,10 @@ packages:
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'} engines: {node: '>= 0.8'}
commander@13.1.0:
resolution: {integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==}
engines: {node: '>=18'}
commander@2.20.3: commander@2.20.3:
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
@ -2757,6 +2764,9 @@ packages:
electron-to-chromium@1.5.159: electron-to-chromium@1.5.159:
resolution: {integrity: sha512-CEvHptWAMV5p6GJ0Lq8aheyvVbfzVrv5mmidu1D3pidoVNkB3tTBsTMVtPJ+rzRK5oV229mCLz9Zj/hNvU8GBA==} resolution: {integrity: sha512-CEvHptWAMV5p6GJ0Lq8aheyvVbfzVrv5mmidu1D3pidoVNkB3tTBsTMVtPJ+rzRK5oV229mCLz9Zj/hNvU8GBA==}
email-addresses@5.0.0:
resolution: {integrity: sha512-4OIPYlA6JXqtVn8zpHpGiI7vE6EQOAg16aGnDMIAlZVinnoZ8208tW1hAbjWydgN/4PLTT9q+O1K6AH/vALJGw==}
emittery@0.10.2: emittery@0.10.2:
resolution: {integrity: sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw==} resolution: {integrity: sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw==}
engines: {node: '>=12'} engines: {node: '>=12'}
@ -3108,6 +3118,14 @@ packages:
filelist@1.0.4: filelist@1.0.4:
resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==} resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==}
filename-reserved-regex@2.0.0:
resolution: {integrity: sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==}
engines: {node: '>=4'}
filenamify@4.3.0:
resolution: {integrity: sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==}
engines: {node: '>=8'}
filesize@8.0.7: filesize@8.0.7:
resolution: {integrity: sha512-pjmC+bkIF8XI7fWaH8KxHcZL3DPybs1roSKP4rKDvy20tAWwIObE4+JIseG2byfGKhud5ZnM4YSGKBz7Sh0ndQ==} resolution: {integrity: sha512-pjmC+bkIF8XI7fWaH8KxHcZL3DPybs1roSKP4rKDvy20tAWwIObE4+JIseG2byfGKhud5ZnM4YSGKBz7Sh0ndQ==}
engines: {node: '>= 0.4.0'} engines: {node: '>= 0.4.0'}
@ -3214,6 +3232,10 @@ packages:
resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==} resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==}
engines: {node: '>=12'} engines: {node: '>=12'}
fs-extra@11.3.0:
resolution: {integrity: sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==}
engines: {node: '>=14.14'}
fs-extra@9.1.0: fs-extra@9.1.0:
resolution: {integrity: sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==} resolution: {integrity: sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==}
engines: {node: '>=10'} engines: {node: '>=10'}
@ -3270,6 +3292,11 @@ packages:
resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==} resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
gh-pages@6.3.0:
resolution: {integrity: sha512-Ot5lU6jK0Eb+sszG8pciXdjMXdBJ5wODvgjR+imihTqsUWF2K6dJ9HST55lgqcs8wWcw6o6wAsUzfcYRhJPXbA==}
engines: {node: '>=10'}
hasBin: true
glob-parent@5.1.2: glob-parent@5.1.2:
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
@ -5547,6 +5574,10 @@ packages:
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
engines: {node: '>=8'} engines: {node: '>=8'}
strip-outer@1.0.1:
resolution: {integrity: sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==}
engines: {node: '>=0.10.0'}
style-loader@3.3.4: style-loader@3.3.4:
resolution: {integrity: sha512-0WqXzrsMTyb8yjZJHDqwmnwRJvhALK9LfRtRc6B4UTWe8AijYLZYZ9thuJTZc2VfQWINADW/j+LiJnfy2RoC1w==} resolution: {integrity: sha512-0WqXzrsMTyb8yjZJHDqwmnwRJvhALK9LfRtRc6B4UTWe8AijYLZYZ9thuJTZc2VfQWINADW/j+LiJnfy2RoC1w==}
engines: {node: '>= 12.13.0'} engines: {node: '>= 12.13.0'}
@ -5705,6 +5736,10 @@ packages:
resolution: {integrity: sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==} resolution: {integrity: sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==}
engines: {node: '>=8'} engines: {node: '>=8'}
trim-repeated@1.0.0:
resolution: {integrity: sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==}
engines: {node: '>=0.10.0'}
tryer@1.0.1: tryer@1.0.1:
resolution: {integrity: sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==} resolution: {integrity: sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==}
@ -9156,6 +9191,8 @@ snapshots:
dependencies: dependencies:
delayed-stream: 1.0.0 delayed-stream: 1.0.0
commander@13.1.0: {}
commander@2.20.3: {} commander@2.20.3: {}
commander@4.1.1: {} commander@4.1.1: {}
@ -9609,6 +9646,8 @@ snapshots:
electron-to-chromium@1.5.159: {} electron-to-chromium@1.5.159: {}
email-addresses@5.0.0: {}
emittery@0.10.2: {} emittery@0.10.2: {}
emittery@0.8.1: {} emittery@0.8.1: {}
@ -10135,6 +10174,14 @@ snapshots:
dependencies: dependencies:
minimatch: 5.1.6 minimatch: 5.1.6
filename-reserved-regex@2.0.0: {}
filenamify@4.3.0:
dependencies:
filename-reserved-regex: 2.0.0
strip-outer: 1.0.1
trim-repeated: 1.0.0
filesize@8.0.7: {} filesize@8.0.7: {}
fill-range@7.1.1: fill-range@7.1.1:
@ -10250,6 +10297,12 @@ snapshots:
jsonfile: 6.1.0 jsonfile: 6.1.0
universalify: 2.0.1 universalify: 2.0.1
fs-extra@11.3.0:
dependencies:
graceful-fs: 4.2.11
jsonfile: 6.1.0
universalify: 2.0.1
fs-extra@9.1.0: fs-extra@9.1.0:
dependencies: dependencies:
at-least-node: 1.0.0 at-least-node: 1.0.0
@ -10311,6 +10364,16 @@ snapshots:
es-errors: 1.3.0 es-errors: 1.3.0
get-intrinsic: 1.3.0 get-intrinsic: 1.3.0
gh-pages@6.3.0:
dependencies:
async: 3.2.6
commander: 13.1.0
email-addresses: 5.0.0
filenamify: 4.3.0
find-cache-dir: 3.3.2
fs-extra: 11.3.0
globby: 11.1.0
glob-parent@5.1.2: glob-parent@5.1.2:
dependencies: dependencies:
is-glob: 4.0.3 is-glob: 4.0.3
@ -12976,6 +13039,10 @@ snapshots:
strip-json-comments@3.1.1: {} strip-json-comments@3.1.1: {}
strip-outer@1.0.1:
dependencies:
escape-string-regexp: 1.0.5
style-loader@3.3.4(webpack@5.99.9): style-loader@3.3.4(webpack@5.99.9):
dependencies: dependencies:
webpack: 5.99.9 webpack: 5.99.9
@ -13169,6 +13236,10 @@ snapshots:
dependencies: dependencies:
punycode: 2.3.1 punycode: 2.3.1
trim-repeated@1.0.0:
dependencies:
escape-string-regexp: 1.0.5
tryer@1.0.1: {} tryer@1.0.1: {}
ts-interface-checker@0.1.13: {} ts-interface-checker@0.1.13: {}

View File

@ -3,8 +3,9 @@ import AppShell from '@/components/system/layout/AppShell';
import buildRoutes from '@/constants/routes/routes'; import buildRoutes from '@/constants/routes/routes';
const App = () => { const App = () => {
const isProd = process.env.NODE_ENV === 'production';
return ( return (
<BrowserRouter> <BrowserRouter basename={isProd ? '/AI-powered-switches' : '/'}>
<Routes> <Routes>
<Route path="/" element={<AppShell />}> <Route path="/" element={<AppShell />}>
{buildRoutes()} {buildRoutes()}

View File

@ -1,5 +1,12 @@
import { Box } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
/**
* 卡片组件
* @param children
* @param props
* @returns {JSX.Element}
* @constructor
*/
const Card = ({ children, ...props }) => ( const Card = ({ children, ...props }) => (
<Box <Box
bg={'rgba(255,255,255,0.1)'} bg={'rgba(255,255,255,0.1)'}

View File

@ -3,6 +3,14 @@ import { motion } from 'framer-motion';
const MotionBox = motion(Box); const MotionBox = motion(Box);
/**
* 带有动作效果的卡片
* @param icon 可选图标
* @param text 文字
* @param onClick 点击执行操作
* @returns {JSX.Element}
* @constructor
*/
const MotionCard = ({ icon, text, onClick }) => ( const MotionCard = ({ icon, text, onClick }) => (
<MotionBox <MotionBox
whileHover={{ whileHover={{