dashboard 형태의 UI 수정 및 고도화

This commit is contained in:
2026-03-04 08:29:39 +09:00
parent 618d5f8e6f
commit ccc9f7c634
17 changed files with 1296 additions and 224 deletions

View File

@@ -1,13 +1,30 @@
import React from 'react';
import React, { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
import { navLinks } from '../../routes.jsx';
import { getBlogPosts } from '../../data/blog';
import { getTodos } from '../../api';
import myPhoto from '../../assets/myPhoto.jpg';
import './Home.css';
const SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000;
const Home = () => {
const posts = getBlogPosts().slice(0, 3);
const highlights = navLinks.filter((link) => link.id !== 'home');
const [recentDev, setRecentDev] = useState([]);
useEffect(() => {
getTodos()
.then((todos) => {
if (!Array.isArray(todos)) return;
const now = Date.now();
const filtered = todos
.filter((t) => t.status === 'done' && t.updated_at && (now - new Date(t.updated_at).getTime()) <= SEVEN_DAYS_MS)
.slice(0, 5);
setRecentDev(filtered);
})
.catch(() => { /* 조용히 실패 */ });
}, []);
return (
<div className="home">
@@ -97,6 +114,36 @@ const Home = () => {
</div>
</section>
<section className="home-section">
<div className="home-section__header">
<h2>최근 개발</h2>
<p>최근 7 완료된 태스크를 보여줍니다.</p>
</div>
<div className="home-dev-log">
{recentDev.length === 0 ? (
<p className="home-dev-log__empty">완료된 태스크가 없습니다.</p>
) : (
recentDev.map((todo) => (
<div key={todo.id} className="home-dev-log__item">
<span className="home-dev-log__dot" />
<div className="home-dev-log__content">
<p className="home-dev-log__title">{todo.title}</p>
{todo.description && (
<p className="home-dev-log__desc">{todo.description}</p>
)}
</div>
<span className="home-dev-log__date">
{new Date(todo.updated_at).toLocaleDateString('ko-KR', { month: 'short', day: 'numeric' })}
</span>
</div>
))
)}
<Link to="/todo" className="home-dev-log__link">
Todo 보드 열기
</Link>
</div>
</section>
<section className="home-section">
<div className="home-section__header">
<h2>Profile</h2>