diff --git a/public/sw.js.map b/public/sw.js.map index cd138b35..3b984282 100644 --- a/public/sw.js.map +++ b/public/sw.js.map @@ -1 +1 @@ -{"version":3,"file":"sw.js","sources":["../../../../private/var/folders/qc/d50qbm6d0xx190b3sx_6dfdc0000gn/T/4ef232c0c038fb1e25454bc6bfb93927/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/Users/hwang-yulim/Documents/cos-frontend/node_modules/workbox-routing/registerRoute.mjs';\nimport {NetworkFirst as workbox_strategies_NetworkFirst} from '/Users/hwang-yulim/Documents/cos-frontend/node_modules/workbox-strategies/NetworkFirst.mjs';\nimport {NetworkOnly as workbox_strategies_NetworkOnly} from '/Users/hwang-yulim/Documents/cos-frontend/node_modules/workbox-strategies/NetworkOnly.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/Users/hwang-yulim/Documents/cos-frontend/node_modules/workbox-core/clientsClaim.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\nimportScripts(\n \n);\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n\nworkbox_routing_registerRoute(\"/\", new workbox_strategies_NetworkFirst({ \"cacheName\":\"start-url\", plugins: [{ cacheWillUpdate: async ({ request, response, event, state }) => { if (response && response.type === 'opaqueredirect') { return new Response(response.body, { status: 200, statusText: 'OK', headers: response.headers }) } return response } }] }), 'GET');\nworkbox_routing_registerRoute(/.*/i, new workbox_strategies_NetworkOnly({ \"cacheName\":\"dev\", plugins: [] }), 'GET');\n\n\n\n\n"],"names":["importScripts","self","skipWaiting","workbox_core_clientsClaim","workbox_routing_registerRoute","workbox_strategies_NetworkFirst","plugins","cacheWillUpdate","request","response","event","state","type","Response","body","status","statusText","headers","workbox_strategies_NetworkOnly"],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CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAACQ,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAC,CAAC,CAAA;EAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAOR,QAAQ,CAAA;EAAC,CAAA,CAAA,CAAA,CAAA,CAAA;KAAG,CAAA;AAAE,CAAA,CAAA,CAAC,CAAC,CAAA,CAAE,CAAK,CAAA,CAAA,CAAA,CAAA,CAAC,CAAA;AACxWL,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAA6B,CAAC,CAAA,CAAA,CAAA,CAAA,CAAK,CAAE,CAAA,CAAA,CAAA,CAAA,CAAIc,mBAA8B,CAAC,CAAA;EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,EAAC,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA;EAAEZ,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAO,EAAE,CAAA,CAAA;EAAG,CAAC,CAAC,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC,CAAA;;"} \ No newline at end of file +{"version":3,"file":"sw.js","sources":["../../../../private/var/folders/qc/d50qbm6d0xx190b3sx_6dfdc0000gn/T/19d5159a7b51aa081388a2ce399674d5/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/Users/hwang-yulim/Documents/cos-frontend/node_modules/workbox-routing/registerRoute.mjs';\nimport {NetworkFirst as workbox_strategies_NetworkFirst} from '/Users/hwang-yulim/Documents/cos-frontend/node_modules/workbox-strategies/NetworkFirst.mjs';\nimport {NetworkOnly as workbox_strategies_NetworkOnly} from '/Users/hwang-yulim/Documents/cos-frontend/node_modules/workbox-strategies/NetworkOnly.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/Users/hwang-yulim/Documents/cos-frontend/node_modules/workbox-core/clientsClaim.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\nimportScripts(\n \n);\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n\nworkbox_routing_registerRoute(\"/\", new workbox_strategies_NetworkFirst({ \"cacheName\":\"start-url\", plugins: [{ cacheWillUpdate: async ({ request, response, event, state }) => { if (response && response.type === 'opaqueredirect') { return new Response(response.body, { status: 200, statusText: 'OK', headers: response.headers }) } return response } }] }), 'GET');\nworkbox_routing_registerRoute(/.*/i, new workbox_strategies_NetworkOnly({ \"cacheName\":\"dev\", plugins: [] }), 'GET');\n\n\n\n\n"],"names":["importScripts","self","skipWaiting","workbox_core_clientsClaim","workbox_routing_registerRoute","workbox_strategies_NetworkFirst","plugins","cacheWillUpdate","request","response","event","state","type","Response","body","status","statusText","headers","workbox_strategies_NetworkOnly"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAa,EAEZ,CAAA;EAQDC,CAAI,CAAA,CAAA,CAAA,CAACC,CAAW,CAAA,CAAA,CAAA,CAAA,CAA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A,CAAA,CAAA,CAAA,CAAOR,QAAQ,CAAA;EAAC,CAAA,CAAA,CAAA,CAAA,CAAA;KAAG,CAAA;AAAE,CAAA,CAAA,CAAC,CAAC,CAAA,CAAE,CAAK,CAAA,CAAA,CAAA,CAAA,CAAC,CAAA;AACxWL,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAA6B,CAAC,CAAA,CAAA,CAAA,CAAA,CAAK,CAAE,CAAA,CAAA,CAAA,CAAA,CAAIc,mBAA8B,CAAC,CAAA;EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,EAAC,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA;EAAEZ,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAO,EAAE,CAAA,CAAA;EAAG,CAAC,CAAC,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAC,CAAA;;"} \ No newline at end of file diff --git a/src/app/(main)/mypage/page.tsx b/src/app/(main)/mypage/page.tsx index 3c0d8423..92992503 100644 --- a/src/app/(main)/mypage/page.tsx +++ b/src/app/(main)/mypage/page.tsx @@ -59,8 +59,8 @@ export default function MyPage() { {/* 기타 */} {/**/} +
-
); diff --git a/src/app/(main)/mypage/profile/page.tsx b/src/app/(main)/mypage/profile/page.tsx index bc594c31..91bb15dc 100644 --- a/src/app/(main)/mypage/profile/page.tsx +++ b/src/app/(main)/mypage/profile/page.tsx @@ -77,6 +77,7 @@ const ProfileSettings = () => {
{userProfile(false); //기록하기 알림창 onoff조절 const [onAccumulatedModal, setOnAccumulatedModal] = useState(false); //기록완료 알림창 onoff조절 @@ -33,160 +31,33 @@ export default function StopWatch() { const [mStopwatchTime, setMStopwatchTime] = useRecoilState(mStopwatchTimeState); //분 기록 const [sStopwatchTime, setSStopwatchTime] = useRecoilState(sStopwatchTimeState); //초 기록 - const ratateStyle = useMemo(() => { + const rotateStyle = useMemo(() => { return { transform: `rotate(${stringLocation}deg)` }; //원의 위치가 변경될 수 있도록 함 }, [stringLocation]); - function StopwatchAlert() { - //기록하기 알림창 - return ( - <> -
-
-
-
-
{ - setOnModal(false); - }}> -
- 닫기 -
- - - - - - - - -
-
-
-
-
-
- 누적 시간 -
-
- {hStopwatchTime}시간 {mStopwatchTime}분 {sStopwatchTime}초 -
-
- 기록하시겠습니까? -
-
-
-
{ - setStartTime(Date.now()); - setNow(Date.now()); - setOnModal(false); //현재창 닫기 - setIsReset(true); //테스트 - setIsReset(false); //테스트 - }}> -
- 아니요, 괜찮아요 -
-
-
-
{ - setOnAccumulatedModal(true); //모달창 열기 - setOnModal(false); //현재창 닫기 - setStartTime(Date.now()); - setNow(Date.now()); - setIsReset(true); //테스트 - setIsReset(false); //테스트 - }}> - 네, 기록할게요 -
-
-
-
-
-
-
- - ); - } - - function AccumulatedTime() { - //기록 완료 알림창 - return ( - <> -
-
-
-
-
{ - setOnAccumulatedModal(false); //현재창 닫기 - }}> -
- 닫기 -
- - - - - - - - -
-
-
-
-
-
- 전체 누적 시간 -
-
- {hStopwatchTime}시간 {mStopwatchTime}분 {sStopwatchTime}초 -
-
-
- 목표 기간 동안의 누적 시간 -
-
- {hStopwatchTime}시간 {mStopwatchTime}분 {sStopwatchTime}초{' '} -
-
-
-
-
-
- - ); - } - return ( <> {onModal ? ( //기록하기 알림창 열림OnOff - + ) : null} {onAccumulatedModal ? ( //기록완료 알림창OnOff - + ) : null} -
+
+
{/*
*/} -
+
-

+

{/* 스톱워치 시간 */} {/*
01 : 20 : 35
*/} {hStopwatchTime.toString().padStart(2, '0')} : {mStopwatchTime.toString().padStart(2, '0')} :{' '} @@ -205,9 +76,7 @@ export default function StopWatch() { className="w-20 h-20 p-2 bg-gray0 rounded-[999px] justify-center items-center gap-2 inline-flex">
-
- 재설정 -
+
재설정

{timebool ? ( @@ -227,9 +96,7 @@ export default function StopWatch() { /> -
- 시작 -
+
시작
) : (
@@ -245,15 +112,14 @@ export default function StopWatch() {
-
- 일시정지 -
+
일시정지
)}
+ ); } diff --git a/src/components/community/NormalAndTipBoardList.tsx b/src/components/community/NormalAndTipBoardList.tsx index 7bc570b1..519ac074 100644 --- a/src/components/community/NormalAndTipBoardList.tsx +++ b/src/components/community/NormalAndTipBoardList.tsx @@ -125,17 +125,9 @@ const NormalAndTipBoardList = (props: Props) => { title={postResponse.postContent?.title || ''} commentCount={postResponse.postStatus?.commentCount || 0} createdAt={formatDate(postResponse.dateTime?.createdAt || '')} - imageUrl={ - postResponse.postContent?.images?.length - ? postResponse.postContent.images[0].imageUrl - : null - } + imageUrl={postResponse.postContent?.images?.length ? postResponse.postContent.images[0].imageUrl : null} likeCount={postResponse.postStatus?.likeCount || 0} - topElement={ - postResponse.recommendTags - ? tipTopElement(postResponse.postId) - : undefined - } + topElement={postResponse.recommendTags ? tipTopElement(postResponse.postId) : undefined} />
); diff --git a/src/components/mypage/MyPageHeader.tsx b/src/components/mypage/MyPageHeader.tsx index 9dbaf3fa..1dcd0415 100644 --- a/src/components/mypage/MyPageHeader.tsx +++ b/src/components/mypage/MyPageHeader.tsx @@ -34,6 +34,7 @@ const MyPageHeader = () => { src={userProfile?.profileImage || '/person.png'} alt={userProfile?.profileImage || '/person.png'} fill + unoptimized className={'object-cover rounded-full'}>
diff --git a/src/components/stopwatch/AccumulatedTime.tsx b/src/components/stopwatch/AccumulatedTime.tsx new file mode 100644 index 00000000..608314d0 --- /dev/null +++ b/src/components/stopwatch/AccumulatedTime.tsx @@ -0,0 +1,81 @@ +import type { SVGProps } from 'react'; +import React from 'react'; +import { useRecoilState } from 'recoil'; + +import { hStopwatchTimeState, mStopwatchTimeState, sStopwatchTimeState } from '@/recoil/stopwatch/atom'; + +interface Props { + setOnAccumulatedModal: React.Dispatch>; +} + +function AccumulatedTime(props: Props) { + const { setOnAccumulatedModal } = props; + + const [hStopwatchTime, setHStopwatchTime] = useRecoilState(hStopwatchTimeState); //시 기록 + const [mStopwatchTime, setMStopwatchTime] = useRecoilState(mStopwatchTimeState); //분 기록 + const [sStopwatchTime, setSStopwatchTime] = useRecoilState(sStopwatchTimeState); //초 기록 + + //기록 완료 알림창 + return ( + <> +
+
+
+
{ + setOnAccumulatedModal(false); //현재창 닫기 + }}> +
+ 닫기 +
+ +
+
+
+
+
+
전체 누적 시간
+
+ {hStopwatchTime}시간 {mStopwatchTime}분 {sStopwatchTime}초 +
+
+
+ 목표 기간 동안의 누적 시간 +
+
+ {/*TODO: 백엔드 수정되면 변경*/} + {hStopwatchTime}시간 {mStopwatchTime}분 {sStopwatchTime}초{' '} +
+
+
+
+
+
+ + ); +} +export default AccumulatedTime; + +const DeleteIcon = (props: SVGProps) => ( + + + + + + + + +); diff --git a/src/components/stopwatch/StopwatchAlert.tsx b/src/components/stopwatch/StopwatchAlert.tsx new file mode 100644 index 00000000..714d5a08 --- /dev/null +++ b/src/components/stopwatch/StopwatchAlert.tsx @@ -0,0 +1,135 @@ +import React, { type SVGProps } from 'react'; +import { useRecoilState } from 'recoil'; + +import { + hStopwatchTimeState, + isResetState, + mStopwatchTimeState, + nowTimeState, + sStopwatchTimeState, + startTimeState, +} from '@/recoil/stopwatch/atom'; +import { postStudyTimes } from '@/lib/api/stopwatch'; +import { selectedPrepareTimeState } from '@/recoil/home/atom'; + +interface Props { + setOnModal: React.Dispatch>; + setOnAccumulatedModal: React.Dispatch>; +} + +function StopwatchAlert(props: Props) { + const { setOnModal, setOnAccumulatedModal } = props; + const [now, setNow] = useRecoilState(nowTimeState); //현재 시간 + const [startTime, setStartTime] = useRecoilState(startTimeState); //시작 시간 + const [hStopwatchTime, setHStopwatchTime] = useRecoilState(hStopwatchTimeState); //시 기록 + const [mStopwatchTime, setMStopwatchTime] = useRecoilState(mStopwatchTimeState); //분 기록 + const [sStopwatchTime, setSStopwatchTime] = useRecoilState(sStopwatchTimeState); //초 기록 + const [isReset, setIsReset] = useRecoilState(isResetState); //리셋 여부 + const [selectedPrepareTime, setSelectedPrepareTime] = useRecoilState(selectedPrepareTimeState); + + const convertToMilliseconds = (hours: number, minutes: number, seconds: number): number => { + const hoursInMs = hours * 60 * 60 * 1000; // 시를 밀리초로 변환 + const minutesInMs = minutes * 60 * 1000; // 분을 밀리초로 변환 + const secondsInMs = seconds * 1000; // 초를 밀리초로 변환 + + return hoursInMs + minutesInMs + secondsInMs; // 모두 더해서 반환 + }; + + //기록하기 알림창 + return ( + <> +
+
+ {/* 닫기 버튼 */} +
+
{ + setOnModal(false); + }}> +
+ 닫기 +
+ +
+
+ + {/* 모달창 */} +
+
+
+
누적시간
+
+ {hStopwatchTime}시간 {mStopwatchTime}분 {sStopwatchTime}초 +
+
+
+
기록할까요?
+
기록하지 않으면 타이머의 시간이 초기화됩니다.
+
+
+
{ + setStartTime(Date.now()); + setNow(Date.now()); + setOnModal(false); //현재창 닫기 + setIsReset(true); //테스트 + setIsReset(false); //테스트 + }}> +
+ 아니요 +
+
+
+
{ + postStudyTimes( + selectedPrepareTime.goalId, + convertToMilliseconds(hStopwatchTime, mStopwatchTime, sStopwatchTime), + ).then(() => { + setOnAccumulatedModal(true); //모달창 열기 + setOnModal(false); //현재창 닫기 + setStartTime(Date.now()); + setNow(Date.now()); + setIsReset(true); //테스트 + setIsReset(false); //테스트 + }); + }}> + 기록하기 +
+
+
+
+
+
+
+ + ); +} + +export default StopwatchAlert; + +const DeleteIcon = (props: SVGProps) => ( + + + + + + + + +); diff --git a/src/lib/api/stopwatch.ts b/src/lib/api/stopwatch.ts new file mode 100644 index 00000000..5ee3b198 --- /dev/null +++ b/src/lib/api/stopwatch.ts @@ -0,0 +1,20 @@ +import { sendRequest } from '@/lib/axios'; + +export const postStudyTimes = async (goalId: number, studyTime: number) => { + try { + // 액세스 토큰을 헤더에 담아 요청 보내기 + const response = await sendRequest({ + headers: { + 'Access-Token': localStorage.getItem('accessToken'), + }, + method: 'POST', + url: `/api/v2/goals/${goalId}/study-times?studyTime=${studyTime}`, + }); + // 성공적인 응답 처리 + return response.data; + } catch (error: any) { + if (error) { + console.log('error', error); + } + } +}; \ No newline at end of file