From 5502bdd1125bce66f0223832ebaa4266063bc0fa Mon Sep 17 00:00:00 2001 From: G-hoon Date: Sun, 29 Sep 2024 16:57:11 +0900 Subject: [PATCH] =?UTF-8?q?[feat/#58]=20API=20import=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 3 +++ src/components/PoseDetector.tsx | 6 ++---- src/components/Posture/PostrueCrew.tsx | 2 +- src/hooks/useDashBoard.ts | 2 +- src/hooks/useGuidePopup.tsx | 9 +++++---- src/hooks/useNotiMutation.ts | 2 +- src/hooks/useNotification.ts | 2 +- src/hooks/usePoseMutation.ts | 2 +- src/pages/AnalysisDashboard.tsx | 2 +- src/store/NotificationStore.ts | 2 +- 10 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index aae0a28..1b917d1 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -2,3 +2,6 @@ export * from "./auth" export * from "./snapshot" export * from "./group" export * from "./report" +export * from "./notification" +export * from "./pose" +export * from "./analysis" diff --git a/src/components/PoseDetector.tsx b/src/components/PoseDetector.tsx index d9e80fe..32be2e7 100644 --- a/src/components/PoseDetector.tsx +++ b/src/components/PoseDetector.tsx @@ -1,6 +1,4 @@ -import { position } from "@/api" -import { duration } from "@/api/notification" -import { poseType } from "@/api/pose" +import { position, duration, poseType } from "@/api" import { useCameraPermission } from "@/hooks/useCameraPermission" import { useGuidePopup } from "@/hooks/useGuidePopup" import { useModals } from "@/hooks/useModals" @@ -59,7 +57,7 @@ const PoseDetector: React.FC = () => { const { isSnapShotSaved, snapshot, setSnapShot, isInitialSnapShotExist } = useSnapShotStore() const createSnapMutation = useCreateSnaphot() const sendPoseMutation = useSendPose() - const { isPopupOpen, handleClosePopup } = useGuidePopup() + const { isPopupOpen, handleClosePopup } = useGuidePopup(isClosedInitialGuidePopup) // const userNoti = useNotificationStore((state) => state.notification) const { notification } = useNotification() diff --git a/src/components/Posture/PostrueCrew.tsx b/src/components/Posture/PostrueCrew.tsx index 29253e5..62e977f 100644 --- a/src/components/Posture/PostrueCrew.tsx +++ b/src/components/Posture/PostrueCrew.tsx @@ -1,4 +1,4 @@ -import { duration, notification } from "@/api/notification" +import { duration, notification } from "@/api" import EmptyGroupImage from "@/assets/images/crew-empty.png" import RoutePath from "@/constants/routes.json" import { useModals } from "@/hooks/useModals" diff --git a/src/hooks/useDashBoard.ts b/src/hooks/useDashBoard.ts index 6aae3b7..025d878 100644 --- a/src/hooks/useDashBoard.ts +++ b/src/hooks/useDashBoard.ts @@ -1,4 +1,4 @@ -import { getTodayPoseAnalysis, getTotalPoseAnalysis } from "@/api/analysis" +import { getTodayPoseAnalysis, getTotalPoseAnalysis } from "@/api" import { useQueries } from "@tanstack/react-query" import dayjs from "dayjs" import { DateValueType } from "react-tailwindcss-datepicker" diff --git a/src/hooks/useGuidePopup.tsx b/src/hooks/useGuidePopup.tsx index 0785ee7..e208b2f 100644 --- a/src/hooks/useGuidePopup.tsx +++ b/src/hooks/useGuidePopup.tsx @@ -1,7 +1,7 @@ import { useGuidePopupStore } from "@/store/GuidePopupStore" import { useEffect } from "react" -export const useGuidePopup = () => { +export const useGuidePopup = (isClosedInitialGuidePopup: boolean = false) => { const { isPopupOpen, lastClosedDate, openPopup, closePopup, setLastClosedDate } = useGuidePopupStore() useEffect(() => { @@ -11,9 +11,10 @@ export const useGuidePopup = () => { openPopup() } } - - checkPopupDate() - }, [lastClosedDate, openPopup]) + if (!isClosedInitialGuidePopup) { + checkPopupDate() + } + }, [lastClosedDate, openPopup, isClosedInitialGuidePopup]) const handleClosePopup = () => { closePopup() diff --git a/src/hooks/useNotiMutation.ts b/src/hooks/useNotiMutation.ts index 820e017..3530522 100644 --- a/src/hooks/useNotiMutation.ts +++ b/src/hooks/useNotiMutation.ts @@ -1,4 +1,4 @@ -import { getNotification, registerNotification, notification } from "@/api/notification" +import { getNotification, registerNotification, notification } from "@/api" import { useMutation, UseMutationResult, useQuery, UseQueryResult } from "@tanstack/react-query" export const useGetNoti = (): UseQueryResult<{ data: notification }, Error> => { diff --git a/src/hooks/useNotification.ts b/src/hooks/useNotification.ts index 2eed7a6..c5af645 100644 --- a/src/hooks/useNotification.ts +++ b/src/hooks/useNotification.ts @@ -1,4 +1,4 @@ -import { getNotification } from "@/api/notification" +import { getNotification } from "@/api" import { useNotificationStore } from "@/store/NotificationStore" import { useEffect, useState } from "react" diff --git a/src/hooks/usePoseMutation.ts b/src/hooks/usePoseMutation.ts index 67ae954..7fff42e 100644 --- a/src/hooks/usePoseMutation.ts +++ b/src/hooks/usePoseMutation.ts @@ -1,4 +1,4 @@ -import { poseReq, poseRes, sendPose } from "@/api/pose" +import { poseReq, poseRes, sendPose } from "@/api" import { useMutation, UseMutationResult } from "@tanstack/react-query" export const useSendPose = (): UseMutationResult => { diff --git a/src/pages/AnalysisDashboard.tsx b/src/pages/AnalysisDashboard.tsx index 5383022..0dbbf41 100644 --- a/src/pages/AnalysisDashboard.tsx +++ b/src/pages/AnalysisDashboard.tsx @@ -1,4 +1,4 @@ -import { poseType } from "@/api/pose" +import { poseType } from "@/api" import { usePoseAnalysis } from "@/hooks/useDashBoard" import { ChevronLeft, ChevronRight } from "lucide-react" import { useEffect, useRef, useState } from "react" diff --git a/src/store/NotificationStore.ts b/src/store/NotificationStore.ts index aedb780..94b56d1 100644 --- a/src/store/NotificationStore.ts +++ b/src/store/NotificationStore.ts @@ -1,4 +1,4 @@ -import { notification } from "@/api/notification" +import { notification } from "@/api" import { create } from "zustand" interface NotificationState {