Spaces:
Sleeping
Sleeping
update app.css home.jsx adjust layout
Browse files- src/App.css +36 -1
- src/components/Home.jsx +4 -2
src/App.css
CHANGED
|
@@ -851,4 +851,39 @@ border: 2px solid transparent;
|
|
| 851 |
}
|
| 852 |
|
| 853 |
.avatar-circle.user { background-color: #555; }
|
| 854 |
-
.avatar-circle.admin { background-color: #ffaa00; border-color: #fff; box-shadow: 0 0 10px rgba(255, 170, 0, 0.5); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 851 |
}
|
| 852 |
|
| 853 |
.avatar-circle.user { background-color: #555; }
|
| 854 |
+
.avatar-circle.admin { background-color: #ffaa00; border-color: #fff; box-shadow: 0 0 10px rgba(255, 170, 0, 0.5); }
|
| 855 |
+
/* ================= 首页按钮 2x2 响应式网格 (终极修正版) ================= */
|
| 856 |
+
.home-button-grid {
|
| 857 |
+
display: grid;
|
| 858 |
+
grid-template-columns: 1fr 1fr; /* 强行平分两列,绝不妥协 */
|
| 859 |
+
gap: 20px; /* 按钮之间的间距 */
|
| 860 |
+
width: 100%;
|
| 861 |
+
max-width: 500px; /* 限制最大宽度,宽屏下也不会显得傻大黑粗 */
|
| 862 |
+
margin: 40px auto 0 auto; /* 上边距40px,左右auto保证绝对居中! */
|
| 863 |
+
}
|
| 864 |
+
|
| 865 |
+
.home-button-grid .btn-main {
|
| 866 |
+
width: 100%;
|
| 867 |
+
height: 60px; /* 统一高度,像一块块整齐的砖头 */
|
| 868 |
+
margin: 0; /* 清除默认外边距 */
|
| 869 |
+
padding: 10px;
|
| 870 |
+
font-size: 1rem;
|
| 871 |
+
display: flex;
|
| 872 |
+
justify-content: center;
|
| 873 |
+
align-items: center;
|
| 874 |
+
text-align: center;
|
| 875 |
+
box-sizing: border-box; /* 保证边框和内边距不会撑破格子 */
|
| 876 |
+
}
|
| 877 |
+
|
| 878 |
+
/* 📱 手机端专属适配 (屏幕宽度小于 600px 时自动缩放) */
|
| 879 |
+
@media (max-width: 600px) {
|
| 880 |
+
.home-button-grid {
|
| 881 |
+
gap: 15px;
|
| 882 |
+
max-width: 90%;
|
| 883 |
+
}
|
| 884 |
+
|
| 885 |
+
.home-button-grid .btn-main {
|
| 886 |
+
height: 50px;
|
| 887 |
+
font-size: 0.85rem;
|
| 888 |
+
}
|
| 889 |
+
}
|
src/components/Home.jsx
CHANGED
|
@@ -96,7 +96,10 @@ function Home({ setActiveTab, role, setRole }) {
|
|
| 96 |
<h1>FocusGuard</h1>
|
| 97 |
<p>Your productivity monitor assistant.</p>
|
| 98 |
|
| 99 |
-
{/*
|
|
|
|
|
|
|
|
|
|
| 100 |
<div className="home-button-grid">
|
| 101 |
|
| 102 |
<button className="btn-main" onClick={handleNewStart}>
|
|
@@ -110,7 +113,6 @@ function Home({ setActiveTab, role, setRole }) {
|
|
| 110 |
<button className="btn-main" onClick={() => fileInputRef.current.click()}>
|
| 111 |
Manual Import History
|
| 112 |
</button>
|
| 113 |
-
<input type="file" ref={fileInputRef} style={{ display: 'none' }} accept=".json" onChange={handleFileChange} />
|
| 114 |
|
| 115 |
<button className="btn-main" onClick={handleAdminToggle}>
|
| 116 |
{role === 'admin' ? 'Switch to User Mode' : 'Admin Login'}
|
|
|
|
| 96 |
<h1>FocusGuard</h1>
|
| 97 |
<p>Your productivity monitor assistant.</p>
|
| 98 |
|
| 99 |
+
{/* 🔪 把隐藏的上传框放在网格外面,绝对不让它占格子! */}
|
| 100 |
+
<input type="file" ref={fileInputRef} style={{ display: 'none' }} accept=".json" onChange={handleFileChange} />
|
| 101 |
+
|
| 102 |
+
{/* 使用全新的 2x2 网格容器,里面只放 4 个纯净的按钮 */}
|
| 103 |
<div className="home-button-grid">
|
| 104 |
|
| 105 |
<button className="btn-main" onClick={handleNewStart}>
|
|
|
|
| 113 |
<button className="btn-main" onClick={() => fileInputRef.current.click()}>
|
| 114 |
Manual Import History
|
| 115 |
</button>
|
|
|
|
| 116 |
|
| 117 |
<button className="btn-main" onClick={handleAdminToggle}>
|
| 118 |
{role === 'admin' ? 'Switch to User Mode' : 'Admin Login'}
|