From ebe385a624ec94a6c0b40b9449547f58eb53f9e1 Mon Sep 17 00:00:00 2001 From: feie9454 Date: Thu, 11 Dec 2025 15:37:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=20Navbar=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=A7=BB=E5=8A=A8=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ app/globals.css | 3 +++ app/page.tsx | 2 +- components/Navbar.tsx | 34 ++++++++++++++++++++++++---------- pm2.config.cjs | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 65 insertions(+), 11 deletions(-) create mode 100644 pm2.config.cjs diff --git a/.gitignore b/.gitignore index 45254b6..a8cef3c 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ yarn-error.log* next-env.d.ts /app/generated/prisma + +logs \ No newline at end of file diff --git a/app/globals.css b/app/globals.css index 5ea54c2..f6a4014 100644 --- a/app/globals.css +++ b/app/globals.css @@ -36,3 +36,6 @@ html { color: white; } +*{ + box-sizing: border-box; +} \ No newline at end of file diff --git a/app/page.tsx b/app/page.tsx index 5e0b046..3425967 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -5,7 +5,7 @@ import Contact from '@/components/Contact'; export default function Home() { return ( -
+
diff --git a/components/Navbar.tsx b/components/Navbar.tsx index 5a0e451..65c94c9 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -22,20 +22,30 @@ const Navbar: React.FC = () => { return () => window.removeEventListener('scroll', handleScroll); }, []); + useEffect(() => { + const handleResize = () => { + if (window.innerWidth >= 768) { + setIsMobileMenuOpen(false); + } + }; + window.addEventListener('resize', handleResize); + return () => window.removeEventListener('resize', handleResize); + }, []); + return ( ); }; diff --git a/pm2.config.cjs b/pm2.config.cjs new file mode 100644 index 0000000..d45fa1e --- /dev/null +++ b/pm2.config.cjs @@ -0,0 +1,35 @@ +const path = require('path') +const dotenv = require('dotenv') + +// 加载 .env 文件 +const envConfig = dotenv.config({ path: path.resolve(__dirname, '.env') }) + +if (envConfig.error) { + console.error('Error loading .env file:', envConfig.error) +} + +module.exports = { + apps: [ + { + name: 'nanjing-feie-tech', + script: 'bun', + args: 'run start', + cwd: __dirname, + env: { + ...process.env, + NODE_ENV: 'production', + }, + instances: 1, + exec_mode: 'fork', + watch: false, + max_memory_restart: '1G', + error_file: './logs/err.log', + out_file: './logs/out.log', + log_file: './logs/combined.log', + time: true, + autorestart: true, + max_restarts: 10, + min_uptime: '10s' + } + ] +}