Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"Bash(pnpm check:web:*)",
"Bash(pnpm run check:web:*)",
"Bash(pnpm -w run check:web:*)",
"Bash(node:*)"
"Bash(node:*)",
"Bash(python3:*)"
],
"deny": [],
"ask": []
Expand Down
3 changes: 2 additions & 1 deletion app/apis/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useDeviceLocation, useDeviceSystem } from "@/hooks";
import { useDeviceLocation, useDeviceSystem, useHapticFeedback } from "@/hooks";
import type { BridgeMessage, BridgeQuery } from "@bridge";
import { RefObject } from "react";
import { WebView } from "react-native-webview";
Expand All @@ -11,6 +11,7 @@ export const useApis = (webviewRef: RefObject<WebView | null>) => {
const APIS = {
...useDeviceSystem(onResponse),
...useDeviceLocation(onResponse),
...useHapticFeedback(onResponse),
};

const onRequest = (query: BridgeQuery) => {
Expand Down
2 changes: 1 addition & 1 deletion app/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function RootLayout() {
return (
<View style={{ flex: 1 }}>
<WebViewScreen />
<StatusBar style="auto" />
<StatusBar style="dark" />
</View>
);
}
15 changes: 11 additions & 4 deletions app/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ import { SafeAreaView } from "react-native-safe-area-context";
import { WebView } from "react-native-webview";

export default function WebViewScreen() {
const [isConnected, setIsConnected] = useState(false);
const [isConnected, setIsConnected] = useState(true);
const webViewRef = useRef<WebView>(null);
const { onRequest } = useApis(webViewRef);

// 인터넷 μƒνƒœ 확인
useEffect(() => {
NetInfo.addEventListener((status) => {
const unsubscribe = NetInfo.addEventListener((status) => {
setIsConnected(status.isConnected ?? false);
});

return () => unsubscribe();
}, []);

if (!isConnected)
Expand All @@ -25,17 +27,22 @@ export default function WebViewScreen() {
);

return (
<SafeAreaView style={styles.container}>
<WebView
ref={webViewRef}
// 개발 ν™˜κ²½: 둜컬 IP μ‚¬μš© (Expo Goμ—μ„œ localhost μ ‘κ·Ό λΆˆκ°€)
// ν”„λ‘œλ•μ…˜: https://bobtory.com
source={{ uri: "https://bobtory.com" }}
// source={{ uri: "http://localhost:3000" }}
onMessage={(event) => {
if (!event.nativeEvent.data) return;
const request = JSON.parse(event.nativeEvent.data);
onRequest(request.query);
}}
// iOS μŠ€μ™€μ΄ν”„ λ°± 제슀처 ν™œμ„±ν™”
allowsBackForwardNavigationGestures={true}
// iOSμ—μ„œ λ°”μš΄μŠ€ 효과 λΉ„ν™œμ„±ν™” (선택사항)
bounces={false}
/>
</SafeAreaView>
);
}

Expand Down
1 change: 1 addition & 0 deletions app/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from "./useDeviceLocation";
export * from "./useDeviceSystem";
export * from "./useHapticFeedback";
30 changes: 30 additions & 0 deletions app/hooks/useHapticFeedback.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as Haptics from "expo-haptics";
import type { BridgeMessage, BridgeQuery } from "@bridge";

export const useHapticFeedback = (
onResponse: <T extends BridgeQuery>(result: BridgeMessage<T>) => void
) => {
const triggerHapticFeedback = async () => {
try {
// iOS와 Android λͺ¨λ‘ μ§€μ›ν•˜λŠ” κ²½λŸ‰ ν–…ν‹± ν”Όλ“œλ°±
await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);

onResponse({
triggerHapticFeedback: {
success: true,
},
});
} catch (error) {
console.error("Haptic feedback error:", error);
onResponse({
triggerHapticFeedback: {
success: false,
},
});
}
};

return {
triggerHapticFeedback,
};
};
1 change: 1 addition & 0 deletions shared/bridge/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const BRIDGE_QUERIES = {
DEVICE_SYSTEM_APP: 'fetchDeviceSystemForAppSet',
DEVICE_SYSTEM_PLATFORM: 'fetchDeviceSystemForPlatformSet',
DEVICE_LOCATION: 'fetchDeviceLocationForLatLngSet',
HAPTIC_FEEDBACK: 'triggerHapticFeedback',
} as const satisfies Record<string, BridgeQuery>;

/**
Expand Down
5 changes: 5 additions & 0 deletions shared/bridge/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export interface DeviceLocationLatLngSetResponse {
lng: number;
}

export interface DeviceHapticFeedbackResponse {
success: boolean;
}

// ============================================
// Bridge Schema
// ============================================
Expand All @@ -35,6 +39,7 @@ export interface BridgeSchema {
fetchDeviceSystemForAppSet: DeviceSystemAppSetResponse;
fetchDeviceSystemForPlatformSet: DeviceSystemPlatformSetResponse;
fetchDeviceLocationForLatLngSet: DeviceLocationLatLngSetResponse;
triggerHapticFeedback: DeviceHapticFeedbackResponse;
}

// ============================================
Expand Down
22 changes: 17 additions & 5 deletions web/src/app/(main)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { MAIN_HEADER_HEIGHT } from "@/shared/config";
import { FloatingNavButton } from "@/shared/ui";
"use client";

import { usePathname } from "next/navigation";
import { BOTTOM_NAV_HEIGHT, MAIN_HEADER_HEIGHT } from "@/shared/config";
import { BottomNavigation } from "@/shared/ui";
import MainHeader from "@/shared/ui/MainHeader";

export default function MainLayout({ children }: { children: React.ReactNode }) {
const pathname = usePathname();
const isHeaderVisible = pathname.startsWith("/home") || pathname.startsWith("/map");
return (
<div style={{ paddingTop: `${MAIN_HEADER_HEIGHT}px` }}>
<FloatingNavButton />
<MainHeader />
<div
style={{
paddingTop: isHeaderVisible
? `calc(${MAIN_HEADER_HEIGHT}px + env(safe-area-inset-top))`
: "env(safe-area-inset-top)",
paddingBottom: `calc(${BOTTOM_NAV_HEIGHT}px + env(safe-area-inset-bottom))`,
}}
>
{isHeaderVisible && <MainHeader />}
{children}
<BottomNavigation />
</div>
);
}
3 changes: 3 additions & 0 deletions web/src/app/(main)/report/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function ReportPage() {
return <div>식당 μ œν•˜</div>;
}
12 changes: 11 additions & 1 deletion web/src/app/(stack)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
export default function StackLayout({ children }: { children: React.ReactNode }) {
// ν—€λ”λŠ” 이제 TransitionLayoutμ—μ„œ 처리
return <div className="overflow-x-hidden">{children}</div>;
return (
<div
className="overflow-x-hidden"
style={{
paddingTop: "env(safe-area-inset-top)",
paddingBottom: "env(safe-area-inset-bottom)",
}}
>
{children}
</div>
);
}
42 changes: 0 additions & 42 deletions web/src/app/(stack)/mypage/tester/page.tsx

This file was deleted.

8 changes: 8 additions & 0 deletions web/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
@import "tailwindcss";

/* iPhone Safe Area 지원 */
:root {
--safe-area-inset-top: env(safe-area-inset-top, 0px);
--safe-area-inset-right: env(safe-area-inset-right, 0px);
--safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
--safe-area-inset-left: env(safe-area-inset-left, 0px);
}

/* Ssgoi drill μ• λ‹ˆλ©”μ΄μ…˜ μ΅œμ ν™” */
html,
body {
Expand Down
2 changes: 1 addition & 1 deletion web/src/entities/user/model/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const MY_PAGE_NAVIGATION: { label: string; icon: IconName; href: string }
{
label: "식당 μ œλ³΄ν•˜κΈ°",
icon: "colorSpeaker",
href: "/mypage/report",
href: "/report",
},
{
label: "λ‚΄ λ°©λ¬Έ ν›„κΈ° 보기",
Expand Down
1 change: 1 addition & 0 deletions web/src/shared/config/offsetInfo.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const MAIN_HEADER_HEIGHT = 60;
export const BOTTOM_NAV_HEIGHT = 64;
16 changes: 7 additions & 9 deletions web/src/shared/config/routeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ export const ROUTE_CONFIG: Record<string, RouteConfig> = {

// μŠ€νƒ κ·Έλ£Ή - λ“œλ¦΄ λ„€λΉ„κ²Œμ΄μ…˜
"/mypage": {
group: "stack",
transition: "drill",
header: {
title: "λ§ˆμ΄νŽ˜μ΄μ§€",
},
group: "main",
transition: "fade",
header: null,
},
"/mypage/nickname": {
group: "stack",
Expand All @@ -75,17 +73,17 @@ export const ROUTE_CONFIG: Record<string, RouteConfig> = {
},
},
"/mypage/*": {
group: "stack",
transition: "drill",
group: "main",
transition: "fade",
header: {
title: "λ§ˆμ΄νŽ˜μ΄μ§€ 상세",
},
},
"/mypage/tester": {
"/mypage/reviews": {
group: "stack",
transition: "drill",
header: {
title: "ν…ŒμŠ€ν„° νŽ˜μ΄μ§€",
title: "λ°©λ¬Έ ν›„κΈ°",
},
},
"/item": {
Expand Down
Loading