Jelajahi Sumber

借助ai进行调整结构

kindring 3 minggu lalu
induk
melakukan
0fc3fe10a5
5 mengubah file dengan 255 tambahan dan 118 penghapusan
  1. 56 36
      src/App.css
  2. 106 20
      src/App.tsx
  3. 0 0
      src/components/Today.tsx
  4. 85 0
      src/data/data.ts
  5. 8 62
      src/index.css

+ 56 - 36
src/App.css

@@ -1,42 +1,62 @@
 #root {
-  max-width: 1280px;
-  margin: 0 auto;
-  padding: 2rem;
-  text-align: center;
+  display: flex;
+  width: 100%;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  position: relative;
+}
+.header-container {
+  display: flex;
+  align-items: center;
+  background-color: white;
+  border-bottom: 1px solid #dcdcdc;
+  width: 100%;
+  height: 5em;
+  padding: 0.5em 1.5em;
+  box-sizing: border-box;
+  justify-content: space-between;
+}
+.header-container .user-icon {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  height: 100%;
+}
+.header-container .user-icon .img {
+  width: 45px;
+  height: 45px;
+  overflow: hidden;
+  border-radius: 50%;
+}
+.header-container .user-icon span{
+  margin-left: 10px;
+}
+.img img {
+  width: 100%;
+  height: 100%;
 }
 
