Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] 전체화면 권장 제거 #409

Merged
merged 2 commits into from
Aug 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions src/views/MyPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { track } from '@amplitude/analytics-browser';
import { MouseEvent, useContext } from 'react';
import { useContext } from 'react';

import Button from '@components/Button';
import Callout from '@components/Callout';
Expand Down Expand Up @@ -35,26 +35,15 @@ const MyInfoItem = ({ label, value }: { label: string; value?: string | number |
const StatusButton = ({ label, to, trackingEvent }: { label: string; to: string; trackingEvent: string }) => {
const deviceType = useDevice();

const handlePreventMobile = (e: MouseEvent<HTMLButtonElement>) => {
track(trackingEvent);
if (label === '지원상태') return;

const isMobile = /Mobi/i.test(window.navigator.userAgent);
if (isMobile) {
alert('PC로 이용해주세요.');
e.preventDefault();
return;
}
if (deviceType !== 'DESK') {
alert('전체화면 이용을 권장드려요.');
return;
}
};

return (
<li className={buttonValue}>
<span className={infoLabelVar[deviceType]}>{label}</span>
<Button isLink to={to} className={buttonWidthVar[deviceType]} onClick={handlePreventMobile} padding="15x25">
<Button
isLink
to={to}
className={buttonWidthVar[deviceType]}
onClick={() => track(trackingEvent)}
padding="15x25">
{label === '지원서' ? '지원서 확인' : '결과 확인'}
</Button>
</li>
Expand Down