From 32cec6bc28e322b324c7c60689826911760542ff Mon Sep 17 00:00:00 2001 From: haeni82 <2021111929@dgu.ac.kr> Date: Mon, 23 Mar 2026 16:17:26 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EC=95=B1=EC=84=9C=EB=B9=84=EC=8A=A4?= =?UTF-8?q?=EB=B3=84=20=EC=82=AC=EC=9A=A9=EB=9F=89=20=ED=86=A0=EA=B8=80=20?= =?UTF-8?q?=EB=B0=8F=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/services/familyService.ts | 1 + src/page/Detail/DetailPage.tsx | 22 +++++++------------- src/page/Detail/components/AppUsageChart.tsx | 6 +++++- src/page/Main/MainPage.tsx | 8 +++---- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/api/services/familyService.ts b/src/api/services/familyService.ts index 667dbe3..4a09375 100644 --- a/src/api/services/familyService.ts +++ b/src/api/services/familyService.ts @@ -8,6 +8,7 @@ interface Permission { permissionId: number; permissionTitle: string; createdAt: string; + is_enable: boolean; } interface MemberPermissionsResponse { diff --git a/src/page/Detail/DetailPage.tsx b/src/page/Detail/DetailPage.tsx index 45f29e6..aae1db9 100644 --- a/src/page/Detail/DetailPage.tsx +++ b/src/page/Detail/DetailPage.tsx @@ -112,7 +112,8 @@ export default function Detail() { try { const { data } = await familyService.getMyPermissions(); const hasPerm = data.memberPermissions.some( - (p) => p.permissionTitle === "앱 사용량 비공개 허용 권한", + (p) => + p.permissionTitle === "앱 사용량 비공개 허용 권한" && p.is_enable, ); setHasPrivacyPermission(hasPerm); if (!hasPerm) setGlobalIsPublic(true); @@ -160,23 +161,13 @@ export default function Detail() { const parsed = parseAppUsageResponse(appRes, fallback); if (parsed) { - // 본인 + 권한 없으면 isPublic 강제 true - if (isOwnData && !hasPrivacyPermission) { - parsed.data.isPublic = true; - } - // 다른 사람 데이터: API의 isPublic 그대로 사용 - // isPublic: false → 비공개 자물쇠 UI 표시 setAppUsage(parsed.data); - if (isOwnData && !hasPrivacyPermission) { - setGlobalIsPublic(true); - } else if (parsed.updatedIsPublic != null) { + // API의 isPublic 값 그대로 반영 (본인/타인 모두 동일) + if (parsed.updatedIsPublic != null) { setGlobalIsPublic(parsed.updatedIsPublic); - } else if (loading) { - setGlobalIsPublic(true); } } else { setAppUsage(emptyAppUsage(fallback)); - if (loading) setGlobalIsPublic(true); } } catch { setAppUsage(emptyAppUsage(globalIsPublic)); @@ -205,7 +196,7 @@ export default function Detail() { } catch { // polling 실패는 무시 } - }, 1000); + }, 10000); return () => clearInterval(interval); // eslint-disable-next-line react-hooks/exhaustive-deps @@ -381,7 +372,8 @@ export default function Detail() { isPublic={appUsage.isPublic} onPublicToggle={handleVisibilityToggle} disableToggle={!hasPrivacyPermission} - showToggle={isOwnData} + showToggle={isOwnData && hasPrivacyPermission} + isOwnData={isOwnData} /> diff --git a/src/page/Detail/components/AppUsageChart.tsx b/src/page/Detail/components/AppUsageChart.tsx index 9fce1f5..772b035 100644 --- a/src/page/Detail/components/AppUsageChart.tsx +++ b/src/page/Detail/components/AppUsageChart.tsx @@ -15,6 +15,7 @@ interface AppUsageChartProps { onPublicToggle: (value: boolean) => void; disableToggle?: boolean; showToggle?: boolean; + isOwnData?: boolean; } const appNameMap: Record = { @@ -56,6 +57,7 @@ export default function AppUsageChart({ onPublicToggle, disableToggle = false, showToggle = true, + isOwnData = false, }: AppUsageChartProps) { const [hoveredIndex, setHoveredIndex] = useState(null); const [animated, setAnimated] = useState(false); @@ -63,6 +65,8 @@ export default function AppUsageChart({ // apps가 null이거나 undefined일 경우 빈 배열로 처리 const safeApps = apps || []; + // 본인이면 isPublic=false여도 데이터 보여주기 + const shouldShowData = isOwnData || isPublic; // 10개 초과 시 상위 10개 + 나머지를 "기타"로 묶기 const MAX_DISPLAY = 7; @@ -133,7 +137,7 @@ export default function AppUsageChart({
- {!isPublic ? ( + {!shouldShowData ? (
({ queryKey: ["familyMembers"], queryFn: () => familyService.getMembers().then((res) => res.data), - refetchInterval: 1000, + refetchInterval: 10000, refetchIntervalInBackground: true, placeholderData: keepPreviousData, // ← v5 방식 }); @@ -42,7 +42,7 @@ export default function Main() { const { data: usageData } = useQuery({ queryKey: ["UsageData"], queryFn: () => sharedPoolService.getUsageData().then((res) => res.data), - refetchInterval: 1000, // 10초마다 자동 폴링 + refetchInterval: 10000, // 10초마다 자동 폴링 refetchIntervalInBackground: true, // 백그라운드에서도 폴링 placeholderData: keepPreviousData, }); @@ -97,7 +97,7 @@ export default function Main() { useQuery({ queryKey: ["sharedPool"], queryFn: () => sharedPoolService.getMainRemainingAmount(), - refetchInterval: 1000, // 10초마다 자동 폴링 + refetchInterval: 10000, // 10초마다 자동 폴링 refetchIntervalInBackground: true, // 백그라운드에서도 폴링 placeholderData: keepPreviousData, }); @@ -109,7 +109,7 @@ export default function Main() { queryKey: ["blockStatus", lineId], queryFn: () => blockService.getBlockStatus(lineId!).then((res) => res.data), enabled: !!lineId, - refetchInterval: 1000, // 10초마다 자동 폴링 + refetchInterval: 10000, // 10초마다 자동 폴링 refetchIntervalInBackground: true, // 백그라운드에서도 폴링 placeholderData: keepPreviousData, }); From 51ad9b001bc03cc17906e43ad5342023b06c73fa Mon Sep 17 00:00:00 2001 From: haeni82 <2021111929@dgu.ac.kr> Date: Mon, 23 Mar 2026 16:29:08 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20header=20=EB=86=92=EC=9D=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EA=B6=8C=ED=95=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EC=8B=9C=20=EC=A0=84=ED=99=94=EB=B2=88=ED=98=B8=20?= =?UTF-8?q?=EB=92=B7=EC=9E=90=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header.tsx | 8 +++--- src/page/Policy/components/Permisssion.tsx | 33 ++++++++++++++++++++-- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 9e300f1..79b89f7 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -118,18 +118,18 @@ export default function Header({ className={`h-16 ${darkMode ? "invert" : ""}`} /> ) : ( -

+

{getPageTitle()}

)}
-
+
{showAlarmIcon && (