diff --git a/package-lock.json b/package-lock.json
index c1f0655..71be6e6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,7 @@
"@emotion/styled": "^11.13.0",
"@mui/x-date-pickers": "^7.12.0",
"dayjs": "^1.11.12",
+ "axios": "^1.7.3",
"firebase": "^10.12.3",
"next": "14.2.5",
"react": "^18",
@@ -2165,6 +2166,11 @@
"integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==",
"dev": true
},
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
+ },
"node_modules/available-typed-arrays": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
@@ -2189,6 +2195,16 @@
"node": ">=4"
}
},
+ "node_modules/axios": {
+ "version": "1.7.3",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.3.tgz",
+ "integrity": "sha512-Ar7ND9pU99eJ9GpoGQKhKf58GpUOgnzuaB7ueNQ5BMi0p+LZ5oaEnfF999fAArcTIBwXTCHAmGcHOZJaWPq9Nw==",
+ "dependencies": {
+ "follow-redirects": "^1.15.6",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
"node_modules/axobject-query": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz",
@@ -2435,6 +2451,17 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -2657,6 +2684,14 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
@@ -3545,6 +3580,25 @@
"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
"dev": true
},
+ "node_modules/follow-redirects": {
+ "version": "1.15.6",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
+ "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
"node_modules/for-each": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
@@ -3570,6 +3624,19 @@
"url": "https://github.com/sponsors/isaacs"
}
},
+ "node_modules/form-data": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+ "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -4722,6 +4789,25 @@
"node": ">=4"
}
},
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -5352,6 +5438,11 @@
"node": ">=12.0.0"
}
},
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
+ },
"node_modules/prr": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
diff --git a/package.json b/package.json
index 701fc53..cee24fb 100644
--- a/package.json
+++ b/package.json
@@ -9,9 +9,11 @@
"lint": "next lint"
},
"dependencies": {
+
"@emotion/styled": "^11.13.0",
"@mui/x-date-pickers": "^7.12.0",
"dayjs": "^1.11.12",
+ "axios": "^1.7.3",
"firebase": "^10.12.3",
"next": "14.2.5",
"react": "^18",
diff --git a/src/app/_common/header.module.scss b/src/app/_common/header.module.scss
new file mode 100644
index 0000000..219bb55
--- /dev/null
+++ b/src/app/_common/header.module.scss
@@ -0,0 +1,36 @@
+@use '../../lib/styles/palette' as *;
+
+.top_bar {
+ display: flex;
+ width: 334px;
+ height: 31px;
+ justify-content: space-between;
+ align-items: center;
+ flex-shrink: 0;
+
+ color: $black-color;
+ font-family: Inter;
+ font-size: 20px;
+ font-style: normal;
+ font-weight: 600;
+ line-height: normal;
+
+ .pay {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ }
+
+ .setting {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+}
+.info {
+ color: $dark-gray-color;
+ font-size: 13px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: normal;
+}
\ No newline at end of file
diff --git a/src/app/_common/header.tsx b/src/app/_common/header.tsx
index 738ebae..6bcb1ae 100644
--- a/src/app/_common/header.tsx
+++ b/src/app/_common/header.tsx
@@ -1,9 +1,30 @@
+import { useState } from 'react';
+import styles from './header.module.scss'
-export default function Header() {
- return (
-
-
+
+export default function Header({pageName, info}: {pageName: string, info: string}) {
+
+ return (
+
+
+
+ {pageName}
+
+
- );
- }
+
+
+
{info}
+
+
+ );
+}
\ No newline at end of file
diff --git a/src/app/_common/navBar.module.scss b/src/app/_common/navBar.module.scss
index e3ab7e4..4e7eaa4 100644
--- a/src/app/_common/navBar.module.scss
+++ b/src/app/_common/navBar.module.scss
@@ -1,7 +1,6 @@
@use '../../lib/styles/palette' as *;
.fakeEl{
- height: 62px;
}
.navbar {
display: flex;
diff --git a/src/app/_common/navBar.tsx b/src/app/_common/navBar.tsx
index 8715ec4..016f5d4 100644
--- a/src/app/_common/navBar.tsx
+++ b/src/app/_common/navBar.tsx
@@ -7,9 +7,12 @@ export default function NavBar() {
const mainColor = "#95cc3c";
const blackColor = "#2C2C2C";
- const [nowPage, setNowPage] = useState
("home");
-
const router = useRouter();
+ const slug = "home" // router.query;
+
+ const [nowPage, setNowPage] = useState(slug);
+
+
const clickHome = () => {
setNowPage("home");
router.push("/home");
@@ -27,6 +30,7 @@ export default function NavBar() {
router.push("/mypage");
};
+
return (
diff --git a/src/app/api/openai/route.js b/src/app/api/openai/route.js
new file mode 100644
index 0000000..204a22a
--- /dev/null
+++ b/src/app/api/openai/route.js
@@ -0,0 +1,49 @@
+import { NextResponse } from 'next/server';
+import axios from 'axios';
+
+export async function POST(request) {
+ const { goal, status } = await request.json();
+
+ try {
+ const response = await axios.post(
+ 'https://api.openai.com/v1/chat/completions',
+ {
+ model: 'gpt-4o-mini',
+ messages: [
+ {
+ role: 'system',
+ content: '너는 운동, 식단, 잠관리를 해주는 앱의 어시스턴트야.'
+ },
+ {
+ role: 'user',
+ content: `
+ goal: ${JSON.stringify(goal)}
+ status: ${JSON.stringify(status)}
+ 위의 goal과 status를 0부터 100까지의 점수로 변환해줘.
+ goal은 사용자가 지정한 목표를 나타내고, status는 사용자의 현재 상태를 나타내.
+ 0은 아무것도 하지 않았거나 아무것도 달성하지 못했을 때, 100은 목표를 완벽하게 달성했을 때를 의미해.
+ 칼로리가 너무 적거나 너무 커도, 자는 시간이 너무 적거나 너무 많아도 안돼.
+ 운동은 얼마나 하든 괜찮아
+ 프로그램에서 사용되는거니까 다른말은 하지말고 0부터 100까지의 정수로만 변환해줘.
+
+ `
+ }
+ ],
+ max_tokens: 256,
+ temperature: 0.7,
+ },
+ {
+ headers: {
+ 'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
+ 'Content-Type': 'application/json',
+ },
+ }
+ );
+
+ const score = response.data.choices[0].message.content.trim();
+ return NextResponse.json({ score });
+ } catch (error) {
+ console.error(error);
+ return NextResponse.json({ error: 'Error generating score' }, { status: 500 });
+ }
+}
diff --git a/src/app/home/page.module.scss b/src/app/home/page.module.scss
index b4fa145..9af942c 100644
--- a/src/app/home/page.module.scss
+++ b/src/app/home/page.module.scss
@@ -24,34 +24,6 @@
line-height: normal;
}
-.top_bar {
- display: flex;
- width: 334px;
- height: 31px;
- justify-content: space-between;
- align-items: center;
- flex-shrink: 0;
-
- color: $main-color;
- font-family: Inter;
- font-size: 20px;
- font-style: normal;
- font-weight: 600;
- line-height: normal;
-
- .pay {
- display: flex;
- align-items: center;
- gap: 4px;
- }
-
- .setting {
- display: flex;
- align-items: center;
- gap: 8px;
- }
-}
-
.home_status {
display: flex;
padding: 0px 20px;
diff --git a/src/app/home/page.tsx b/src/app/home/page.tsx
index 102c7ca..7c5b80c 100644
--- a/src/app/home/page.tsx
+++ b/src/app/home/page.tsx
@@ -4,31 +4,13 @@ import styles from "./page.module.scss";
import HomeView from "./homeView";
import NavBar from "../_common/navBar";
-
+import Header from "../_common/header";
export default function HomePage() {
return (
-
+
오늘의 기분
diff --git a/src/app/layout.module.scss b/src/app/layout.module.scss
index 250abf0..3718202 100644
--- a/src/app/layout.module.scss
+++ b/src/app/layout.module.scss
@@ -1,15 +1,10 @@
.child {
-// background-color: red;
width: 390px;
-// border: 1px solid #000;
- box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
+ box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
}
.parent {
-// background-color: blue;
width: 100%;
display: flex;
- justify-content: center;
-// shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
-
+ justify-content: center;
}
\ No newline at end of file
diff --git a/src/app/log/DietLog.tsx b/src/app/log/DietLog.tsx
index 9ea6bb2..6824a8d 100644
--- a/src/app/log/DietLog.tsx
+++ b/src/app/log/DietLog.tsx
@@ -3,22 +3,33 @@
import { useDietOfDay } from "@/lib/firebase/api/dietAPI";
import Image from "next/image";
+import styles from './page.module.scss'
+import { logInput } from "./page";
+
export default function DietLog() {
const { data, isLoading, isError } = useDietOfDay(new Date());
if (isLoading) return
Loading...
;
if (isError) return
Error
;
- if (!data) return
;
+ if (!data) return
활동을 추가해보세요!
;
return (
-
-
식습관
- {data.map((diet) => (
-
-
{diet.name}
-
{diet.calorie}
-
-
- ))}
+
+
+
+ {data.map((diet) => (
+
+
{diet.name}
+
{diet.calorie}
+
+
+ ))}
+
);
}
diff --git a/src/app/log/SleepLog.tsx b/src/app/log/SleepLog.tsx
index 2a5d306..2cc738f 100644
--- a/src/app/log/SleepLog.tsx
+++ b/src/app/log/SleepLog.tsx
@@ -2,22 +2,51 @@
import { useSleepOfDay } from "@/lib/firebase/api/sleepAPI";
+import styles from './page.module.scss'
+import { useState } from "react";
+
+
export default function SleepLog() {
+
const { data, isLoading, isError } = useSleepOfDay(new Date());
+ const [ logList, setLogList ] = useState(
+ data.map((sleep) => (
+
+
{sleep.label}
+
{sleep.sleepStart.toISOString()}
+
{sleep.sleepEnd.toISOString()}
+
+ )));
if (isLoading) return
Loading...
;
if (isError) return
Error
;
- if (!data) return
;
+ if (!data) return
활동을 추가해보세요!
;
- return (
-
-
수면
- {data.map((sleep) => (
-
-
{sleep.label}
-
{sleep.sleepStart.toISOString()}
-
{sleep.sleepEnd.toISOString()}
+ const logInput = () => {
+ console.log("log input select");
+ setLogList([...logList,
+
+ ])
+ }
+
+ return (
+
);
}
diff --git a/src/app/log/WorkoutLog.tsx b/src/app/log/WorkoutLog.tsx
index fa46207..0b280e3 100644
--- a/src/app/log/WorkoutLog.tsx
+++ b/src/app/log/WorkoutLog.tsx
@@ -2,22 +2,34 @@
import { useWorkoutOfDay } from "@/lib/firebase/api/workoutAPI";
+import styles from './page.module.scss'
+import { logInput } from "./page";
+
export default function WorkoutLog() {
const { data, isLoading, isError } = useWorkoutOfDay(new Date());
if (isLoading) return
Loading...
;
if (isError) return
Error
;
- if (!data) return
;
+ if (!data) return
활동을 추가해보세요!
;
return (
-
-
운동
- {data.map((workout) => (
-
-
{workout.exerciseName}
-
{workout.duration}
-
{workout.datetime.toISOString()}
-
- ))}
+
+
+
+ {data.map((workout) => (
+
+
{workout.exerciseName}
+
{workout.duration}
+
{workout.datetime.toISOString()}
+
+ ))}
+
+
);
}
diff --git a/src/app/log/page.module.scss b/src/app/log/page.module.scss
new file mode 100644
index 0000000..3a1f969
--- /dev/null
+++ b/src/app/log/page.module.scss
@@ -0,0 +1,88 @@
+@use '../../lib/styles/palette' as *;
+
+.log_frame {
+ display: flex;
+ height: 100vh;
+ padding: 40px 20px;
+ flex-direction: column;
+ align-items: center;
+ gap: 40px;
+ flex-shrink: 0;
+
+ .today_score_frame {
+ display: flex;
+ padding: 20px;
+ justify-content: space-between;
+ align-items: center;
+ align-self: stretch;
+
+ border-radius: 20px;
+ background: $sub-color;
+
+ .today_score_text {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 4px;
+
+ .today_score_text_in {
+ color: $black-color;
+ font-weight: 600;
+ }
+ }
+
+ .today_score {
+ color: $black-color;
+ font-size: 36px;
+ font-style: normal;
+ font-weight: 600;
+ line-height: normal;
+ }
+ }
+
+}
+
+.add_log_frame {
+ display: flex;
+ padding: 20px;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ gap: 20px;
+ align-self: stretch;
+
+ border-radius: 20px;
+ background: $sub-color;
+
+ .add_log_title {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ align-self: stretch;
+
+ color: $black-color;
+ font-size: 20px;
+ }
+}
+
+.log_input {
+ display: flex;
+ padding: 4px 8px;
+ justify-content: space-between;
+ align-items: center;
+ align-self: stretch;
+
+ border-radius: 16px;
+ background: $main-color;
+
+ .log_input_info {
+ display: flex;
+ align-items: center;
+ gap: 2px;
+ align-self: stretch;
+ }
+ input {
+ width: 80px;
+ padding: 0 4px 0 4px;
+ }
+}
\ No newline at end of file
diff --git a/src/app/log/page.tsx b/src/app/log/page.tsx
index e36b087..ca2eb08 100644
--- a/src/app/log/page.tsx
+++ b/src/app/log/page.tsx
@@ -1,14 +1,44 @@
+"use client"
+
import DietLog from "./DietLog";
import SleepLog from "./SleepLog";
import WorkoutLog from "./WorkoutLog";
+import styles from './page.module.scss'
+
+import Header from "../_common/header";
+import NavBar from "../_common/navBar";
+import { useState } from "react";
+
+
+export function logInput() {
+ console.log("log input select");
+ return (
+
+
+ 완료
+
+ )
+}
+
export default function LogPage() {
+ const [ score, setScore ] = useState(100);
return (
-
Log
-
-
-
+
+
+
+
+
오늘의 점수
+
오늘도 열심히 활동했어요!
+
+
{score}점
+
+
+
+
+
+
);
}
diff --git a/src/app/page.module.scss b/src/app/page.module.scss
index 9bb5eb0..90dac13 100644
--- a/src/app/page.module.scss
+++ b/src/app/page.module.scss
@@ -1,5 +1,6 @@
.main {
display: flex;
+ height: 100vh;
flex-direction: column;
justify-content: space-around;
align-items: center;
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 115d814..9d19c3e 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -8,7 +8,7 @@ export default function Home() {
-
수면, 음식, 운동
+
수면, 식단, 운동
나만의 펫과 함께
오늘 하루를 활동해 볼까요?
diff --git a/src/lib/styles/_palette.scss b/src/lib/styles/_palette.scss
index 74c77d0..bc61674 100644
--- a/src/lib/styles/_palette.scss
+++ b/src/lib/styles/_palette.scss
@@ -1,5 +1,6 @@
// 색상 팔레트
$main-color: #95cc3c;
+$sub-color: #F7FDF2;
$black-color: #2c2c2c;
$dark-gray-color: #535353;
$light-gray-color: #f0f0f0;