fix: 공통으로 공유하기 사용하도록 변경
This commit is contained in:
1 parent
3566c1f7bc
commit
e400884eb7
7 files changed
+6
-30
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
@@ -8,7 +8,6 @@ interface ContentCardSocialActionsProps {
|
|||||||
videoId: number;
|
videoId: number;
|
||||||
storeName: string;
|
storeName: string;
|
||||||
region?: string;
|
region?: string;
|
||||||
posterUrl?: string | null;
|
|
||||||
commentCount: number;
|
commentCount: number;
|
||||||
initialLikeCount: number;
|
initialLikeCount: number;
|
||||||
initialIsLiked?: boolean;
|
initialIsLiked?: boolean;
|
||||||
@@ -18,7 +17,6 @@ const ContentCardSocialActions: React.FC<ContentCardSocialActionsProps> = ({
|
|||||||
videoId,
|
videoId,
|
||||||
storeName,
|
storeName,
|
||||||
region,
|
region,
|
||||||
posterUrl,
|
|
||||||
commentCount,
|
commentCount,
|
||||||
initialLikeCount,
|
initialLikeCount,
|
||||||
initialIsLiked = false,
|
initialIsLiked = false,
|
||||||
@@ -36,11 +34,9 @@ const ContentCardSocialActions: React.FC<ContentCardSocialActionsProps> = ({
|
|||||||
const shareMenuRef = useRef<HTMLDivElement>(null);
|
const shareMenuRef = useRef<HTMLDivElement>(null);
|
||||||
const likeDebounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
const likeDebounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||||
|
|
||||||
const videoPageUrl = `${window.location.origin}/video/${videoId}`;
|
|
||||||
const shareUrl = buildVideoShareUrl(API_URL, videoId);
|
const shareUrl = buildVideoShareUrl(API_URL, videoId);
|
||||||
const shareTitle = storeName || t('videoDetail.kakaoDefaultTitle');
|
const shareTitle = storeName || t('videoDetail.kakaoDefaultTitle');
|
||||||
const shareDescription = t('videoDetail.kakaoDescription', { region: region ?? '' });
|
const shareDescription = t('videoDetail.kakaoDescription', { region: region ?? '' });
|
||||||
const shareImageUrl = posterUrl || `${window.location.origin}/assets/images/hero-background.png`;
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!shareMenuOpen) return;
|
if (!shareMenuOpen) return;
|
||||||
@@ -100,16 +96,9 @@ const ContentCardSocialActions: React.FC<ContentCardSocialActionsProps> = ({
|
|||||||
const handleKakaoShare = () => {
|
const handleKakaoShare = () => {
|
||||||
const kakao = window.Kakao;
|
const kakao = window.Kakao;
|
||||||
if (kakao?.Share) {
|
if (kakao?.Share) {
|
||||||
kakao.Share.sendDefault({
|
// 공유 URL(백엔드 OG 페이지)을 스크랩해 제목/설명/이미지를 자동으로 채운다.
|
||||||
objectType: 'feed',
|
// 다른 채널과 동일한 shareUrl을 쓰므로 카카오만을 위한 별도 콘텐츠 지정이 필요 없다.
|
||||||
content: {
|
kakao.Share.sendScrap({ requestUrl: shareUrl });
|
||||||
title: shareTitle,
|
|
||||||
description: shareDescription,
|
|
||||||
imageUrl: shareImageUrl,
|
|
||||||
link: { mobileWebUrl: videoPageUrl, webUrl: videoPageUrl },
|
|
||||||
},
|
|
||||||
buttons: [{ title: t('videoDetail.kakaoButtonTitle'), link: { mobileWebUrl: videoPageUrl, webUrl: videoPageUrl } }],
|
|
||||||
});
|
|
||||||
} else if (navigator.share) {
|
} else if (navigator.share) {
|
||||||
navigator.share({ title: shareTitle, text: shareDescription, url: shareUrl }).catch(() => {});
|
navigator.share({ title: shareTitle, text: shareDescription, url: shareUrl }).catch(() => {});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -103,11 +103,9 @@ const VideoDetailContent: React.FC<VideoDetailContentProps> = ({ videoId, isModa
|
|||||||
return `${date.getFullYear()}.${String(date.getMonth() + 1).padStart(2, '0')}.${String(date.getDate()).padStart(2, '0')}`;
|
return `${date.getFullYear()}.${String(date.getMonth() + 1).padStart(2, '0')}.${String(date.getDate()).padStart(2, '0')}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const videoPageUrl = `${window.location.origin}/video/${videoId}`;
|
|
||||||
const shareUrl = buildVideoShareUrl(API_URL, videoId);
|
const shareUrl = buildVideoShareUrl(API_URL, videoId);
|
||||||
const shareTitle = video?.store_name ?? t('videoDetail.kakaoDefaultTitle');
|
const shareTitle = video?.store_name ?? t('videoDetail.kakaoDefaultTitle');
|
||||||
const shareDescription = t('videoDetail.kakaoDescription', { region: video?.region ?? '' });
|
const shareDescription = t('videoDetail.kakaoDescription', { region: video?.region ?? '' });
|
||||||
const shareImageUrl = video?.poster_url || `${window.location.origin}/assets/images/hero-background.png`;
|
|
||||||
|
|
||||||
const handleCopyLink = async () => {
|
const handleCopyLink = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -122,16 +120,9 @@ const VideoDetailContent: React.FC<VideoDetailContentProps> = ({ videoId, isModa
|
|||||||
const handleKakaoShare = () => {
|
const handleKakaoShare = () => {
|
||||||
const kakao = window.Kakao;
|
const kakao = window.Kakao;
|
||||||
if (kakao?.Share) {
|
if (kakao?.Share) {
|
||||||
kakao.Share.sendDefault({
|
// 공유 URL(백엔드 OG 페이지)을 스크랩해 제목/설명/이미지를 자동으로 채운다.
|
||||||
objectType: 'feed',
|
// 다른 채널과 동일한 shareUrl을 쓰므로 카카오만을 위한 별도 콘텐츠 지정이 필요 없다.
|
||||||
content: {
|
kakao.Share.sendScrap({ requestUrl: shareUrl });
|
||||||
title: shareTitle,
|
|
||||||
description: shareDescription,
|
|
||||||
imageUrl: shareImageUrl,
|
|
||||||
link: { mobileWebUrl: videoPageUrl, webUrl: videoPageUrl },
|
|
||||||
},
|
|
||||||
buttons: [{ title: t('videoDetail.kakaoButtonTitle'), link: { mobileWebUrl: videoPageUrl, webUrl: videoPageUrl } }],
|
|
||||||
});
|
|
||||||
} else if (navigator.share) {
|
} else if (navigator.share) {
|
||||||
navigator.share({ title: shareTitle, text: shareDescription, url: shareUrl }).catch(() => {});
|
navigator.share({ title: shareTitle, text: shareDescription, url: shareUrl }).catch(() => {});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -620,7 +620,6 @@
|
|||||||
"dateFormat": "{{month}}/{{day}}/{{year}}",
|
"dateFormat": "{{month}}/{{day}}/{{year}}",
|
||||||
"kakaoDefaultTitle": "ADO2 Video",
|
"kakaoDefaultTitle": "ADO2 Video",
|
||||||
"kakaoDescription": "{{region}} · ADO2 AI Marketing Video",
|
"kakaoDescription": "{{region}} · ADO2 AI Marketing Video",
|
||||||
"kakaoButtonTitle": "Watch Video",
|
|
||||||
"deletedComment": "(This comment has been deleted.)",
|
"deletedComment": "(This comment has been deleted.)",
|
||||||
"closeAriaLabel": "Close",
|
"closeAriaLabel": "Close",
|
||||||
"share": "Share",
|
"share": "Share",
|
||||||
|
|||||||
@@ -619,7 +619,6 @@
|
|||||||
"dateFormat": "{{year}}년 {{month}}월 {{day}}일",
|
"dateFormat": "{{year}}년 {{month}}월 {{day}}일",
|
||||||
"kakaoDefaultTitle": "ADO2 영상",
|
"kakaoDefaultTitle": "ADO2 영상",
|
||||||
"kakaoDescription": "{{region}} · ADO2 AI 마케팅 영상",
|
"kakaoDescription": "{{region}} · ADO2 AI 마케팅 영상",
|
||||||
"kakaoButtonTitle": "영상 보기",
|
|
||||||
"deletedComment": "(삭제된 댓글입니다.)",
|
"deletedComment": "(삭제된 댓글입니다.)",
|
||||||
"closeAriaLabel": "닫기",
|
"closeAriaLabel": "닫기",
|
||||||
"share": "공유하기",
|
"share": "공유하기",
|
||||||
|
|||||||
@@ -194,7 +194,6 @@ const ADO2ContentsPage: React.FC<ADO2ContentsPageProps> = () => {
|
|||||||
videoId={video.video_id}
|
videoId={video.video_id}
|
||||||
storeName={video.store_name}
|
storeName={video.store_name}
|
||||||
region={video.region}
|
region={video.region}
|
||||||
posterUrl={video.poster_url}
|
|
||||||
commentCount={video.comment_count ?? 0}
|
commentCount={video.comment_count ?? 0}
|
||||||
initialLikeCount={video.like_count ?? 0}
|
initialLikeCount={video.like_count ?? 0}
|
||||||
initialIsLiked={video.is_liked_by_me}
|
initialIsLiked={video.is_liked_by_me}
|
||||||
|
|||||||
@@ -291,7 +291,6 @@ const MyContentsPage: React.FC<MyContentsPageProps> = ({ onNavigate }) => {
|
|||||||
videoId={video.video_id}
|
videoId={video.video_id}
|
||||||
storeName={video.store_name}
|
storeName={video.store_name}
|
||||||
region={video.region}
|
region={video.region}
|
||||||
posterUrl={video.poster_url}
|
|
||||||
commentCount={video.comment_count ?? 0}
|
commentCount={video.comment_count ?? 0}
|
||||||
initialLikeCount={video.like_count ?? 0}
|
initialLikeCount={video.like_count ?? 0}
|
||||||
initialIsLiked={video.is_liked_by_me}
|
initialIsLiked={video.is_liked_by_me}
|
||||||
|
|||||||
Reference in new issue
Block a user