-.logo {
-  height: 6em;
-  padding: 1.5em;
-  will-change: filter;
-  transition: filter 300ms;
-}
-.logo:hover {
-  filter: drop-shadow(0 0 2em #646cffaa);
-}
-.logo.react:hover {
-  filter: drop-shadow(0 0 2em #61dafbaa);
-}
-
-@keyframes logo-spin {
-  from {
-    transform: rotate(0deg);
-  }
-  to {
-    transform: rotate(360deg);
-  }
-}
-
-@media (prefers-reduced-motion: no-preference) {
-  a:nth-of-type(2) .logo {
-    animation: logo-spin infinite 20s linear;
-  }
-}
 
 .card {
-  padding: 2em;
-}
-
-.read-the-docs {
-  color: #888;
+  display: flex;
+  flex-direction: column;
+  width: calc(100% - 20px);
+  margin: 10px auto 0;
+  border-radius: 5px;
+  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
+  background-color: white;
+  box-sizing: border-box;
+  padding: 5px 10px;
+}
+.card .title {
+  font-size: 16px;
+  font-weight: bold;
+  margin-bottom: 10px;
+  color: #333;
+  text-transform: uppercase;
+  letter-spacing: 1px;
+  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
+  border-bottom: 1px solid #dcdcdc;
+  padding-bottom: 5px;
 }

+ 106 - 20
src/App.tsx

@@ -3,31 +3,117 @@ import reactLogo from './assets/react.svg'
 import viteLogo from '/vite.svg'
 import './App.css'
 
+import { user } from "./data/data.ts";
+
 function App() {
   const [count, setCount] = useState(0)
 
   return (
     <>
-      <div>
-        <a href="https://vite.dev" target="_blank">
-          <img src={viteLogo} className="logo" alt="Vite logo" />
-        </a>
-        <a href="https://react.dev" target="_blank">
-          <img src={reactLogo} className="logo react" alt="React logo" />
-        </a>
-      </div>
-      <h1>Vite + React</h1>
-      <div className="card">
-        <button onClick={() => setCount((count) => count + 1)}>
-          count is {count}
-        </button>
-        <p>
-          Edit <code>src/App.tsx</code> and save to test HMR
-        </p>
-      </div>
-      <p className="read-the-docs">
-        Click on the Vite and React logos to learn more
-      </p>
+      {/*
+        ┌─────────────────────────────────┐
+        │ 1. 状态栏 (用户信息 + 点数)        │
+        ├─────────────────────────────────┤
+        │ 2. 今日概览卡片 (数据卡片)          │
+        ├─────────────────────────────────┤
+        │ 3. 核心打卡区 (大按钮 + 进度)       │
+        ├─────────────────────────────────┤
+        │ 4. 快捷打卡面板 (今日习惯列表)       │
+        ├─────────────────────────────────┤
+        │ 5. 数据统计区 (图表卡片)           │
+        ├─────────────────────────────────┤
+        │ 6. 底部导航栏 (可选的)             │
+        └─────────────────────────────────┘
+      */}
+            <div className="header-container">
+
+                {/* 问候语 2月2日星期一*/}
+                <div className="tips">
+                    <p className="text-gray-500 text-sm font-medium mb-1">{new Date().toLocaleDateString('zh-CN', {
+                        month: 'long',
+                        day: 'numeric',
+                        weekday: 'long'
+                    })}</p>
+                    <h1 className="text-3xl font-bold text-gray-900">早安, {user.name}</h1>
+                </div>
+                <div className="user-icon">
+                    <div className="img">
+                        <img src="https://picsum.photos/200/300" alt="User"/>
+                    </div>
+                </div>
+            </div>
+        <div className="today">
+                <div className="card">
+                    <div className="title">今日概览</div>
+                    <div className="data">
+                        <div className="item">
+                            <div className="label">Habits</div>
+                            <div className="value">0</div>
+                        </div>
+                        <div className="item">
+                            <div className="label">Points</div>
+                            <div className="value">0</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div className="core">
+                <div className="card">
+                    <div className="title">Core</div>
+                    <div className="progress">
+                        <div className="bar"></div>
+                        <div className="text">0%</div>
+                    </div>
+                    <button className="button">Start</button>
+                </div>
+            </div>
+            <div className="quick">
+                <div className="card">
+                    <div className="title">Quick</div>
+                    <div className="habits">
+                        <div className="habit">
+                            <div className="icon">
+                                <img src="https://picsum.photos/200/300" alt="Habit" />
+                            </div>
+                            <div className="name">Habit</div>
+                        </div>
+                        <div className="habit"></div>
+                    </div>
+                </div>
+            </div>
+            <div className="stats">
+                <div className="card">
+                    <div className="title">Stats</div>
+                    <div className="charts">
+                        <div className="chart"></div>
+                        <div className="chart"></div>
+                    </div>
+                </div>
+            </div>
+        <div className="div">
+            <div>
+
+                <a href="https://vite.dev" target="_blank">
+                    <img src={viteLogo} className="logo" alt="Vite logo"/>
+                </a>
+                <a href="https://react.dev" target="_blank">
+                    <img src={reactLogo} className="logo react" alt="React logo"/>
+                </a>
+            </div>
+            <h1>Vite + React</h1>
+            <div className="card">
+                <button onClick={() => setCount((count) => count + 1)}>
+                    count is {count}
+                </button>
+                <p>
+                    Edit <code>src/App.tsx</code> and save to test HMR
+                </p>
+            </div>
+            <p className="read-the-docs">
+                Click on the Vite and React logos to learn more
+            </p>
+        </div>
+
     </>
   )
 }

+ 0 - 0
src/components/Today.tsx


+ 85 - 0
src/data/data.ts

@@ -0,0 +1,85 @@
+import {  BookOpen, Droplets, Moon, Footprints } from 'lucide-react';
+
+export const user = {
+    name: "Alex",
+    karma: 1250,
+    todayPotential: 45,
+    streak: 12,
+    level: "习惯探索者"
+};
+
+export const habits = [
+    {
+        id: '1',
+        name: '喝水',
+        icon: Droplets,
+        streak: 7,
+        reward: '1-3',
+        completed: false,
+        type: 'kindling', // Fire habit
+        category: '健康'
+    },
+    {
+        id: '2',
+        name: '阅读5页',
+        icon: BookOpen,
+        streak: 3,
+        reward: '5',
+        completed: true,
+        type: 'kindling',
+        category: '成长'
+    },
+    {
+        id: '3',
+        name: '早睡',
+        icon: Moon,
+        streak: 12,
+        reward: '10',
+        completed: false,
+        type: 'regular',
+        category: '健康'
+    },
+    {
+        id: '4',
+        name: '晨跑',
+        icon: Footprints,
+        streak: 0,
+        reward: '8',
+        completed: false,
+        type: 'regular',
+        category: '健康'
+    }
+];
+
+export const quotes = [
+    "今天的坚持是明天的复利。",
+    "跬步千里,积微成著。",
+    "持之以恒是掌握精髓的关键。"
+];
+
+export const transactions = [
+    {
+        id: '1',
+        category: '健康饮食',
+        amount: -15,
+        karma: 5,
+        type: 'expense',
+        date: '2023-10-27 12:30'
+    },
+    {
+        id: '2',
+        category: '工资',
+        amount: 5000,
+        karma: 0,
+        type: 'income',
+        date: '2023-10-25 09:00'
+    },
+    {
+        id: '3',
+        category: '垃圾食品',
+        amount: -10,
+        karma: -5,
+        type: 'expense',
+        date: '2023-10-24 18:00'
+    }
+];

+ 8 - 62
src/index.css

@@ -1,68 +1,14 @@
-:root {
-  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
-  line-height: 1.5;
-  font-weight: 400;
 
-  color-scheme: light dark;
-  color: rgba(255, 255, 255, 0.87);
-  background-color: #242424;
-
-  font-synthesis: none;
-  text-rendering: optimizeLegibility;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-}
-
-a {
-  font-weight: 500;
-  color: #646cff;
-  text-decoration: inherit;
-}
-a:hover {
-  color: #535bf2;
+*{
+    margin: 0;
+    padding: 0;
 }
 
+window,
 body {
-  margin: 0;
-  display: flex;
-  place-items: center;
-  min-width: 320px;
-  min-height: 100vh;
-}
-
-h1 {
-  font-size: 3.2em;
-  line-height: 1.1;
+  background-color: #fafafa;
+  width: 100%;
+  height: 100%;
+  font-size: 16px;
 }
 
-button {
-  border-radius: 8px;
-  border: 1px solid transparent;
-  padding: 0.6em 1.2em;
-  font-size: 1em;
-  font-weight: 500;
-  font-family: inherit;
-  background-color: #1a1a1a;
-  cursor: pointer;
-  transition: border-color 0.25s;
-}
-button:hover {
-  border-color: #646cff;
-}
-button:focus,
-button:focus-visible {
-  outline: 4px auto -webkit-focus-ring-color;
-}
-
-@media (prefers-color-scheme: light) {
-  :root {
-    color: #213547;
-    background-color: #ffffff;
-  }
-  a:hover {
-    color: #747bff;
-  }
-  button {
-    background-color: #f9f9f9;
-  }
-}