Skip to content

Commit

Permalink
Merge pull request #3 from Konkuk-KUIT/dainn
Browse files Browse the repository at this point in the history
AddHabit, Myprogress ํŽ˜์ด์ง€
  • Loading branch information
dainshon authored Jul 5, 2024
2 parents 5e55903 + 8417569 commit a461e8c
Show file tree
Hide file tree
Showing 10 changed files with 636 additions and 13 deletions.
395 changes: 390 additions & 5 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@
"dependencies": {
"@types/react-router-dom": "^5.3.3",
"@types/styled-components": "^5.1.34",

"chart.js": "^4.4.3",
"date-fns": "^3.6.0",

"react": "^18.3.1",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.3.1",
"react-router-dom": "^6.24.1",
"recharts": "^2.12.7",
"styled-components": "^6.1.11",
"vite-plugin-svgr": "^4.2.0"
},
Expand Down
21 changes: 13 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { createBrowserRouter, Outlet, RouterProvider } from "react-router-dom";
import HomePage from "./pages/HomePage";
import HabitDetailPage from "./pages/HabitDetailPage/HabitDetailPage";
import FeedPage from "./pages/FeedPage/FeedPage";

import AddHabit from "./pages/AddHabit/addHabit";
import MyProgress from "./pages/MyProgress/myProgress";

import BottomNavBar from "./components/BottomNavBar";
import Header from "./components/Header";
import styled from "styled-components";
Expand Down Expand Up @@ -32,15 +36,16 @@ function App() {
</>
),
children: [
{ path: "/", element: <HomePage /> },
{ path: "/habitDetail", element: <HabitDetailPage /> },
{ path: "/feed", element: <FeedPage /> },
{ path: "/addHabit" },
{ path: "/myprogress" },
{ path: "/store" },
{ path: "/option" },
],
{ path: "/", element: <HomePage /> },
{ path: "/habitDetail", element: <HabitDetailPage /> },
{ path: "/feed", element: <FeedPage /> },
{ path: "/addHabit", element: <AddHabit />},
{ path: "/myProgress", element: <MyProgress />},
{ path: "/store" },
{ path: "/option" },
],
},

];
const router = createBrowserRouter(routes, { basename: "/KUIT3_Hackathon_Team5-Web/" });

Expand Down
1 change: 1 addition & 0 deletions src/assets/character.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/period.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 111 additions & 0 deletions src/pages/AddHabit/addHabit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//import React, { useEffect } from "react";
// import { useParams } from "react-router-dom";
import styled from 'styled-components';
import arrowImg from "@/assets/period.svg";
import characterImg from "@/assets/character.svg";

const StyledTotal = styled.div`
width: 390px;
height: 844px;
align-items: center;
background-color: #65A55B;
`;

const StyledInputBox = styled.div`
width: 328px;
height: 44px;
flex-shrink: 0;
background-color: #F8F7F7;
border-radius: 8px;
justify-content: center;
margin-left: 31px
`;

const StyledBox = styled.div`
width: 124px;
height: 44px;
flex-shrink: 0;
margin-right: 20px;
margin-left: 10px;
background-color: #F8F7F7;
border-radius: 8px;
`;

const StyledPeriod = styled.div`
display: flex;
justify-content: space-around;
margin-left: 31px
`;

const StyledMemoBox = styled.div`
width: 328px;
height: 150px;
flex-shrink: 0;
background-color: #F8F7F7;
border-radius: 8px;
margin-left: 31px
`;

const AddButton = styled.div`
align-content: center;
width: 328px;
height: 48px;
border-radius: 12px;
background: #D5CCEE;
gap: 10px;
margin-left: 31px;
`;
const TextContent = styled.p`
text-align: center;
font-size: 17px;
margin-top: 11px;
align-items:
`;

const handleClick = () => {
console.log(1);
};

// function setHabbitName(){
// console.log(1);

// }

//const [habitName, sethabitName] = useState("");

export default function addHabit() {
return (
<StyledTotal>
<p className="text-left text-[17px] ">
์Šต๊ด€ ์ด๋ฆ„
</p>
<StyledInputBox><input type="text"></input></StyledInputBox>
{/* <StyledInputBox type="text" placeholder="์ด๋ฆ„์„ ์ž…๋ ฅํ•˜์„ธ์š”."></StyledInputBox> */}

<p className="text-left text-[17px]">๊ธฐ๊ฐ„</p>
<StyledPeriod>
<StyledBox onClick={handleClick}>
<input type="date"></input>
</StyledBox>
<img src={arrowImg}></img>
<StyledBox>
<input type="date"></input>
</StyledBox>
</StyledPeriod>


<p className="text-left text-[17px]">์Šคํ‹ฐ์ปค ์„ ํƒ</p>
<img src={characterImg}></img>

<p className="text-left text-[17px]">๋ฐฐ๊ฒฝ์ƒ‰ ์„ ํƒ</p>

<p className="text-left text-[17px]">๋ฉ”๋ชจ</p>
<StyledMemoBox><textarea></textarea></StyledMemoBox>
<AddButton onClick={handleClick}><TextContent>์Šต๊ด€ ๋“ฑ๋ก</TextContent></AddButton>
</StyledTotal>

)
}
1 change: 1 addition & 0 deletions src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function HabitComponent({ habitData }: HabitComponentProps) {
}

