diff --git a/components/modal/shareModal.tsx b/components/modal/shareModal.tsx
index 369cf53..fb6cd44 100644
--- a/components/modal/shareModal.tsx
+++ b/components/modal/shareModal.tsx
@@ -19,7 +19,10 @@ interface ShareModalProps {
}
export default function ShareModal({ isOpen, onClose, meetingId }: ShareModalProps) {
- const { shareUrl, isError, isLoading, handleCopyLink, isVisible } = useShareMeeting(meetingId);
+ const { shareUrl, isError, isLoading, handleCopyLink, isVisible } = useShareMeeting(
+ meetingId,
+ 'share'
+ );
const displayValue = isError
? '유효하지 않은 모임입니다.'
@@ -35,27 +38,25 @@ export default function ShareModal({ isOpen, onClose, meetingId }: ShareModalPro
>
{/* 헤더 영역 */}
-
+
모임 링크를 공유해주세요
현재 모임의 참여 링크를 복사하거나 친구들에게 공유하여 초대할 수 있습니다.
-
- {/* 이미지 영역 */}
-
+
-
- {/* 주소창 복사 영역 */}
-
+
diff --git a/components/share/shareContent.tsx b/components/share/shareContent.tsx
new file mode 100644
index 0000000..417d5c9
--- /dev/null
+++ b/components/share/shareContent.tsx
@@ -0,0 +1,62 @@
+'use client';
+
+import { notFound } from 'next/navigation';
+import Link from 'next/link';
+import Toast from '@/components/ui/toast';
+import { useShareMeeting } from '@/hooks/api/query/useShareMeeting';
+import Image from 'next/image';
+
+interface ShareContentProps {
+ id: string;
+}
+
+export default function ShareContent({ id }: ShareContentProps) {
+ // useParams() 대신 부모(Page)에서 전달받은 id 사용
+ const { shareUrl, isError, isLoading, handleCopyLink, isVisible } = useShareMeeting(id);
+
+ if (isError) notFound();
+ if (isLoading) return null;
+
+ return (
+
+
+ 모임이 만들어졌어요!
+
+ 링크를 공유해주세요
+
+
+
+
+
+
+
+
+
+
+
+ 내 출발지 등록하기
+
+
+ );
+}
diff --git a/hooks/api/query/useShareMeeting.ts b/hooks/api/query/useShareMeeting.ts
index e4adb6e..2ef537d 100644
--- a/hooks/api/query/useShareMeeting.ts
+++ b/hooks/api/query/useShareMeeting.ts
@@ -11,23 +11,25 @@ const fetchMeetingResult = async (id: string) => {
return apiGet
(`/api/meeting/result/${id}`);
};
-// (URL origin은 변하지 않으므로 구독 함수는 빈 함수가 된다.)
+// URL Origin 구독 함수 (변하지 않으므로 빈 함수)
const emptySubscribe = () => () => {};
-// 브라우저에서 실행될 함수 (브라우저 URL을 가져오는 함수)
const getClientSnapshot = () => window.location.origin;
-// 서버에서 실행될 함수 (서버에는 window가 없기에 빈 값 반환)
const getServerSnapshot = () => '';
-export const useShareMeeting = (meetingId: string) => {
+// [수정] mode 파라미터 추가 (기본값: 'share')
+export const useShareMeeting = (meetingId: string, mode: 'share' | 'nudge' = 'share') => {
const { show, isVisible } = useToast();
- // useSyncExternalStore hooks를 통해 window.location.origin을 안전하게 가져오기
+ // 1. Base Origin 가져오기
const origin = useSyncExternalStore(emptySubscribe, getClientSnapshot, getServerSnapshot);
- // URL 계산 (origin이 있을 때만 합침)
- const shareUrl = origin ? `${origin}/join/${meetingId}` : '';
+ // 2. 쿼리스트링 결정 로직
+ const queryString = mode === 'nudge' ? '?view=nudge' : '?view=share';
- // 모임 존재 여부 확인 (Query)
+ // 3. 최종 URL 조합 (화면에 보여줄 용도)
+ const shareUrl = origin ? `${origin}/join/${meetingId}${queryString}` : '';
+
+ // 4. 모임 존재 여부 확인 (Query)
const { isError, isLoading, error } = useQuery({
queryKey: ['meeting', 'exist', meetingId],
queryFn: () => fetchMeetingResult(meetingId),
@@ -35,14 +37,15 @@ export const useShareMeeting = (meetingId: string) => {
retry: false,
});
+ // 5. 링크 복사 핸들러
const handleCopyLink = async () => {
if (!shareUrl) return;
try {
await navigator.clipboard.writeText(shareUrl);
show();
} catch (err) {
- console.error(err);
- alert('복사 실패');
+ console.error('링크 복사 실패:', err);
+ alert('링크 복사에 실패했습니다.');
}
};
diff --git a/public/images/nudge_modal.jpg b/public/images/nudge_modal.jpg
index cbc6807..2ace063 100644
Binary files a/public/images/nudge_modal.jpg and b/public/images/nudge_modal.jpg differ
diff --git a/public/images/og-image/create_meeting_card.jpg b/public/images/og-image/create_meeting_card.jpg
new file mode 100644
index 0000000..c05fa7c
Binary files /dev/null and b/public/images/og-image/create_meeting_card.jpg differ
diff --git a/public/images/og-image/nudge_meeting_card.jpg b/public/images/og-image/nudge_meeting_card.jpg
new file mode 100644
index 0000000..58fd038
Binary files /dev/null and b/public/images/og-image/nudge_meeting_card.jpg differ
diff --git a/public/images/og-image/share_meeting_card.jpg b/public/images/og-image/share_meeting_card.jpg
new file mode 100644
index 0000000..69d60ff
Binary files /dev/null and b/public/images/og-image/share_meeting_card.jpg differ
diff --git a/public/images/waiting_modal.jpg b/public/images/share_modal.jpg
similarity index 100%
rename from public/images/waiting_modal.jpg
rename to public/images/share_modal.jpg