-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Safari 브라우저 사용 시 보이는 AutoplayGuideModal 생성
브라우저가 Safari일 때, 로그인 후 최초 접근일 때를 고려해서 모달이 보여지도록 구현했습니다. 추가로 영상 가운데 아이콘 부분 커서 안 잡히는 문제 해결했습니다.
- Loading branch information
1 parent
728af8e
commit faa1ee3
Showing
5 changed files
with
101 additions
and
9 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { getCookie, setCookie } from 'commons/cookie/cookie'; | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
interface AutoplayGuideModalProps { | ||
browserInfo: string; | ||
} | ||
|
||
const SafariAutoplayGuideModal = ({ browserInfo }: AutoplayGuideModalProps) => { | ||
const browsers = [ | ||
'Chrome', | ||
'Opera', | ||
'WebTV', | ||
'Whale', | ||
'Beonex', | ||
'Chimera', | ||
'NetPositive', | ||
'Phoenix', | ||
'Firefox', | ||
'Safari', | ||
'SkipStone', | ||
'Netscape', | ||
'Mozilla', | ||
]; | ||
const [isSafari, setIsSafari] = useState<boolean>(false); | ||
const [currentBrowser, setCurrentBrowser] = useState<string>(''); | ||
const [isClose, setIsClose] = useState<boolean>(false); | ||
const isFirstTime = getCookie('isFirstTime'); | ||
|
||
const handleCloseButton = () => { | ||
setIsClose(true); | ||
setCookie('isFirstTime', 'false', { | ||
maxAge: 60000 * 60 * 24 * 30, | ||
}); | ||
}; | ||
|
||
const handleBrowserInfo = async () => { | ||
switch (true) { | ||
case browserInfo.includes('edg'): | ||
setCurrentBrowser('Edge'); | ||
break; | ||
case browserInfo.includes('trident') || browserInfo.includes('msie'): | ||
setCurrentBrowser('Internet Explorer'); | ||
break; | ||
default: | ||
if (currentBrowser === 'Safari') { | ||
setIsSafari(true); | ||
} | ||
|
||
setCurrentBrowser( | ||
browsers.find((browser) => | ||
browserInfo.includes(browser.toLowerCase()), | ||
) || 'Other', | ||
); | ||
|
||
break; | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
handleBrowserInfo(); | ||
}, [currentBrowser]); | ||
|
||
return isSafari && !isClose && Boolean(isFirstTime) ? ( | ||
<dialog | ||
open={isClose} | ||
className="w-[400px] h-[400px] rounded-md flex flex-col justify-around items-center z-50" | ||
> | ||
<button | ||
className="absolute top-3 right-3 text-lg font-bold" | ||
onClick={handleCloseButton} | ||
> | ||
X | ||
</button> | ||
<div className="flex flex-col gap-2 items-center"> | ||
<span className="font-bold text-3xl">Safari</span> | ||
<span className="font-bold text-xl">자동재생 가이드</span> | ||
</div> | ||
<img></img> | ||
<div className="flex flex-col gap-2 items-center font-normal text-lg"> | ||
<span className="">원활한 컨텐츠 사용을 위해</span> | ||
<span className="">Safari 환경설정의 자동 재생을 켜주세요.</span> | ||
</div> | ||
</dialog> | ||
) : null; | ||
}; | ||
|
||
export default SafariAutoplayGuideModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters