From a1068f7e061be0e032e152df6b174e9efda09d55 Mon Sep 17 00:00:00 2001 From: Shim MunSeong Date: Mon, 28 Oct 2024 21:42:22 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B3=B5=EC=9C=A0=20=ED=85=8D=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EA=B3=B5=EC=9C=A0?= =?UTF-8?q?=20=EC=8B=9C=20=EB=AF=B8=EB=A6=AC=EB=B3=B4=EA=B8=B0=20=EB=A7=81?= =?UTF-8?q?=ED=81=AC=EB=A1=9C=20=EC=9D=B4=EB=8F=99=EB=90=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/ShowPreviewPage/index.tsx | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/apps/preview/src/pages/ShowPreviewPage/index.tsx b/apps/preview/src/pages/ShowPreviewPage/index.tsx index 8caa3a1e..baf1e434 100644 --- a/apps/preview/src/pages/ShowPreviewPage/index.tsx +++ b/apps/preview/src/pages/ShowPreviewPage/index.tsx @@ -12,6 +12,27 @@ import BooltiGrayLogo from '../../components/BooltiGrayLogo'; setDefaultOptions({ locale: ko }); +const getDynamicLink = (showId: number) => { + return `https://boolti.page.link/?link=https://preview.boolti.in/show/${showId}&apn=com.nexters.boolti&ibi=com.nexters.boolti&isi=6476589322`; +} + +const getPreviewLink = (showId: number) => { + return `${window.location.origin}/show/${showId}` +} + +const getShareText = (show: { id: number, title: string, date: Date, placeName: string, streetAddress: string, detailAddress: string }) => { + return ` +공연 정보를 공유드려요! + +- 공연명 : ${show.title} +- 일시 : ${format(show.date, 'yyyy.MM.dd (E) HH:mm -', { locale: ko })} +- 장소 : ${show.placeName} / ${show.streetAddress}, ${show.detailAddress} + +공연 상세 정보 ▼ +${getPreviewLink(show.id)} + ` +} + const ShowPreviewPage = () => { const loaderData = useLoaderData() as | [ShowPreviewResponse, ShowCastTeamReadResponse[]] @@ -41,17 +62,15 @@ const ShowPreviewPage = () => { hostPhoneNumber, } = previewData; - const dynamicLink = `https://boolti.page.link/?link=https://preview.boolti.in/show/${id}&apn=com.nexters.boolti&ibi=com.nexters.boolti&isi=6476589322`; - const shareButtonClickHandler = async () => { try { await navigator.share({ title, - text, - url: dynamicLink, + text: getShareText({ id, title, date: new Date(date), placeName, streetAddress, detailAddress }), + url: getPreviewLink(id), }); } catch (error) { - navigator.clipboard.writeText(dynamicLink); + await navigator.clipboard.writeText(getPreviewLink(id)); alert('공연 링크가 복사되었어요'); } @@ -64,7 +83,7 @@ const ShowPreviewPage = () => { - + @@ -82,7 +101,7 @@ const ShowPreviewPage = () => { }; const reservationButtonMobileClickHandler = () => { - window.location.href = dynamicLink; + window.location.href = getDynamicLink(id); }; return (