From ee718439fb3cfe6c4e1004a39f81f3fc813381a5 Mon Sep 17 00:00:00 2001 From: ljh0608 Date: Fri, 23 Aug 2024 12:33:34 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20shaer=20api=20=ED=98=B8=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/moleculesComponents/Header.tsx | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/components/common/moleculesComponents/Header.tsx b/src/components/common/moleculesComponents/Header.tsx index 5068f5ef..1fb99031 100644 --- a/src/components/common/moleculesComponents/Header.tsx +++ b/src/components/common/moleculesComponents/Header.tsx @@ -9,7 +9,6 @@ import { useParams } from 'react-router'; import { useNavigate } from 'react-router-dom'; import styled from 'styled-components'; import { theme } from 'styles/theme'; -import { notify } from 'utils/toast/copyLinkToast'; import Navigation from './Navigation'; @@ -21,6 +20,7 @@ interface HeaderProps { setSelectScheduleStep?: Dispatch>; } + function Header({ position, setFunnelStep }: HeaderProps) { const { scheduleStep, setScheduleStep } = useScheduleStepContext(); const navigationOptions = [ @@ -59,6 +59,28 @@ function Header({ position, setFunnelStep }: HeaderProps) { }; const { meetingId } = useParams(); + + const shareData = { + title: "ASAP", + text: "회의 시간을 입력해주세요", + url: `${import.meta.env.VITE_WEB_IP}/meet/${meetingId}`, + }; + + const handleWebShare=async()=>{ + // if (navigator.share && navigator.canShare(shareData)) { + // console.log("test"); + try{ + await navigator.share(shareData); + } + catch(err){ + alert(err + "지원하지 않는 브라우저"); + } + // } else { + // alert("out"); + // } + + + } return ( <> @@ -106,7 +128,8 @@ function Header({ position, setFunnelStep }: HeaderProps) { {(position==="completeCreateMeeting" || position==="cueCard" || position==="confirmMeet") && - + {/* */} + From 2873a84aa61fa752e119b53382db8456e89badf2 Mon Sep 17 00:00:00 2001 From: ljh0608 Date: Fri, 23 Aug 2024 12:55:09 +0900 Subject: [PATCH 2/5] =?UTF-8?q?test:=20webshare=20https=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=EB=A5=BC=EC=9C=84=ED=95=9C=20=EC=BB=A4?= =?UTF-8?q?=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/moleculesComponents/Header.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/moleculesComponents/Header.tsx b/src/components/common/moleculesComponents/Header.tsx index 1fb99031..bf0a6491 100644 --- a/src/components/common/moleculesComponents/Header.tsx +++ b/src/components/common/moleculesComponents/Header.tsx @@ -78,7 +78,7 @@ function Header({ position, setFunnelStep }: HeaderProps) { // } else { // alert("out"); // } - +//test } return ( From 1af5ae83f18fd4a0746d898974c862cd82f84dba Mon Sep 17 00:00:00 2001 From: ljh0608 Date: Mon, 2 Sep 2024 15:01:17 +0900 Subject: [PATCH 3/5] git test --- .../components/selectPriority/PriorityDropdown.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/selectSchedule/components/selectPriority/PriorityDropdown.tsx b/src/pages/selectSchedule/components/selectPriority/PriorityDropdown.tsx index c62d9c04..d289137c 100644 --- a/src/pages/selectSchedule/components/selectPriority/PriorityDropdown.tsx +++ b/src/pages/selectSchedule/components/selectPriority/PriorityDropdown.tsx @@ -132,6 +132,7 @@ function PriorityDropdown() { return updatedInput; }); }; + //test return ( {isOpenDropDown.map((item, idx) => ( From 662d48db90387a9e16ddef7a27c5b4eb8074bfec Mon Sep 17 00:00:00 2001 From: ljh0608 Date: Mon, 2 Sep 2024 15:29:06 +0900 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20toast=20=EC=A7=A4=EB=A6=AC=EB=8A=94?= =?UTF-8?q?=20=EB=B6=80=EB=B6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/toast/ToastContainer.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/toast/ToastContainer.tsx b/src/utils/toast/ToastContainer.tsx index 14edeb94..d97ac1e2 100644 --- a/src/utils/toast/ToastContainer.tsx +++ b/src/utils/toast/ToastContainer.tsx @@ -24,7 +24,8 @@ export default ToastContainerBox; const StyledToastContainer = styled(ToastContainer)` display: flex; position: absolute; - bottom: 6rem; + bottom: 5rem; + height: 10rem; align-items: center; justify-content: center; overflow: hidden; From 198fcaaf3cc0b2c32bebfef5e3d16003174af41e Mon Sep 17 00:00:00 2001 From: ljh0608 Date: Mon, 2 Sep 2024 15:31:15 +0900 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9D=98=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=ED=8E=98=EC=9D=B4=EC=A7=80=20webShare=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "src/\bhooks/useShareLink.ts" | 34 +++++++++++++++++ .../common/moleculesComponents/Header.tsx | 37 +++++-------------- .../selectPriority/PriorityDropdown.tsx | 1 - 3 files changed, 44 insertions(+), 28 deletions(-) create mode 100644 "src/\bhooks/useShareLink.ts" diff --git "a/src/\bhooks/useShareLink.ts" "b/src/\bhooks/useShareLink.ts" new file mode 100644 index 00000000..cb682570 --- /dev/null +++ "b/src/\bhooks/useShareLink.ts" @@ -0,0 +1,34 @@ +import { useParams } from 'react-router-dom'; +import { notify } from 'utils/toast/copyLinkToast'; + +const useShareLink = () => { + const { meetingId } = useParams(); + + const inviteURL = `${window.location.origin}/meet/${meetingId}`; + const shareData = { + title: 'ASAP', + text: '회의 시간을 입력해주세요', + url: inviteURL, + }; + + const handleCopyToClipboard = async () => { + try { + await navigator.clipboard.writeText(inviteURL); + notify(); + } catch { + alert('링크복사에 실패했습니다. \n 다시 시도해주세요.'); + } + }; + + const handleWebShare = async () => { + if (navigator.share) { + navigator.share(shareData); + } else { + handleCopyToClipboard(); + } + }; + + return { inviteURL, handleCopyToClipboard, handleWebShare }; +}; + +export default useShareLink; diff --git a/src/components/common/moleculesComponents/Header.tsx b/src/components/common/moleculesComponents/Header.tsx index c6b79168..a1d37eb6 100644 --- a/src/components/common/moleculesComponents/Header.tsx +++ b/src/components/common/moleculesComponents/Header.tsx @@ -5,8 +5,8 @@ import { BackIc, ExitIc, HambergerIc, LinkIc, MainLogoIc } from 'components/Icon import { useScheduleStepContext } from 'pages/selectSchedule/contexts/useScheduleStepContext'; import { ScheduleStepType } from 'pages/selectSchedule/types'; import CopyToClipboard from 'react-copy-to-clipboard'; -import { useParams } from 'react-router'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, useParams } from 'react-router-dom'; +import useShareLink from 'src/\bhooks/useShareLink'; import styled from 'styled-components'; import { theme } from 'styles/theme'; @@ -23,6 +23,10 @@ interface HeaderProps { function Header({ position, setFunnelStep }: HeaderProps) { const { scheduleStep, setScheduleStep } = useScheduleStepContext(); + const { meetingId } = useParams(); + + const {inviteURL, handleWebShare} = useShareLink(); + const navigationOptions = [ { title: '회의 일정 정하기', @@ -57,30 +61,8 @@ function Header({ position, setFunnelStep }: HeaderProps) { } } }; + console.log(window.location.origin); - const { meetingId } = useParams(); - - const shareData = { - title: "ASAP", - text: "회의 시간을 입력해주세요", - url: `${import.meta.env.VITE_WEB_IP}/meet/${meetingId}`, - }; - - const handleWebShare=async()=>{ - // if (navigator.share && navigator.canShare(shareData)) { - // console.log("test"); - try{ - await navigator.share(shareData); - } - catch(err){ - alert(err + "지원하지 않는 브라우저"); - } - // } else { - // alert("out"); - // } -//test - - } return ( <> @@ -129,8 +111,9 @@ function Header({ position, setFunnelStep }: HeaderProps) { {(position==="completeCreateMeeting" || position==="cueCard" || position==="confirmMeet") && {/* */} - - + + + diff --git a/src/pages/selectSchedule/components/selectPriority/PriorityDropdown.tsx b/src/pages/selectSchedule/components/selectPriority/PriorityDropdown.tsx index 49a57f7a..f1dda7c5 100644 --- a/src/pages/selectSchedule/components/selectPriority/PriorityDropdown.tsx +++ b/src/pages/selectSchedule/components/selectPriority/PriorityDropdown.tsx @@ -132,7 +132,6 @@ function PriorityDropdown() { return updatedInput; }); }; - //test return ( {isOpenDropDown.map((item, idx) => (