export default function HomePage() {

const sampleRes: ResponseData = {
code: "string",
message: "string",
Expand Down
36 changes: 36 additions & 0 deletions src/pages/MyProgress/DoughnutChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// DoughnutChart.tsx
import React from 'react';
import { PieChart, Pie, Cell, Tooltip, Legend, ResponsiveContainer } from 'recharts';

interface DoughnutChartProps {
data: { name: string; value: number; color: string }[];
}

const DoughnutChart: React.FC<DoughnutChartProps> = ({ data }) => {
return (
<ResponsiveContainer width="100%" height={300}>
<PieChart>
<Pie
data={data}
dataKey="value"
nameKey="name"
cx="50%"
cy="50%"
innerRadius={60}
outerRadius={100}

paddingAngle={5}
label
>
{data.map((entry, index) => (
<Cell key={`cell-${index}`} fill={entry.color} />
))}
</Pie>
<Tooltip />
<Legend />
</PieChart>
</ResponsiveContainer>
);
};

export default DoughnutChart;
6 changes: 6 additions & 0 deletions src/pages/MyProgress/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';

Check failure on line 1 in src/pages/MyProgress/ProgressBar.tsx

View workflow job for this annotation

GitHub Actions / deploy

'React' is declared but its value is never read.
import styled from 'styled-components';

Check failure on line 2 in src/pages/MyProgress/ProgressBar.tsx

View workflow job for this annotation

GitHub Actions / deploy

'styled' is declared but its value is never read.

interface ProgressBarProps {

Check failure on line 4 in src/pages/MyProgress/ProgressBar.tsx

View workflow job for this annotation

GitHub Actions / deploy

'ProgressBarProps' is declared but never used.
progress: number;
}
72 changes: 72 additions & 0 deletions src/pages/MyProgress/myProgress.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import styled from 'styled-components';
import React from 'react';

Check failure on line 2 in src/pages/MyProgress/myProgress.tsx

View workflow job for this annotation

GitHub Actions / deploy

'React' is declared but its value is never read.
import { Chart as ChartJS, ArcElement, Tooltip, Legend } from 'chart.js';

Check failure on line 3 in src/pages/MyProgress/myProgress.tsx

View workflow job for this annotation

GitHub Actions / deploy

All imports in import declaration are unused.
import DoughnutChart from './DoughnutChart';

interface DoughnutChartProps {

Check failure on line 6 in src/pages/MyProgress/myProgress.tsx

View workflow job for this annotation

GitHub Actions / deploy

'DoughnutChartProps' is declared but never used.
data: number[];
labels: string[];
backgroundColors: string[];
}

const StyledTotal= styled.div`
width: 390px;
height: 844px;
align-items: center;
background-color: #65A55B;
`;

const StyledText1 = styled.div`
display: flex;
width: 328px;
height: 30px;
flex-direction: column;
justify-content: center;
flex-shrink: 0;
`;

const StyledText2 = styled.div`
display: flex;
width: 328px;
height: 30px;
flex-direction: column;
justify-content: center;
flex-shrink: 0;
`;

const StyledTprogress = styled.div`
`;

const Doughnut = styled.div`
width: 100%;
height: 300px;
`;

export default function myProgress() {
const data = [
{ name: '๋„์ „์ค‘', value: 10, color: '#782EBF' },
{ name: '๋„์ „ ์„ฑ๊ณต', value: 20, color: '#8E9EE9' },
{ name: '๋„์ „ ์‹คํŒจ', value: 30, color: '#9D80E0' },
];

return (
<StyledTotal>
<StyledText1>ํ˜„์žฌ 90% ์„ฑ๊ณต๋ฅ ๋กœ </StyledText1>
<StyledText1>์Šต๊ด€ ํ˜•์„ฑ์ค‘์ด์—์š”!</StyledText1>
<StyledTprogress>
<progress id="progress" value="50" max="100"></progress>
</StyledTprogress>



<StyledText2>์ง€๊ธˆ๊นŒ์ง€</StyledText2>
<StyledText2>11๊ฐœ์˜ ์Šต๊ด€์„ ํ˜•์„ฑํ–ˆ์–ด์š”!</StyledText2>

<Doughnut>
<DoughnutChart data={data} />
</Doughnut>

</StyledTotal>
);
}

0 comments on commit a461e8c

Please sign in to comment.